feat: Substitute variables in PromQL charts - #2994
Conversation
🦋 Changeset detectedLatest commit: dbfd2d6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR extends dashboard-variable substitution to PromQL chart previews and rendered dashboard tiles.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/common-utils/src/variables.ts | Adds PromQL-aware variable parsing, formatting, escaping, and chart-config substitution. |
| packages/app/src/DBDashboardPage.tsx | Includes referenced dashboard variables in queried PromQL tile configurations. |
| packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx | Resolves referenced variables for PromQL chart previews as well as existing chart types. |
| packages/app/src/components/ChartEditor/PromqlChartEditor.tsx | Limits PromQL metric-name metadata requests to sources explicitly identified as PromQL. |
| packages/app/tests/e2e/features/dashboard-filter-variables.spec.ts | Adds end-to-end coverage for creating and rendering a PromQL chart that references a dashboard variable. |
| packages/app/tests/e2e/fixtures/e2e-fixtures.json | Adds the E2E PromQL source to the shared source fixture. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Dashboard[Dashboard variable selections] --> Filter[Find variables referenced by PromQL]
Filter --> Config[Attach referenced variables to chart config]
Config --> Substitute[Apply PromQL-aware substitution and escaping]
Substitute --> Query[Execute PromQL query]
Query --> Chart[Render chart]
Reviews (4): Last reviewed commit: "test: Create promql source in e2e fixtur..." | Re-trigger Greptile
E2E Test Results✅ All tests passed • 315 passed • 1 skipped • 1151s
Tests ran across 4 shards in parallel. |
45f9f8e to
43bad9f
Compare
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Deep Review✅ No critical issues found. This PR cleanly extends dashboard-variable substitution to PromQL charts. The No injection risk was found: dashboard values are regex-escaped and then have 🔵 P3 nitpicks (2)
Review lenses applied (7): correctness, security, adversarial, maintainability, testing, typescript, previous-comments. Testing gaps: none substantive — new escaping, empty-selection ( |
719d0a1 to
dbfd2d6
Compare
Summary
This PR extends variable substitution to PromQL charts. E2E has been updated to seed a Timeseries engine table for validating the variable substitution.
Note that this requires enabling the following feature toggles:
(In the UI)
(In the API)
Screenshots or video
How to test
ResourceAttributes['service.instance.id']from the metrics gauge tablehttp_client_duration_milliseconds_count{instance=~"$Instance"}References