Github Pond

English中文

Summary

This plugin gathers data from GitHub to display information to the user in Grafana. We can help tech leaders answer such questions as:

  • Is this month more productive than last?
  • How fast do we respond to customer requirements?
  • Was our quality improved or not?

Metrics

Here are some examples of what we can use GitHub data to show:

  • Avg Requirement Lead Time By Assignee
  • Bug Count per 1k Lines of Code
  • Commit Count over Time

Screenshot

image

Configuration

Provider (Datasource) Connection

The connection aspect of the configuration screen requires the following key fields to connect to the GitHub API. As GitHub is a single-source data provider at the moment, the connection name is read-only as there is only one instance to manage. As we continue our development roadmap we may enable multi-source connections for GitHub in the future.

  • Connection Name [READONLY]
    • ⚠️ Defaults to “Github” and may not be changed.
  • Endpoint URL (REST URL, starts with https:// or http://)
    • This should be a valid REST API Endpoint eg. https://api.github.com/
    • ⚠️ URL should end with/
  • Auth Token(s) (Personal Access Token)
    • For help on Creating a personal access token, please see official GitHub Docs on Personal Tokens
    • Provide at least one token for Authentication with the . This field accepts a comma-separated list of values for multiple tokens. The data collection will take longer for GitHub since they have a rate limit of 2k requests per hour. You can accelerate the process by configuring multiple personal access tokens.

“For API requests using Basic Authentication or OAuth, you can make up to 5,000 requests per hour.”

If you have a need for more api rate limits, you can set many tokens in the config file and we will use all of your tokens.

NOTE: You can get 15000 requests/hour/token if you pay for GitHub enterprise.

For an overview of the GitHub REST API, please see official GitHub Docs on REST

Click Save Connection to update connection settings.

Provider (Datasource) Settings

Manage additional settings and options for the GitHub Datasource Provider. Currently there is only one optional setting, Proxy URL. If you are behind a corporate firewall or VPN you may need to utilize a proxy server.

GitHub Proxy URL [ Optional] Enter a valid proxy server address on your Network, e.g. http://your-proxy-server.com:1080

Click Save Settings to update additional settings.

Regular Expression Configuration

Define regex pattern in request options

  • prType: Define key word to associate issue in pr body
  • prComponent: Define key word to associate issue in pr body
  • prBodyClosePattern: Define key word to associate issue in pr body
  • issueSeverity: Define key word to associate issue in pr body
  • issuePriority: Define key word to associate issue in pr body
  • issueComponent: Define key word to associate issue in pr body
  • issueTypeBug: Define key word to associate issue in pr body
  • issueTypeIncident: Define key word to associate issue in pr body
  • issueTypeRequirement: Define key word to associate issue in pr body

Sample Request

In order to collect data, you have to compose a JSON looks like following one, and send it by selecting Advanced Mode on Create Pipeline Run page:

  1. Configure-UI Mode
[
  [
    {
      "plugin": "github",
      "options": {
        "repo": "lake",
        "owner": "merico-dev"
        // add more config such as prType if necessary.
      }
    }
  ]
]

and if you want to perform certain subtasks.

[
  [
    {
      "plugin": "github",
      "subtasks": ["collectXXX", "extractXXX", "convertXXX"],
      "options": {
        "repo": "lake",
        "owner": "merico-dev"
      }
    }
  ]
]
  1. Curl Mode: You can also trigger data collection by making a POST request to /pipelines.
curl --location --request POST 'localhost:8080/pipelines' \
--header 'Content-Type: application/json' \
--data-raw '
{
    "name": "github 20211126",
    "tasks": [[{
        "plugin": "github",
        "options": {
            "repo": "lake",
            "owner": "merico-dev"
        }
    }]]
}
'

and if you want to perform certain subtasks.

curl --location --request POST 'localhost:8080/pipelines' \
--header 'Content-Type: application/json' \
--data-raw '
{
    "name": "github 20211126",
    "tasks": [[{
        "plugin": "github",
        "subtasks": ["collectXXX", "extractXXX", "convertXXX"],
        "options": {
            "repo": "lake",
            "owner": "merico-dev"
        }
    }]]
}
'