Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

equisoft/prometheus-exporter-github

Repository files navigation

Prometheus-Exporter-Github

This project extract many github statistic for prometheus. It acheives it's goal by leverage the fabulous octokit project. It also 100% respect github rate limits by using this extremely useful throttling-plugin project.

Metrics

All metrics can be found in src/metrics.ts file.

Some notable metrics are :

  • Total number of repositories, private and public per organization.
  • Total number of stars and issues per repository.
  • Total number of branch per repository.
  • Total number of pull request, open, merged and closed per repo and per organization.
  • Total number of pull request that are waiting to be approved, are approved but not merged

Development

Build && Run

docker build . -t prometheus-exporter-github
docker run -e GITHUB_ORGANIZATION=org -e LOG_LEVEL=silly -p 8080:8080 --rm -it prometheus-exporter-github

Server is accessible on http://localhost/metrics

For development, add sources

cd prometheus-exporter-github
docker run -e GITHUB_TOKEN=your-github-personnal-token -e GITHUB_ORGANIZATION=org -e LOG_LEVEL=silly -v $(pwd):/app -p 8080:8080 --rm -it prometheus-exporter-github

Integration with Prometheus

A docker-compose file provide integration with prometheus server.

export GITHUB_TOKEN=your-github-personnal-token
export GITHUB_ORGANIZATION=org
docker-compose up

Lint

docker run -v $(pwd):/app --rm -it prometheus-exporter-github tslint

Environment Variables

LOG_LEVEL

Value in silly, debug, verbose, info, warn, error. Default info. See winston.

LOG_FORMAT

Value in json, prettyPrint. Some format described in winston documentation may not be working so stick with prettyPrint or json unless you know what you are doing. Default json. See log format for more possible format.

NODE_ENV

Value in development, production. Default production.

GITHUB_TOKEN

Personal access token, OAuth access token, GitHub app bearer token or GitHub app installation token. If you need access to private repositories add the whole repo scope. See get a Github token.

GITHUB_ORGANIZATION

Organization name.

HTTP_PORT

Port number the http server will listen to. Default 8080.

About

Github prometheus statistics exporter on steroid

Resources

License

Stars

Watchers

Forks

Packages

No packages published