Exposes basic metrics for your repositories from the GitHub API, to a Prometheus compatible endpoint.
This exporter is configured via environment variables. All variables are optional unless otherwise stated. Below is a list of supported configuration values:
When authenticating with the GitHub API, the exporter uses credentials in the following order of precedence:
- GitHub App credentials (
GITHUB_APP=truewithGITHUB_APP_ID,GITHUB_APP_INSTALLATION_ID, andGITHUB_APP_KEY_PATH): If enabled, the exporter authenticates as a GitHub App and ignores any personal access token or token file. - Token file (
GITHUB_TOKEN_FILE): If a token file is provided (and GitHub App is not enabled), the exporter reads the token from the specified file. - Direct token (
GITHUB_TOKEN): If neither GitHub App nor token file is provided, the exporter uses the token supplied directly via the environment variable.
If none of these credentials are provided, the exporter will make unauthenticated requests, which are subject to very strict rate limits.
Run manually from Docker Hub:
docker run -d --restart=always -p 9171:9171 -e REPOS="infinityworks/ranch-eye, infinityworks/prom-conf" githubexporter/github-exporter
Run manually from Docker Hub (With GitHub App):
docker run -d --restart=always -p 9171:9171 --read-only -v ./key.pem:/key.pem -e GITHUB_APP=true -e GITHUB_APP_ID= -e GITHUB_APP_INSTALLATION_ID= -e GITHUB_APP_KEY_PATH=/key.pem <IMAGE_NAME>
Build a docker image:
docker build -t <image-name> .
github-exporter:
tty: true
stdin_open: true
expose:
- 9171
ports:
- 9171:9171
image: githubexporter/github-exporter:latest
environment:
- REPOS=<REPOS you want to monitor>
- GITHUB_TOKEN=<your github api token>
github-exporter-github-app:
tty: true
stdin_open: true
expose:
- 9171
ports:
- 9171:9171
build: .
environment:
- LOG_LEVEL=debug
- LISTEN_PORT=9171
- GITHUB_APP=true
- GITHUB_APP_ID=
- GITHUB_APP_INSTALLATION_ID=
- GITHUB_APP_KEY_PATH=/key.pem
restart: unless-stopped
volumes:
- "./key.pem:/key.pem:ro"
Metrics will be made available on port 9171 by default
An example of these metrics can be found in the METRICS.md markdown file in the root of this repository
There is a set of blackbox behavioural tests which validate metrics endpoint in the test directory.
Run as follows
make testOnce a new pull request has been merged into master the following script should be executed locally. The script will trigger a new image build in docker hub with the new image having the tag release-<version>. The version is taken from the VERSION file and must follow semantic versioning. For more information see semver.org.
Prior to running the following command ensure the number has been increased to desired version in VERSION:
./release-version.sh