Giter Site home page Giter Site logo

github-metrics's Introduction

Build Status

Github Pull Request Metrics

Grafana Example

Available Metrics

Tables Description Graphite Path
Time to merge The exported data points represent the number of seconds elapsed between the creation of the pull request and the merging of the pull request. github.{OWNER}.{REPO}.pull_requests.{SIZE}.time_to_merge

Explanation:

  • OWNER: the owner of the repo (e.g. facebook)
  • REPO: the repository name (e.g. react)
  • SIZE: size calculated based on the total lines of code changed (additions and deletions).

Pull Request Sizes

The pull request size calculated based on the total lines of code changed (total additions + total deletions).

Name Description
size_XS Denotes a PR that changes 0-9 lines.
size_S Denotes a PR that changes 10-29 lines.
size_m Denotes a PR that changes 30-99 lines.
size_l Denotes a PR that changes 100-499 lines.
size_xl Denotes a PR that changes 500-999 lines.
size_xxl Denotes a PR that changes 1000+ lines.

Usage

# Create a personal access tokens (https://github.com/settings/tokens/new)
$ export GITHUB_TOKEN=github-token

# Path to the SQLite db file to store the collected data
$ export DATABASE_PATH=data/github.db

$ npm install

# Collect data from GitHub
# npm start collect <owner> <repository>
$ npm start collect facebook react

# Push data to graphite
# npm start export <owner> <repository>
$ npm start export:graphite facebook react | nc localhost 2003

# The generated time series will be written to `stdout`.
# github.facebook.react.pull_requests.size_m.time_to_merge 3450 1554125772
# github.facebook.react.pull_requests.size_xxl.time_to_merge 935617 1553187544
# ...

You can run the complete stack using Docker Compose, just set your environment variables in the .env file in the root project according to the example .env.example and run docker-compose up.

For example:

# Note that the `./data` directory is mounted to the docker container, to keep your data persistent place your sqlite database in here
$ cat > .env <<EOL
GITHUB_TOKEN=create a new token here https://github.com/settings/tokens/new
DATABASE_PATH=path to your sqlite3 database e.g. data/github.db
EOL

$ docker-compose up

Docker

# Add your GitHub token and database path to the .env or export them
$ export GITHUB_TOKEN=github-token
$ export DATABASE_PATH=data/github.db

# Run the collector
$ make collect owner=facebook repository=react

# Pipe the data to Graphite
$ make export-graphite owner=facebook repository=react | nc localhost 2003

github-metrics's People

Contributors

matchilling avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.