Skip to content

fix(apiv3): Rename query.num_traces to query.search_depth, keep deprecated alias#8618

Merged
yurishkuro merged 2 commits into
jaegertracing:mainfrom
yurishkuro:fix/search-depth-param
May 22, 2026
Merged

fix(apiv3): Rename query.num_traces to query.search_depth, keep deprecated alias#8618
yurishkuro merged 2 commits into
jaegertracing:mainfrom
yurishkuro:fix/search-depth-param

Conversation

@yurishkuro

Copy link
Copy Markdown
Member

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 #8617

🤖 Generated with Claude Code

…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>
@yurishkuro yurishkuro requested a review from a team as a code owner May 22, 2026 15:57
Copilot AI review requested due to automatic review settings May 22, 2026 15:57
@dosubot dosubot Bot added the go Pull requests that update go code label May 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_depth as the primary query parameter and keeps query.num_traces as 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.

Comment thread cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/http_gateway.go Outdated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.59%. Comparing base (393f160) to head (0039344).

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     
Flag Coverage Δ
badger_direct 8.94% <ø> (ø)
badger_e2e 1.04% <ø> (ø)
cassandra-4.x-direct-manual 14.55% <ø> (ø)
cassandra-4.x-e2e-auto 1.03% <ø> (ø)
cassandra-4.x-e2e-manual 1.03% <ø> (ø)
cassandra-5.x-direct-manual 14.55% <ø> (ø)
cassandra-5.x-e2e-auto 1.03% <ø> (ø)
cassandra-5.x-e2e-manual 1.03% <ø> (ø)
clickhouse-direct 8.97% <ø> (ø)
clickhouse-e2e 1.16% <ø> (ø)
elasticsearch-6.x-direct 16.87% <ø> (ø)
elasticsearch-7.x-direct 16.91% <ø> (ø)
elasticsearch-8.x-direct 17.05% <ø> (ø)
elasticsearch-8.x-e2e 1.04% <ø> (ø)
elasticsearch-9.x-e2e 1.04% <ø> (ø)
grpc_direct 7.90% <ø> (ø)
grpc_e2e 1.04% <ø> (ø)
kafka-3.x-v2 1.04% <ø> (ø)
memory_v2 1.04% <ø> (ø)
opensearch-1.x-direct 16.95% <ø> (ø)
opensearch-2.x-direct 16.95% <ø> (ø)
opensearch-2.x-e2e 1.04% <ø> (ø)
opensearch-3.x-e2e 1.04% <ø> (ø)
query 1.04% <ø> (ø)
tailsampling-processor 0.55% <ø> (ø)
unittests 94.89% <100.00%> (+0.02%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@yurishkuro yurishkuro merged commit 8237df5 into jaegertracing:main May 22, 2026
74 checks passed
@yurishkuro yurishkuro deleted the fix/search-depth-param branch May 22, 2026 16:16
yurishkuro added a commit that referenced this pull request May 25, 2026
…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>
vic-comm pushed a commit to vic-comm/jaeger that referenced this pull request Jun 11, 2026
…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>
vic-comm pushed a commit to vic-comm/jaeger that referenced this pull request Jun 11, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:bugfix-or-minor-feature go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent naming of search result count parameter across APIs

3 participants