fix(spans): Extract client sample rate from DSC for span v2 - #6299
Draft
mjq wants to merge 2 commits into
Draft
Conversation
Dav1dde
reviewed
Aug 11, 2026
| fn inject_server_sample_rate( | ||
| /// Injects the client sample rate attribute into a span. Priority order: | ||
| /// attribute, DSC, 1.0 (default). | ||
| fn inject_client_sample_rate(attributes: &mut Annotated<Attributes>, dsc_sample_rate: Option<f64>) { |
Member
There was a problem hiding this comment.
We have a normalization step to normalize the client sample rate, this runs after that normalization, basically bypassing it. I guess a better place would be to just extend the sample rate normalization to create it from the DSC if it doesn't already exist?
Member
Author
There was a problem hiding this comment.
Gotcha. Makes sense, I'll move it.
Member
Author
There was a problem hiding this comment.
@Dav1dde Two wrinkles that come from moving it:
- It ends up happening on every Relay and not just processing Relays. That means the first Relay in the chain will extract from DSC, and after that it'll be indistinguishable from a client setting it - we lose control of applying the logic (outdated customer relays will keep applying the old logic, unlike if we only did this during processing).
- This happens before trimming:
a. We're using up space budget/potentially causing more trimming of user data
b. Scarier, this attribute itself is subject to trimming
None of that applies to its current spot. Any thoughts/concerns about these?
mjq
force-pushed
the
mjq/client-sample-rate-streaming
branch
from
August 11, 2026 18:18
d9b193d to
cfc12a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently span v2 (span streaming) spans are missing
sentry.client_sample_rateattributes. This value is used by Sentry to set the EAP trace item's client_sample_rate, which is used in EAP's extrapolation. This defaults all streaming spans to a client sample rate of 1.0, meaning extrapolation is frequently incorrect.If the client sample rate is missing from attributes, try to extract it from the DSC. For consistency, default it to 1.0 here if it's missing from both places.
Even though SDKs aren't expected to set
sentry.client_sample_rate, checking for an existing attribute value first means we can e.g. set it during the OTel -> Sentry span conversion (another case we're currently missing).Fixes RELAY-275.