Skip to content

feat(dashboards): import Grafana dashboards - #2669

Open
Makisuo wants to merge 57 commits into
promql/6-widgetsfrom
promql/7-grafana-import
Open

Makisuo wants to merge 57 commits into
promql/6-widgetsfrom
promql/7-grafana-import

Merge branch 'promql/6-widgets' into promql/7-grafana-import

46d2253
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review completed Nov 16, 2026 in 3m 56s

Confidence 6/10 · 2 issues to address

🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open.
2 warnings −2 · 5 notes · tests covered · risk medium · 1/1 new units observable

Converts Grafana dashboard JSON into PromQL and ClickHouse widgets, with sections, variable rewriting, a v2 endpoint, MCP import_json and a web import report. Layout, SQL scoping and warnings are pinned by tests; the earlier findings on silently dropped targets and variables still stand at this head.

  • convertGrafanaDashboardToPortable turns panels into PromQL and raw-SQL widgets
  • POST /v2/dashboards/import/grafana imports with the shared raw-SQL scoping
  • MCP create_dashboard takes import_json for Grafana and Perses
  • The web list reports an import's warnings in a dialog

Still open from earlier reviews

Production impact

Telemetry this change adds and removes (3)
  • ➕ span name McpTool.createDashboard.convertImport · apps/ai/src/mcp/tools/create-dashboard.ts:329
  • ➕ span name HttpV2Dashboards.createImported · apps/api/src/routes/v2/dashboards.http.ts:314
  • ➕ span name GrafanaDashboardImport.convert · packages/backend/src/services/dashboards/grafana-dashboard-import.ts:248
What was checked
  • Adjacent Grafana panels share half(x) edges, and resolveOverlaps pushes grown tiles down (grafana-import-layout.ts:40-70)
  • importStats is optionalKey, so the Perses path's stats: undefined still encodes (mcp-outputs/dashboards.ts:117)
  • The importer's 50-section cap equals DASHBOARD_MAX_SECTIONS, so a big board cannot fail document decode
Observability coverage: 1 of 1 changes observable
Change Kind Observable Evidence
POST /v2/dashboards/import/grafana HTTP server route yes Declared beside the Perses import route in the same v2 router; apps/api traces the Hono app rather than per route, as every other v2 route does

46d2253 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.