Repository navigation
feat: Add promql var format for flexible escaping - #3297
Conversation
🦋 Changeset detectedLatest commit: 50d0434 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.
|
PR Review
2 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 2 minor None could be anchored to changed lines; they are listed below. Findings outside the changed lines2 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
|
Deep ReviewThis PR adds a Mechanically the change is clean: all internal callers of ✅ No critical issues found. The single-select reference behavior these findings touch was introduced in the as-yet-unreleased #3295, so none is a released regression — but each is a concrete code path worth closing before this ships. 🟡 P2 -- recommended
🔵 P3 nitpicks (1)
Reviewers (6): correctness, adversarial, typescript, testing, api-contract, previous-comments Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
## Summary Support configuring dashboard variables / filters as single-select, so that no more than one value can be selected. If the URL contains multiple values for the filter, then the first is used. ### Screenshots or video <img width="653" height="146" alt="Screenshot 2026-10-05 at 11 59 45 AM" src="https://github.com/user-attachments/assets/e0c214bb-b40e-47ef-8047-cdf7d70b4122" /> <img width="282" height="189" alt="Screenshot 2026-10-05 at 11 59 49 AM" src="https://github.com/user-attachments/assets/78b08baf-5602-4c03-b485-d294fe4dee36" /> ### How to test on Vercel preview - Create a dashboard - Add some single select variables - Observe the selection behavior ### References - Linear Issue: Related to HDX-5563 - Related PRs: #3297
431e3eb to
2f35bb4
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
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
Comments Outside DiffThese findings could not be posted inline.
|
E2E Test Results✅ All tests passed • 406 passed • 1 skipped • 1599s
Tests ran across 4 shards in parallel. |
|
Responded to the Greptile comments inline. |
karl-power
left a comment
There was a problem hiding this comment.
LGTM. One behaviour I found a bit unexpected (the P2 from Deep Review, not sure if a new feature or not): an empty single-select variable renders service="" which matches series where the label is missing, so the chart is usually empty but can possibly render an un-labelled series. An empty multi-select renders .*, which matches every series.
So with nothing selected, single select would show nothing (or empty label series) and multi select shows everything. Do you think this should be addressed in a follow up?
It's a good question, the challenge is that there is no way to "match everything" using the There are a few workarounds to restore match all behavior:
|
Summary
This PR adds a new format for variable references -
promql. This is intended to be used in promql expressions and is the new default when another format is not specified. This replaces the previous default (regex).The new format is identical in behavior to the previous format, except that single-select variables are not regex-escaped.
Motivation: Single select variables are typically referenced in PromQL with
field="$var". If $var is regex escaped, that doesn't work. Multi-select should always be regex escaped and referenced via the regex match operatorfield=~"$var".This is backwards compatible except for references to single-select variables (#3295), which have not yet been released.
Screenshots or video
How to test locally
References