[BUGFIX]: fix prometheus queryParam interpolation does not work for customAllValue#181
Open
zhuje wants to merge 2 commits into
Open
[BUGFIX]: fix prometheus queryParam interpolation does not work for customAllValue#181zhuje wants to merge 2 commits into
zhuje wants to merge 2 commits into
Conversation
b2c45a2 to
f796b55
Compare
Signed-off-by: Jenny Zhu <jenny.a.zhu@gmail.com>
e742677 to
9d0d90f
Compare
jgbernalp
reviewed
Jun 25, 2026
| const allOptionValues = options.map((o) => o.value); | ||
|
|
||
| const isArray = Array.isArray(varState.value); | ||
| const isCustomAllValue = |
Contributor
There was a problem hiding this comment.
We need to identify better the customAllValue, perhaps from the variable definition propagating it in the variable provider to here, if a current selected option has no matching item in the options can be falsely identified as being the customAllValue.
jgbernalp
reviewed
Jun 25, 2026
| try { | ||
| const regex = new RegExp(`^${varState.value}$`); | ||
| const matched = options.filter((o) => regex.test(o.value)).map((o) => o.value); | ||
| expandValues = matched.length > 0 ? matched : allOptionValues; |
Contributor
There was a problem hiding this comment.
we are missing a test for the case the current all values regex matches no options, this is falling back to all options by design but is not tested.
jgbernalp
reviewed
Jun 25, 2026
| expandValues = varState.value as string[]; | ||
| } else if (isCustomAllValue) { | ||
| try { | ||
| const regex = new RegExp(`^${varState.value}$`); |
Contributor
There was a problem hiding this comment.
There is an utility with better error handling. createRegexFromString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR to address perses/perses#4155
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
No UI Changes -- only backend.
See e2e docs for more details. Common issues include: