Skip to content

Commit 9af577a

Browse files
committed
Add Grafana
1 parent 8be9e0a commit 9af577a

File tree

13 files changed

+5564
-200
lines changed

13 files changed

+5564
-200
lines changed

Makefile

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,29 @@ This exporter converts raw GitHub pull request data to time series. The exported
88

99
The timestamp is the creation time of the PR.
1010

11-
Exposed metrics name: `prs.time_to_merge`
11+
Exposed metrics name: `github.{USER_NAME}.{REPO_NAME}.pull_requests.time_to_merge`
1212

1313
## Usage
1414

1515
```sh
1616
$ npm install
1717

18+
# At the moment the user name & repo name are only used to build up the metrics path
19+
$ export USER_NAME=github-user-name
20+
$ export REPO_NAME=repository-name
21+
1822
# Path to the SQLite db file containing the PR data retrieved from GitHub.
1923
$ export PULL_REQUESTS_DATABASE_PATH=data/example.db
2024

21-
$ npm start
25+
# Push data to graphite
26+
$ npm start | nc localhost 2003
2227

2328
# The generated time series will be written to `stdout`.
24-
# prs.time_to_merge 3450 1554125772
25-
# prs.time_to_merge 935617 1553187544
29+
# github.github-user-name.repository-name.pull_requests.time_to_merge 3450 1554125772
30+
# github.github-user-name.repository-name.pull_requests.time_to_merge 935617 1553187544
2631
# ...
2732
```
2833

29-
If you have docker installed, try `make run` to explore the metric. The target spins up a Graphite stack and injects some [sample data](./data/example.db) which can be explored through the exposed Graphite UI on [localhost:80](http://localhost).
30-
3134
## Todo
3235

3336
- [x] Exclude non-business hours from calculation

data/example.db

2.16 MB
Binary file not shown.

data/grafana-example-dashboard.json

Lines changed: 0 additions & 152 deletions
This file was deleted.

docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3.3'
2+
3+
services:
4+
grafana:
5+
build: './grafana'
6+
container_name: github-metrics-grafana
7+
restart: always
8+
ports:
9+
- '3000:3000'
10+
11+
graphite:
12+
image: graphiteapp/graphite-statsd
13+
container_name: github-metrics-graphite
14+
restart: always
15+
ports:
16+
- '80:80'
17+
- '2003:2003'
18+
- '2004:2004'
19+
- '8080:8080'

github-metrics-graphite-exporter.iml

Lines changed: 0 additions & 9 deletions
This file was deleted.

grafana/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM grafana/grafana:6.1.4
2+
3+
ADD ./config.ini /etc/grafana/config.ini
4+
ADD ./dashboards /var/lib/grafana/dashboards
5+
ADD ./provisioning /etc/grafana/provisioning

grafana/config.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[paths]
2+
provisioning = /etc/grafana/provisioning
3+
4+
[server]
5+
enable_gzip = true
6+
7+
[users]
8+
default_theme = light
9+

0 commit comments

Comments
 (0)