Skip to content

feat(promql): PromQL as a dashboard widget data source - #2667

Open
Makisuo wants to merge 54 commits into
promql/5-prometheus-apifrom
promql/6-widgets
Open

Makisuo wants to merge 54 commits into
promql/5-prometheus-apifrom
promql/6-widgets

Merge branch 'promql/5-prometheus-api' into promql/6-widgets

d63b2e2
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 16, 2026 in 3m 7s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. Variable escaping, step selection and row mapping are pure and pinned by behavioral tests; the one external dependency, the Invalid PromQL: message prefix, matches at query-engine.http.ts:2750.
no findings · tests covered · risk medium · 3/3 new units observable

Adds PromQL as a dashboard widget data source: a promql v2/v3 data source kind, an internal promql_chart query path used by both the browser and shared boards, MCP support, and a PromQL tab in the widget editor. The hunks I read hold up and are covered by tests.

  • promqlDataSourceOf writes display type, legend and min step onto the widget's source
  • interpolatePromqlVariables escapes values per quote context and expands All to an alternation
  • promqlRowsForDisplay maps matrix, vector and scalar results onto line, stat and table rows
  • New promql_chart internal endpoint and a PromQL tab in the widget editor

Production impact

Telemetry this change adds and removes (2)
  • ➕ span name PromqlQueryService.widget · packages/backend/src/services/promql/PromqlQueryService.ts:577
  • ➕ span name QueryEngine.getPromqlChart · packages/web-data/src/warehouse/promql-chart.ts:24
What was checked
  • promqlParseErrorOf needs the Invalid PromQL: prefix; both producers emit it (query-engine.http.ts:2750, DashboardWidgetDataService.ts:527)
  • PromQL tiles are batched through the same planner and window clamping as Raw SQL, and gated on metrics:read (DashboardWidgetDataService.ts:590)
  • quoteRuns keeps a substituted value inside its quote context, so a hostile variable value cannot add a selector or operator
Observability coverage: 3 of 3 changes observable
Change Kind Observable Evidence
POST internal promql_chart query endpoint http yes Registered in the existing queryEngine group of MapleInternalApi, whose internal-HTTP and warehouse tracing is untouched by this diff
PromQL branch of DashboardWidgetDataService.resolve/resolveBatch (one per widget) request yes Runs through PromqlQueryService and WarehouseQueryService, the traced path the Raw SQL branch uses
Widget editor PromQL tab (preview fetch per Run preview) client yes Preview goes through FetchWidget and the internal endpoint above; no new bare console logging added

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