Prometheus exporter for github metrics
Switch branches/tags
Clone or download
Rucknar Merge pull request #31 from caarlos0/more
feat: added more fields to the metrics
Latest commit 7ec4b4e Nov 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config s/TrimLeft/TrimSpace/ Dec 27, 2017
exporter fix: typo Jul 23, 2018
Dockerfile bump version, change --no-cache Nov 15, 2017
LICENSE intial commit Sep 12, 2016
METRICS.md fix: typo Jul 23, 2018
README.md support for monitoring users Aug 28, 2017
docker-compose.yml add docker-compose file Aug 4, 2017
main.go Fixed case in imports Jul 17, 2017

README.md

Prometheus GitHub Exporter

Exposes basic metrics for your repositories from the GitHub API, to a Prometheus compatible endpoint.

Configuration

This exporter is setup to take input from environment variables:

Required

  • ORGS If supplied, the exporter will enumerate all repositories for that organization. Expected in the format "org1, org2".
  • REPOS If supplied, The repos you wish to monitor, expected in the format "user/repo1, user/repo2". Can be across different Github users/orgs.
  • USERS If supplied, the exporter will enumerate all repositories for that users. Expected in the format "user1, user2".

At least one of those 3 options should be provided.

Optional

  • GITHUB_TOKEN If supplied, enables the user to supply a github authentication token that allows the API to be queried more often. Optional, but recommended.
  • GITHUB_TOKEN_FILE If supplied instead of GITHUB_TOKEN, enables the user to supply a path to a file containing a github authentication token that allows the API to be queried more often. Optional, but recommended.
  • API_URL Github API URL, shouldn't need to change this. Defaults to https://api.github.com
  • LISTEN_PORT The port you wish to run the container on, the Dockerfile defaults this to 9171
  • METRICS_PATH the metrics URL path you wish to use, defaults to /metrics
  • LOG_LEVEL The level of logging the exporter will run with, defaults to debug

Install and deploy

Run manually from Docker Hub:

docker run -d --restart=always -p 9171:9171 -e REPOS="infinityworks/ranch-eye, infinityworks/prom-conf" infinityworks/github-exporter

Build a docker image:

docker build -t <image-name> .
docker run -d --restart=always -p 9171:9171 -e REPOS="infinityworks/ranch-eye, infinityworks/prom-conf" <image-name>

Docker compose

github-exporter:
    tty: true
    stdin_open: true
    expose:
      - 9171
    ports:
      - 9171:9171
    image: infinityworks/github-exporter:latest
    environment:
      - REPOS=<REPOS you want to monitor>
      - GITHUB_TOKEN=<your github api token>

Metrics

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

Metadata