Repository navigation
fix(query): Reject non-positive lookback, step and ratePer in metrics API - #9863
Open
sublimemonk wants to merge 1 commit into
Open
sublimemonk wants to merge 1 commit into
sublimemonk wants to merge 1 commit into
Conversation
… API Signed-off-by: Sarthak Sharma <sarthaksharma1177@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CI Summary ReportMetrics ComparisonView changed metricsFor label-level diff details, open the CI run and expand the "Compare metrics and generate summary" step logs. metrics_snapshot_kafka_v2 — ⬇️ download diff
Code Coverage✅ Coverage 98.6% (baseline 98.6%) ➡️ View CI run | View publish logs |
This branch has not been deployed
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.
Which problem is this PR solving?
The legacy HTTP metrics endpoints (
/api/metrics/latencies,/calls,/errors) accept a zero or negativelookback,steporratePerand 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
parsePositiveDuration, which wrapsparseDurationand rejects a zero or negative value with the same "must be a positive duration" 400 that fix(query): Reject non-positive lookback values #9832 added for the dependencieslookback.lookback(replacing the inline check from fix(query): Reject non-positive lookback values #9832, same behavior) and for the metricslookback,stepandratePer.How was this change tested?
lookback,stepandratePertoTestParameterErrors; 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, andgo vetis clean.Checklist
make lint testAI Usage in this PR (choose one)
See AI Usage Policy.