Skip to content

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Jan 9, 2025

We are changing the behavior for tracesSampler so that it is no longer passed every span, but only root spans. We do this to ensure and steer users towards making consistent and deterministic sampling decisions for traces.

This is needed as a first step for #14932

@lforst lforst changed the title feat(opentelemetry): Only pass root spans through sampling pipeline feat(opentelemetry)!: Only pass root spans through sampling pipeline Jan 9, 2025
@lforst lforst changed the title feat(opentelemetry)!: Only pass root spans through sampling pipeline feat(opentelemetry)!: Exclusively pass root spans through sampling pipeline Jan 9, 2025
Comment on lines +127 to 134
if (
!sampled &&
// We check for `parentSampled === undefined` because we only want to record client reports for spans that are trace roots (ie. when there was incoming trace)
parentSampled === undefined
) {
DEBUG_BUILD && logger.log('[Tracing] Discarding root span because its trace was not chosen to be sampled.');
this._client.recordDroppedEvent('sample_rate', 'transaction');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mydea would you mind checking, is this still correct?

@lforst lforst marked this pull request as ready for review January 9, 2025 12:25
@lforst lforst requested a review from mydea January 9, 2025 12:25
Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

LGTM!

@lforst lforst merged commit 6a6e05b into develop Jan 10, 2025
157 checks passed
@lforst lforst deleted the lforst-call-traces-sampler-for-all-root-spans branch January 10, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants