Skip to content

Fix Prometheus range query encoding - #1744

Open
Hanabi9248 wants to merge 2 commits into
hyperledger-caliper:mainfrom
Hanabi9248:codex/prometheus-range-query-encoding
Open

Hanabi9248 wants to merge 2 commits into
hyperledger-caliper:mainfrom
Hanabi9248:codex/prometheus-range-query-encoding

Conversation

@Hanabi9248

Copy link
Copy Markdown

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 receives sum(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.

  • All 42 helper, query-client, and Prometheus-monitor tests pass.
  • Core ESLint and license checks pass.
  • The full core suite has 356 passing tests and one failure on Windows: 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.

Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
@Hanabi9248
Hanabi9248 requested a review from a team as a code owner September 12, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant