Fix Prometheus range query encoding - #1744
Open
Hanabi9248 wants to merge 2 commits into
Open
Hanabi9248 wants to merge 2 commits into
Hanabi9248 wants to merge 2 commits into
Conversation
Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
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.
Steps to reproduce
Configure a Prometheus monitor query containing addition, such as
sum(up) + 1. The range-query helper encodes only label selectors inside braces, leaving the+unescaped. After URL parameter decoding, Prometheus receivessum(up) 1.Design of the fix
Encode the complete expression once when building the range query. This preserves operators outside label selectors while keeping quoted characters inside them intact.
Automated tests and validation
The regression checks the decoded expression and the start, end, and step parameters using
sum(up{job="a&b#50%",name=~".+"}) + 1. It fails before the change.CaliperEngine/should stop the benchmark if the benchmark has been started. The unmodified baseline has the same failure (355 passing), caused by its shell command.Tested with Node 24.19.0. Fabric/Docker integration tests were not run. No documentation or public API changes.