Skip to content

[processor/tailsampling] Add sample_on_root_span_only config#46610

Closed
singhvibhanshu wants to merge 6 commits into
open-telemetry:mainfrom
singhvibhanshu:sample-on-root-span-only
Closed

[processor/tailsampling] Add sample_on_root_span_only config#46610
singhvibhanshu wants to merge 6 commits into
open-telemetry:mainfrom
singhvibhanshu:sample-on-root-span-only

Conversation

@singhvibhanshu
Copy link
Copy Markdown
Member

Description:
Adds a sample_on_root_span_only configuration option to the tail sampling processor.
When enabled, this allows the processor to make a sampling decision immediately upon receiving the root span, bypassing the decision wait time and reducing memory overhead for high-throughput scenarios.

Link to tracking Issue:
Resolves #46600

Testing:
Added a new unit test TestSampleOnRootSpanOnly in processor_test.go to verify that traces are exported immediately without waiting for the decision_wait duration. Verified locally with make gotest.

Testing Result:

tailsamplingprocessor git:(sample-on-root-span-only) ✗ go test -v -run TestSampleOnRootSpanOnly
=== RUN   TestSampleOnRootSpanOnly
--- PASS: TestSampleOnRootSpanOnly (0.01s)
PASS
ok      github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor       0.016s

Documentation:
Added changelog entry.

Signed-off-by: singhvibhanshu <singhvibhanshu@hotmail.com>
@singhvibhanshu singhvibhanshu requested review from a team and jmacd as code owners March 3, 2026 20:12
@github-actions github-actions Bot added the processor/tailsampling Tail sampling processor label Mar 3, 2026
Signed-off-by: singhvibhanshu <singhvibhanshu@hotmail.com>
@singhvibhanshu singhvibhanshu force-pushed the sample-on-root-span-only branch from d28b11f to cb81b03 Compare March 5, 2026 16:09
@singhvibhanshu singhvibhanshu force-pushed the sample-on-root-span-only branch from cb81b03 to 0f6a69d Compare March 5, 2026 17:05
@singhvibhanshu
Copy link
Copy Markdown
Member Author

Thanks for the approval @jmacd!
The CI checks have passed.
Is there anything else needed before merging?

@carsonip
Copy link
Copy Markdown
Contributor

carsonip commented Mar 6, 2026

sorry, should we wait for discussion in #46600 to resolve first?

@singhvibhanshu
Copy link
Copy Markdown
Member Author

singhvibhanshu commented Mar 6, 2026

yeah sure @carsonip! 👍
lmk if any changes are needed in this PR
i am happy to address any feedback on this

@singhvibhanshu
Copy link
Copy Markdown
Member Author

@carsonip, any updates on this?

@carsonip
Copy link
Copy Markdown
Contributor

@singhvibhanshu sorry for the delay, I was on holiday.

The issue #46600 has been resolved via #46762 to allow for more flexibility.

This sample_on_root_span_only config PR shouldn't be needed as this point since it only addresses a subset of problems compared to #46762 with minor differences. Please feel free to close this PR, or open a new issue to describe any problem you have with tail sampling processor. Thanks!

@singhvibhanshu
Copy link
Copy Markdown
Member Author

Hi @carsonip! Hope you had a great holiday.

It makes total sense to go with the broader approach in #46762. I learned a ton about the tail sampling processor's internals while working on this, so it was still a great experience on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

processor/tailsampling Tail sampling processor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[processor/tailsampling] Optimize performance by adjusting policy evaluation timing

4 participants