Intro to Observability as Code: Managing Dashboards with GitOps

Observability dashboards are as important as the metrics and logs they visualize — but they’re also easy to lose track of when dashboards are edited by hand in a running instance. Treating dashboards as code and managing them via GitOps brings repeatability, reviewability, and a clear lifecycle: change in Git → CI validation → automated deploy to Grafana. Recent improvements across the Grafana ecosystem and supporting tools have made this pattern practical for small teams and platforms alike. (grafana.com)

Why treat dashboards as code?

Common GitOps patterns for dashboards

Tools you’ll see in the wild

A compact GitOps workflow for dashboards (high level)

  1. Author: create or update dashboard JSON or template in a feature branch.
  2. CI validation: run lint/JSON schema validation, and if using templates (Jsonnet/Grizzly), render to final JSON and validate panel queries and variables.
  3. Pull request review: team reviews UI and queries (the PR shows the real JSON diff so reviewers can see exact changes).
  4. Merge → GitOps sync: Argo CD / Flux or a CI job applies manifests (GrafanaDashboard CRs or an API push via Grizzly). The operator or the CI job reconciles the Git state into Grafana.
  5. Observability checks: confirm the dashboard appears, panels load data, and variables resolve.

Example: GrafanaDashboard CR (simplified)

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
  name: example-service-dashboard
spec:
  instanceSelector:
    matchLabels:
      dashboards: "grafana"
  json: >
    {
      "id": null,
      "title": "Example Service Overview",
      "panels": [ ... ]
    }

This is the pattern used by the Grafana Operator: put the JSON (or a URL/gzipped JSON) in a CR and let the operator create or update the dashboard in Grafana. The operator supports several input modes so you can choose the representation that best fits your repo layout. (grafana.github.io)

Validating dashboards in CI

Common pitfalls and how teams avoid them

Why this approach scales

Conclusion Managing dashboards with GitOps turns what’s often a manual, ad-hoc process into a repeatable, reviewable, and automatable workflow. The Grafana ecosystem now supports both operator-driven (Kubernetes) and API-driven (client-side) flows — tools like the Grafana Operator, Grizzly, Grafana’s Git Sync, and templating libraries make it practical to treat dashboards as first-class code. Pick the workflow that matches your platform (kubernetes-first or not), keep rendered JSON easy to inspect in PRs, and validate dashboards in CI so Git truly becomes the single source of truth. (grafana.com)