The GitHub datasource allows GitHub API data to be visually represented in Grafana dashboards.
This datasource uses the githubv4
package, which is under active development.
Caching on this plugin is always enabled.
Options:
Setting | Required |
---|---|
Access token | true |
Default Organization | false |
Default Repository | true |
GitHub Enterprise URL | false |
To create a new Access Token, navigate to Personal Access Tokens and press Generate new token.
It’s possible to configure data sources using config files with Grafana’s provisioning system.
promop:
grafana:
additionalDataSources:
- name: GitHub Repo Insights
type: grafana-github-datasource
jsonData:
owner: ''
repository: ''
secureJsonData:
accessToken: '<github api token>'
Annotations overlay events on a graph.
With annotations, you can display:
on a graph.
All annotations require that you select a field to display on the annotation, and a field that represents the time that the event occurred.
Variables allow you to substitute values in a panel with pre-defined values.
You can reference them inside queries, allowing users to configure parameters such as Query
or Repository
.
You can use the following macros in your queries
Macro Name | Syntax | Description | Example |
---|---|---|---|
multiVar | $__multiVar(prefix,$var) |
Expands a multi value variable into github query string | $__multiVar(label,$labels) will expand into label:first-label label:second-label |
When using all in multi variable, use * as custom all value | |||
day | $__toDay(diff) |
Returns the day according to UTC time, a difference in days can be added | created:$__toDay(-7) on 2022-01-17 will expand into created:2022-01-10 |
For all repositories:
public_repo
repo:status
repo_deployment
read:packages
read:user
user:email
For Github projects:
read:org
read:project
An extra setting is required for private repositories
repo (Full control of private repositories)
For documentation on importing dashboards, check out the documentation on grafana.com
The sample dashboard can be obtained from either of two places.
From the Grafana dashboards page located here
From this repository
If loading it from this repository, open Grafana and click "Import Dashboard".
Copy the JSON in ./src/dashboards/dashboard.json
, and paste it into the "Import via panel json" box.
access_token
?No. This requires changes in Grafana first. See this issue in the Grafana project.
We have aggressive caching enabled due to GitHub's rate limiting policies. When selecting a time range like "Last hour", a combination of the queries for each panel and the time range is cached temporarily.
There are two times that affect an annotation:
The first selection is used to filter the events that display on the graph. For example, if you select "closed at", only events that were "closed" in your dashboard's time range will be displayed on the graph.
The second selection is used to determine where on the graph the event should be displayed.
Typically these will be the same, however there are some cases where you may want them to be different.