Skip to content

fix(query): Reject non-positive lookback, step and ratePer in metrics API - #9863

Open
sublimemonk wants to merge 1 commit into
jaegertracing:mainfrom
sublimemonk:fix-metrics-non-positive-params
Open

sublimemonk wants to merge 1 commit into
jaegertracing:mainfrom
sublimemonk:fix-metrics-non-positive-params

Conversation

@sublimemonk

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

The legacy HTTP metrics endpoints (/api/metrics/latencies, /calls, /errors) accept a zero or negative lookback, step or ratePer and pass it to the metrics backend, which rejects it (for example Prometheus with a zero or negative step) and the client gets a 500 instead of a 400. This is the follow-up requested in the #9832 review, so the HTTP endpoints stay consistent.

Description of the changes

How was this change tested?

  • Added zero and negative cases for lookback, step and ratePer to TestParameterErrors; each asserts the 400 message. Without the fix, all six fail because the request goes past the parser to the metrics query service.
  • go test ./cmd/jaeger/internal/extension/jaegerquery/internal/ -run "TestParameterErrors|TestParseDuration|TestParseBool|TestGetDependencies" passes, and go vet is clean.

Checklist

AI Usage in this PR (choose one)

See AI Usage Policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

… API

Signed-off-by: Sarthak Sharma <sarthaksharma1177@gmail.com>
@sublimemonk
sublimemonk requested a review from a team as a code owner October 16, 2026 21:48
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (f0cc3c8) to head (21c7d82).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9863   +/-   ##
=======================================
  Coverage   98.64%   98.64%           
=======================================
  Files         413      413           
  Lines       20492    20496    +4     
=======================================
+ Hits        20214    20218    +4     
  Misses        278      278           
Flag Coverage Δ
badger_direct 6.24% <ø> (ø)
badger_e2e 11.07% <0.00%> (-0.01%) ⬇️
cassandra-4.x-direct-manual 10.27% <ø> (ø)
cassandra-4.x-e2e-auto 16.67% <0.00%> (-0.01%) ⬇️
cassandra-4.x-e2e-manual 16.67% <0.00%> (-0.01%) ⬇️
cassandra-5.x-direct-manual 10.27% <ø> (ø)
cassandra-5.x-e2e-auto 16.67% <0.00%> (-0.01%) ⬇️
cassandra-5.x-e2e-manual 16.67% <0.00%> (-0.01%) ⬇️
clickhouse-direct 10.85% <ø> (ø)
clickhouse-e2e 15.56% <0.00%> (-0.01%) ⬇️
elasticsearch-7.x-direct 25.76% <ø> (ø)
elasticsearch-8.x-direct 25.80% <ø> (ø)
elasticsearch-8.x-e2e 23.71% <0.00%> (-0.01%) ⬇️
elasticsearch-9.x-direct 25.80% <ø> (ø)
elasticsearch-9.x-e2e 23.71% <0.00%> (-0.02%) ⬇️
grpc_direct 16.23% <ø> (ø)
grpc_e2e 19.34% <0.00%> (-0.01%) ⬇️
kafka-3.x-v2 27.68% <0.00%> (-0.01%) ⬇️
memory_v2 19.80% <0.00%> (-0.01%) ⬇️
opensearch-1.x-direct 25.76% <ø> (ø)
opensearch-2.x-direct 25.76% <ø> (ø)
opensearch-2.x-e2e 23.71% <0.00%> (-0.01%) ⬇️
opensearch-3.x-direct 25.76% <ø> (ø)
opensearch-3.x-e2e 23.71% <0.00%> (-0.01%) ⬇️
query 17.00% <0.00%> (-0.01%) ⬇️
tailsampling-processor 6.31% <0.00%> (-0.01%) ⬇️
unittests 97.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

CI Summary Report

Metrics Comparison

⚠️ 4 metric change(s) detected (informational)

View changed metrics

For label-level diff details, open the CI run and expand the "Compare metrics and generate summary" step logs.

metrics_snapshot_kafka_v2 — ⬇️ download diff
4 modified

  • otelcol_kafka_exporter_bytes
  • otelcol_kafka_exporter_bytes_uncompressed
  • otelcol_kafka_exporter_messages
  • otelcol_kafka_exporter_records

Code Coverage

✅ Coverage 98.6% (baseline 98.6%)

➡️ View CI run | View publish logs
2026-10-16 22:14:57 UTC

This branch has not been deployed

No deployments
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.

[Bug]: Legacy HTTP metrics endpoints accept non-positive lookback, step and ratePer

1 participant