Skip to content

[es] Rename NumTraces to SearchDepth in ES v2 dbmodel#8611

Merged
mahadzaryab1 merged 2 commits into
jaegertracing:mainfrom
aezyus:internal/storage-v2-rename-numtraces
May 24, 2026
Merged

[es] Rename NumTraces to SearchDepth in ES v2 dbmodel#8611
mahadzaryab1 merged 2 commits into
jaegertracing:mainfrom
aezyus:internal/storage-v2-rename-numtraces

Conversation

@aezyus

@aezyus aezyus commented May 22, 2026

Copy link
Copy Markdown
Contributor

Renames NumTraces int to SearchDepth int inside TraceQueryParameters to align the ES internal dbmodel with the core v2 TraceQueryParameters API definition.

This addresses a technical debt item marked with a TODO and fixes all associated references across core packages, readers, and unit tests.

Which problem is this PR solving?

Description of the changes

  • Renamed NumTraces -> SearchDepth fields inside the Elasticsearch internal TraceQueryParameters struct (internal/storage/v2/elasticsearch/tracestore/core/dbmodel/model.go).
  • Updated the defaultNumTraces constant to defaultSearchDepth and updated fallback assignment layers inside internal/storage/v2/elasticsearch/tracestore/core/reader.go.
  • Fixed structural field assignment logic within internal/storage/v2/elasticsearch/tracestore/reader.go.
  • Refactored all corresponding broken field references inside the associated _test.go suites.

How was this change tested?

  • Validated build consistency locally.
  • Executed unit regression tests via make test.

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

Renames NumTraces int to SearchDepth int inside TraceQueryParameters
to align the ES internal dbmodel with the core v2 TraceQueryParameters
API definition.

This addresses a technical debt item marked with a TODO and fixes all
associated references across core packages, readers, and unit tests.

Signed-off-by: ayu. <aezyus1@gmail.com>
@aezyus aezyus requested a review from a team as a code owner May 22, 2026 06:19
Copilot AI review requested due to automatic review settings May 22, 2026 06:19

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR aligns the Elasticsearch trace reader query parameter naming by replacing NumTraces with SearchDepth across the DB model, reader logic, and related tests.

Changes:

  • Renamed dbmodel.TraceQueryParameters.NumTraces to SearchDepth.
  • Updated trace query mapping and defaulting logic to use SearchDepth.
  • Adjusted unit tests to construct queries using SearchDepth.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/storage/v2/elasticsearch/tracestore/reader_test.go Updates test query params to use SearchDepth instead of NumTraces.
internal/storage/v2/elasticsearch/tracestore/reader.go Maps TraceQueryParams.SearchDepth into DB query params via the new SearchDepth field.
internal/storage/v2/elasticsearch/tracestore/core/reader_test.go Updates core reader tests to set SearchDepth in query parameters.
internal/storage/v2/elasticsearch/tracestore/core/reader.go Renames default constant and applies defaulting + aggregation sizing based on SearchDepth.
internal/storage/v2/elasticsearch/tracestore/core/dbmodel/model.go Renames the field in TraceQueryParameters to SearchDepth.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/storage/v2/elasticsearch/tracestore/core/dbmodel/model.go
@mahadzaryab1 mahadzaryab1 added the changelog:refactoring Internal code refactoring without functional changes label May 24, 2026
@mahadzaryab1 mahadzaryab1 changed the title internal/storage: rename NumTraces to SearchDepth in ES v2 dbmodel [es] Rename NumTraces to SearchDepth in ES v2 dbmodel May 24, 2026
@mahadzaryab1 mahadzaryab1 enabled auto-merge May 24, 2026 04:04
@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.57%. Comparing base (393f160) to head (3eb6c55).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8611      +/-   ##
==========================================
+ Coverage   96.56%   96.57%   +0.01%     
==========================================
  Files         331      331              
  Lines       17566    17566              
==========================================
+ Hits        16963    16965       +2     
+ Misses        454      453       -1     
+ Partials      149      148       -1     
Flag Coverage Δ
badger_direct 8.94% <0.00%> (ø)
badger_e2e 1.04% <0.00%> (ø)
cassandra-4.x-direct-manual 14.55% <0.00%> (ø)
cassandra-4.x-e2e-auto 1.03% <0.00%> (ø)
cassandra-4.x-e2e-manual 1.03% <0.00%> (ø)
cassandra-5.x-direct-manual 14.55% <0.00%> (ø)
cassandra-5.x-e2e-auto 1.03% <0.00%> (ø)
cassandra-5.x-e2e-manual 1.03% <0.00%> (ø)
clickhouse-direct 8.97% <0.00%> (ø)
clickhouse-e2e 1.16% <0.00%> (ø)
elasticsearch-6.x-direct 16.87% <50.00%> (ø)
elasticsearch-7.x-direct 16.91% <50.00%> (ø)
elasticsearch-8.x-direct 17.05% <50.00%> (ø)
elasticsearch-8.x-e2e 1.04% <0.00%> (ø)
elasticsearch-9.x-e2e 1.04% <0.00%> (ø)
grpc_direct 7.90% <0.00%> (ø)
grpc_e2e 1.04% <0.00%> (ø)
kafka-3.x-v2 1.04% <0.00%> (ø)
memory_v2 1.04% <0.00%> (ø)
opensearch-1.x-direct 16.95% <50.00%> (ø)
opensearch-2.x-direct 16.95% <50.00%> (ø)
opensearch-2.x-e2e 1.04% <0.00%> (ø)
opensearch-3.x-e2e 1.04% <0.00%> (ø)
query 1.04% <0.00%> (ø)
tailsampling-processor 0.55% <0.00%> (ø)
unittests 94.88% <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 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.

@mahadzaryab1 mahadzaryab1 added this pull request to the merge queue May 24, 2026
Merged via the queue into jaegertracing:main with commit 909a3a5 May 24, 2026
72 of 73 checks passed
vic-comm pushed a commit to vic-comm/jaeger that referenced this pull request Jun 11, 2026
…ing#8611)

Renames NumTraces int to SearchDepth int inside TraceQueryParameters to
align the ES internal dbmodel with the core v2 TraceQueryParameters API
definition.

This addresses a technical debt item marked with a TODO and fixes all
associated references across core packages, readers, and unit tests.

## Which problem is this PR solving?
- Resolves jaegertracing#8601

## Description of the changes
- Renamed `NumTraces` -> `SearchDepth` fields inside the Elasticsearch
internal `TraceQueryParameters` struct
(`internal/storage/v2/elasticsearch/tracestore/core/dbmodel/model.go`).
- Updated the `defaultNumTraces` constant to `defaultSearchDepth` and
updated fallback assignment layers inside
`internal/storage/v2/elasticsearch/tracestore/core/reader.go`.
- Fixed structural field assignment logic within
`internal/storage/v2/elasticsearch/tracestore/reader.go`.
- Refactored all corresponding broken field references inside the
associated `_test.go` suites.

## How was this change tested?
- Validated build consistency locally.
- Executed unit regression tests via `make test`.

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/main/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully: `make lint test`

## AI Usage in this PR (choose one)
See [AI Usage
Policy](https://github.com/jaegertracing/jaeger/blob/main/CONTRIBUTING_GUIDELINES.md#ai-usage-policy).
- [ ] **None**: No AI tools were used in creating this PR
- [x] **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

Signed-off-by: ayu. <aezyus1@gmail.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

area/storage changelog:refactoring Internal code refactoring without functional changes storage/elasticsearch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore]: Rename NumTraces to SearchDepth in TraceQueryParameters

3 participants