Skip to content

Support max trace size issue in the query service#8098

Merged
yurishkuro merged 24 commits into
jaegertracing:mainfrom
yurishkuro:max-trace-size-issue-7495
Feb 26, 2026
Merged

Support max trace size issue in the query service#8098
yurishkuro merged 24 commits into
jaegertracing:mainfrom
yurishkuro:max-trace-size-issue-7495

Conversation

@yurishkuro
Copy link
Copy Markdown
Member

@yurishkuro yurishkuro commented Feb 26, 2026

Which problem is this PR solving?

Description of the changes

  • Added max_trace_size configuration parameter to limit spans per trace
  • Implemented span limiting logic in the v2 query service that stops processing once the limit is reached
  • Added warning message to truncated traces
  • And backward compatibility for unlimited traces when parameter is not set (default: 0)

How was this change tested?

  • unit tests, triple-AI reviews

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

parshipcy and others added 16 commits December 31, 2025 19:25
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
2. remove same code at aggregator.go
3. remove skipCurrentTrace and do an early exit from mergeTraces if the current count is already at max
4. remove redundant checks at aggregator.go

Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
2. use range with .All() in copySpansUpToLimit
3. argument order to (dest, src, ...)

Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
…f copySpansUpToLimit,

fix early return

Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Copilot AI review requested due to automatic review settings February 26, 2026 17:15
@yurishkuro yurishkuro requested a review from a team as a code owner February 26, 2026 17:15
@yurishkuro yurishkuro requested review from Copilot and removed request for Copilot February 26, 2026 17:15
@yurishkuro yurishkuro changed the title Max trace size issue 7495 Support max trace size issue in the query service Feb 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 implements a configurable limit on the number of spans per trace to prevent memory issues when retrieving large traces. When a trace exceeds the configured max_trace_size, it is truncated to the specified limit and a warning is added to indicate the truncation.

Changes:

  • Added max_trace_size configuration parameter with default value of 0 (unlimited)
  • Implemented span limiting logic in trace aggregation that truncates traces exceeding the limit
  • Added warning messages to truncated traces indicating the limit was reached

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
jaeger-ui Updated subproject commit reference
internal/jptrace/aggregator.go Implemented core span limiting logic with AggregateTracesWithLimit, mergeTracesWithLimit, copySpansUpToLimit, and markTraceTruncated functions
internal/jptrace/aggregator_test.go Added comprehensive tests for span limiting functionality
cmd/jaeger/internal/extension/jaegerquery/server.go Passed MaxTraceSize configuration to query service options
cmd/jaeger/internal/extension/jaegerquery/querysvc/service.go Updated service to use AggregateTracesWithLimit with configured max size
cmd/jaeger/internal/extension/jaegerquery/querysvc/service_test.go Added integration tests for max trace size scenarios
cmd/jaeger/internal/extension/jaegerquery/internal/flags.go Added MaxTraceSize configuration field

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

Comment thread internal/jptrace/aggregator.go Outdated
Comment thread cmd/jaeger/internal/extension/jaegerquery/internal/flags.go Outdated
Comment thread cmd/jaeger/internal/extension/jaegerquery/querysvc/service.go Outdated
yurishkuro and others added 2 commits February 26, 2026 13:16
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 26, 2026 17:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.


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

Comment thread internal/jptrace/aggregator.go
Comment thread internal/jptrace/aggregator.go Outdated
Comment thread internal/jptrace/aggregator_test.go
Comment thread cmd/jaeger/internal/extension/jaegerquery/querysvc/service.go Outdated
Comment thread cmd/jaeger/internal/extension/jaegerquery/internal/flags.go Outdated
Comment thread internal/jptrace/aggregator_test.go
Comment thread internal/jptrace/aggregator.go Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.67%. Comparing base (2847be9) to head (5ae8362).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/jptrace/aggregator.go 93.93% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8098   +/-   ##
=======================================
  Coverage   95.66%   95.67%           
=======================================
  Files         317      317           
  Lines       16668    16732   +64     
=======================================
+ Hits        15946    16008   +62     
- Misses        570      571    +1     
- Partials      152      153    +1     
Flag Coverage Δ
badger_v1 9.07% <20.00%> (+0.06%) ⬆️
badger_v2 1.04% <20.00%> (+0.11%) ⬆️
cassandra-4.x-v1-manual 13.27% <18.57%> (+0.03%) ⬆️
cassandra-4.x-v2-auto 1.03% <18.57%> (+0.11%) ⬆️
cassandra-4.x-v2-manual 1.03% <18.57%> (+0.11%) ⬆️
cassandra-5.x-v1-manual 13.27% <18.57%> (+0.03%) ⬆️
cassandra-5.x-v2-auto 1.03% <18.57%> (+0.11%) ⬆️
cassandra-5.x-v2-manual 1.03% <18.57%> (+0.11%) ⬆️
clickhouse 1.16% <28.57%> (+0.15%) ⬆️
elasticsearch-6.x-v1 16.62% <20.00%> (+0.01%) ⬆️
elasticsearch-7.x-v1 16.66% <20.00%> (+0.01%) ⬆️
elasticsearch-8.x-v1 16.81% <20.00%> (+0.01%) ⬆️
elasticsearch-8.x-v2 1.04% <20.00%> (+0.11%) ⬆️
elasticsearch-9.x-v2 1.04% <20.00%> (+0.11%) ⬆️
grpc_v1 7.80% <20.00%> (+0.07%) ⬆️
grpc_v2 1.04% <20.00%> (+0.11%) ⬆️
kafka-3.x-v2 1.04% <20.00%> (+0.11%) ⬆️
memory_v2 1.04% <20.00%> (+0.11%) ⬆️
opensearch-1.x-v1 16.70% <20.00%> (+0.01%) ⬆️
opensearch-2.x-v1 16.70% <20.00%> (+0.01%) ⬆️
opensearch-2.x-v2 1.04% <20.00%> (+0.11%) ⬆️
opensearch-3.x-v2 1.04% <20.00%> (+0.11%) ⬆️
query 1.04% <20.00%> (+0.11%) ⬆️
tailsampling-processor 0.52% <0.00%> (-0.01%) ⬇️
unittests 94.35% <94.44%> (+<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.

Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Copilot AI review requested due to automatic review settings February 26, 2026 17:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


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

Comment thread internal/jptrace/spaniter.go
Comment thread cmd/jaeger/internal/extension/jaegerquery/internal/flags.go Outdated
Comment thread cmd/jaeger/internal/extension/jaegerquery/querysvc/service.go Outdated
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Comment thread internal/jptrace/aggregator.go
Signed-off-by: Yuri Shkuro <github@ysh.us>
Copilot AI review requested due to automatic review settings February 26, 2026 18:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


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

@yurishkuro yurishkuro merged commit 97c6d10 into jaegertracing:main Feb 26, 2026
71 checks passed
@yurishkuro yurishkuro deleted the max-trace-size-issue-7495 branch February 26, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Implement max trace size parameter in the query service

4 participants