Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Sampling Seed Propagation #4687

Closed
kahest opened this issue Jan 8, 2025 · 2 comments
Closed

Implement Sampling Seed Propagation #4687

kahest opened this issue Jan 8, 2025 · 2 comments
Assignees

Comments

@kahest
Copy link
Member

kahest commented Jan 8, 2025

Description

See https://github.com/getsentry/projects/issues/316

To increase the chance of capturing complete traces when users return a new sample rate tracesSampler in backend services, we propagate the random value used by the SDK for computing the sampling decision instead of creating a new random value in every service. Therefore, across a trace every SDK uses the same random value.

Develop: Spec

See also

Sample implemeantion in PHP getsentry/sentry-php#1793.

@philprime
Copy link
Contributor

I understand that we neeed to add the sample_rate header to the baggage, but do we also need to implement this "[..] the sampling decision (trailing -1 or -0 from the sentry-trace header) are present in the incoming trace [..]`?

We already send a header sampled in the baggage.

@philprime philprime moved this from Todo to In Progress in Mobile & Cross Platform SDK Jan 24, 2025
@philprime
Copy link
Contributor

Update from my side: Looking at the encoding logic in SentryTraceHeader.m, it seems like the value sampled is already appended to the header string here:

- (NSString *)value
{
return _sampled != kSentrySampleDecisionUndecided
? [NSString stringWithFormat:@"%@-%@-%i", _traceId.sentryIdString,
_spanId.sentrySpanIdString, _sampled == kSentrySampleDecisionYes ? 1 : 0]
: [NSString stringWithFormat:@"%@-%@", _traceId.sentryIdString, _spanId.sentrySpanIdString];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants