Factory.ai

Open-Source Wikis

/

Grafana

/

Fun facts

grafana/grafana

Fun facts

A handful of trivia about this codebase.

The oldest line of code is from 2013

The first commit on main lands on 2013-01-25. Some of the directory names from that era (parts of pkg/services/sqlstore/, public/sass/, scripts/build/) still exist today, gradually refactored but never fully removed.

The Grafana version in main.go is wrong on purpose

pkg/cmd/grafana/main.go hardcodes:

var version = "9.2.0"

This isn't the actual Grafana version — it's a fallback. The real version is injected at build time via -ldflags "-X main.version=...". The literal 9.2.0 is left as the default in the source so unit tests have something to read; the production binary gets the real number.

The actual current version (per package.json) is 13.1.0-pre.

The biggest hand-written Go file is a dashboard schema converter

apps/dashboard/pkg/migration/conversion/v1_to_v2alpha1.go clocks in at over 3,150 lines. It converts the legacy v1 dashboard JSON into the new v2 schema and back again, lossless in both directions for every layout combination Grafana has ever supported. The reverse function lives next to it, slightly shorter. Both have been the subject of more PRs than almost any other file in apps/.

The biggest TypeScript file is a mock

public/app/features/alerting/unified/mockGrafanaNotifiers.ts is 3,675 lines of contact-point fixture data. It exists because the receiver schema is huge (every notification provider has its own option set), and storing that data in tests across many files would be even worse.

CODEOWNERS is 1,384 lines

.github/CODEOWNERS is the single longest declarative configuration file in the repo. Every directory and file pattern maps to an owning team. Reviewers are auto-requested based on this file, and tooling generates per-team manifests via yarn codeowners-manifest.

The repo has more TS/TSX test files than Go ones

The frontend has 2,275 test files (.test.* and .spec.*); the backend has 1,755 (*_test.go). Despite the backend having the larger non-test source surface (in lines), the frontend has invested more in test density.

"ngalert" is not next-generation anything anymore

The unified alerting backend is named ngalert from when it was the "next-generation" alert engine, distinct from the legacy one. The legacy engine has been removed for years; ngalert is just "alerting" at this point. The package name stays for backwards compatibility (and because rename PRs would be enormous).

Centrifuge runs inside Grafana

When you watch a dashboard live-update, you're talking to a Centrifuge node that's literally embedded in the Grafana process. Most pub/sub libraries are themselves servers; Grafana made Centrifuge a Go library and embedded it.

Grafana's plugin admin shows itself as a plugin

The plugin admin UI is built on top of the same plugin extension system it administers — the catalog, install dialog, and update notifications all flow through the standard frontend plugin runtime. The host registers itself as the "default" extension provider so it can populate the catalog UI.

The dashboard JSON format is older than React

The dashboard JSON shape with panels: [{ gridPos: { x, y, w, h }, ... }] predates the React rewrite. When dashboards moved from Angular to React, the on-disk format stayed compatible — every existing dashboard kept working. The v2 schema is the first time that compatibility is being broken (with conversion in both directions).

"Provisioning" appears three times

There are three independent things called "provisioning" in this repo:

  1. File-based provisioning of datasources/dashboards/alerts at startup (pkg/services/provisioning/).
  2. Alerting provisioning API for IaC (pkg/services/ngalert/provisioning/).
  3. Repository-based provisioning (GitOps) (apps/provisioning/ + public/app/features/provisioning/).

They have different APIs, different storage models, and different UIs. Read carefully when you encounter the term in code reviews.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Fun facts – Grafana wiki | Factory