Skip to content

skuzzle/gh-prom-exporter

Repository files navigation

Coverage Status Twitter Follow

gh-prom-exporter

Export your favorite GitHub repositories to Prometheus

  • Use it as a service: See https://gh.skuzzle.de for instructions
  • Deploy it on-premise: docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.19

On-Premise deployment with docker

This application can easily be run as a docker container in whatever environment you like:

docker run -p 8080:8080 \
    -e WEB_ALLOWANONYMOUSSCRAPE=true \
    ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.19

With anonymous scraping allowed, you can now easily view the scrape results directly in the browser by navigating to http://localhost:8080/YOUR-GITHUB-USERNAME/YOUR-REPOSITORY.

The scraped repository can just as easily be added as static scrape target to your prometheus' scrape configs. You can also scrape multiple repositories of the same owner at once:

scrape_configs:
- job_name: CHANGE_ME
  scrape_interval: 2m
  metrics_path: /YOUR-GITHUB-USERNAME/YOUR-REPOSITORY1,YOUR-REPOSITORY2
  static_configs:
    - targets: ['your.docker.host:8080']

In case you want to enforce authenticated scrapes only, use this configuration instead:

docker run -p 8080:8080 \
    ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.19

Scraping now requires a GitHub access token, otherwise the service will respond with 401/Unauthorized.

scrape_configs:
- job_name: CHANGE_ME
  scrape_interval: 2m
  basic_auth: 
    username: YOUR-GITHUB-USERNAME
    password: YOUR-GITHUB-ACCESS-TOKEN
  metrics_path: /YOUR-GITHUB-USERNAME/YOUR-REPOSITORY
  static_configs:
    - targets: ['your.docker.host:8080']