How to Build a CI Metrics Dashboard in Grafana
A CI dashboard is a handful of PromQL panels: duration, success rate, and queue time over your build metrics.
Point Grafana at the Prometheus that holds your CI metrics, then add panels. Provision the dashboard as JSON so it lives in version control instead of the UI.
Steps
- Add the Prometheus data source that scrapes your CI metrics.
- Create panels for duration, success rate, and queue time.
- Export the dashboard JSON and check it into the repo.
Provisioning
otel-collector.yaml
apiVersion: 1
providers:
- name: ci-dashboards
type: file
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: truePanel query
Terminal
# p95 build duration by workflow
histogram_quantile(0.95,
sum(rate(ci_build_duration_seconds_bucket[1h])) by (le, workflow))Related guides
How to Track Job Duration, Queue Time, and Success RateTrack per-job duration, queue time, and success rate in CI by emitting a histogram and a counter labeled by j…
How to Annotate Deploys in Grafana and DatadogAdd deploy annotations to Grafana and Datadog from the pipeline using their annotation APIs, so a vertical ma…