fix(apiv3): Rename query.num_traces to query.search_depth, keep deprecated alias#8618
Conversation
…cated alias The canonical proto field is search_depth; accepting num_traces diverged from what the future gRPC-gateway generated binding will produce. Accept query.search_depth as the primary parameter and keep query.num_traces as a backwards-compatible deprecated alias. Fixes jaegertracing#8617 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Yuri Shkuro <github@ysh.us>
There was a problem hiding this comment.
Pull request overview
This PR updates the API v3 HTTP gateway to use query.search_depth as the canonical query parameter for GET /api/v3/traces, aligning the HTTP surface with the TraceQueryParameters.search_depth proto field and future grpc-gateway bindings, while preserving backward compatibility via a deprecated alias.
Changes:
- Introduces
query.search_depthas the primary query parameter and keepsquery.num_tracesas a deprecated fallback. - Updates query parsing to accept the canonical parameter first, then fall back to the deprecated alias.
- Adds/updates unit tests to cover the deprecated alias path and error reporting for both parameter names.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/http_gateway.go | Adds canonical query.search_depth parameter with deprecated query.num_traces alias handling in trace search parsing. |
| cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/http_gateway_test.go | Updates existing tests to use query.search_depth and adds coverage for the deprecated query.num_traces alias and error cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Yuri Shkuro <github@ysh.us>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8618 +/- ##
==========================================
+ Coverage 96.56% 96.59% +0.02%
==========================================
Files 331 331
Lines 17566 17571 +5
==========================================
+ Hits 16963 16972 +9
+ Misses 454 451 -3
+ Partials 149 148 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…Depth in trace-summaries endpoint (#8633) ## Summary Three fixes to the `GET /api/v3/trace-summaries` endpoint introduced in #8604: - **`traceId` field name casing**: the response was returning `traceID` (uppercase D) but the OpenAPI spec and the generated Zod client expect `traceId` (lowercase d, matching proto3 JSON naming). The UI worked around this defensively; this fixes the backend. - **`SearchDepth` default**: `parseFindTracesQuery` was not applying a default when `query.search_depth` is absent, causing the memory backend to return a 500 on every unauthenticated request. Now defaults to 100, matching the v1 HTTP handler. - **Snapshot test**: adds a golden-file test for the full `FindTraceSummaries` JSON response so field name and encoding regressions are caught automatically. ## Changes - `summaries.go`: change JSON tag from `"traceID"` to `"traceId"` - `query_parser.go`: add `defaultSearchDepth = 100`; apply it when `query.search_depth` is absent - `gateway_test.go` + `snapshots/FindTraceSummaries.json`: snapshot test for the HTTP response - `docs/adr/010-trace-summary-api.md`: reflect M1/M2 completion, note that jaeger-idl already has all M3/M4 proto work merged, add PR sequence for remaining work ## Test plan - [x] `go test ./cmd/jaeger/internal/extension/jaegerquery/...` passes - [x] `make lint` passes ## Related - #8604 — main implementation this PR fixes - #8617 — tracking issue for `search_depth` naming / default - #8618 — rename `num_traces` → `search_depth` (cherry-picked) - jaegertracing/jaeger-ui#3941 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Yuri Shkuro <github@ysh.us> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…cated alias (jaegertracing#8618) ## Summary - Adds `query.search_depth` as the canonical parameter name for `GET /api/v3/traces` (matches the proto field `TraceQueryParameters.search_depth` and what the future gRPC-gateway binding will generate) - Keeps `query.num_traces` as a deprecated backwards-compatible alias — existing callers are not broken - Adds a test case covering the deprecated alias path ## Test plan - [ ] `GET /api/v3/traces?query.search_depth=20` works (new canonical name) - [ ] `GET /api/v3/traces?query.num_traces=20` continues to work (deprecated alias) - [ ] Unit tests pass: `go test ./cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/...` - [ ] `make lint` and `make test` pass Fixes jaegertracing#8617 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Yuri Shkuro <github@ysh.us> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Victor Chidera Obiezue <obiezuechidera@gmail.com>
…Depth in trace-summaries endpoint (jaegertracing#8633) ## Summary Three fixes to the `GET /api/v3/trace-summaries` endpoint introduced in jaegertracing#8604: - **`traceId` field name casing**: the response was returning `traceID` (uppercase D) but the OpenAPI spec and the generated Zod client expect `traceId` (lowercase d, matching proto3 JSON naming). The UI worked around this defensively; this fixes the backend. - **`SearchDepth` default**: `parseFindTracesQuery` was not applying a default when `query.search_depth` is absent, causing the memory backend to return a 500 on every unauthenticated request. Now defaults to 100, matching the v1 HTTP handler. - **Snapshot test**: adds a golden-file test for the full `FindTraceSummaries` JSON response so field name and encoding regressions are caught automatically. ## Changes - `summaries.go`: change JSON tag from `"traceID"` to `"traceId"` - `query_parser.go`: add `defaultSearchDepth = 100`; apply it when `query.search_depth` is absent - `gateway_test.go` + `snapshots/FindTraceSummaries.json`: snapshot test for the HTTP response - `docs/adr/010-trace-summary-api.md`: reflect M1/M2 completion, note that jaeger-idl already has all M3/M4 proto work merged, add PR sequence for remaining work ## Test plan - [x] `go test ./cmd/jaeger/internal/extension/jaegerquery/...` passes - [x] `make lint` passes ## Related - jaegertracing#8604 — main implementation this PR fixes - jaegertracing#8617 — tracking issue for `search_depth` naming / default - jaegertracing#8618 — rename `num_traces` → `search_depth` (cherry-picked) - jaegertracing/jaeger-ui#3941 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Yuri Shkuro <github@ysh.us> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Victor Chidera Obiezue <obiezuechidera@gmail.com>
Summary
query.search_depthas the canonical parameter name forGET /api/v3/traces(matches the proto fieldTraceQueryParameters.search_depthand what the future gRPC-gateway binding will generate)query.num_tracesas a deprecated backwards-compatible alias — existing callers are not brokenTest plan
GET /api/v3/traces?query.search_depth=20works (new canonical name)GET /api/v3/traces?query.num_traces=20continues to work (deprecated alias)go test ./cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/...make lintandmake testpassFixes #8617
🤖 Generated with Claude Code