Skip to content
Latchkey

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: true

Panel query

Terminal
# p95 build duration by workflow
histogram_quantile(0.95,
  sum(rate(ci_build_duration_seconds_bucket[1h])) by (le, workflow))

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →