Skip to content

Conversation

cleptric
Copy link
Member

@cleptric cleptric commented Nov 5, 2024

No description provided.

Copy link

vercel bot commented Nov 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
changelog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2024 3:29pm
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2024 3:29pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
sentry-docs ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2024 3:29pm

The `parentSampleRate` is a propagated value inside the baggage, using key `sentry-sample_rand`.
The value stems from a truly random number between 0 and 1, generated when a new trace is started. If the SDK does not receive such a number in an incoming trace, a new, truly random number between 0 and 1 is generated.

In the following cases, the SDK must compare sample rates against this `parentSampleRate` instead of `math.random()`:
Copy link
Member

Choose a reason for hiding this comment

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

This should be:

Suggested change
In the following cases, the SDK must compare sample rates against this `parentSampleRate` instead of `math.random()`:
In the following cases, the SDK must compare sample rates against this `sentry-sample_rand` instead of `math.random()`:

Should we rephrase this, that the SDK always compares with the sample_rand value, especially the two places? In reality, the SDK should never create a new random number during sampling, only ever when initializing a trace that doesn't have the random value attached yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I'll re-phrase the entire paragraph, as I'm not happy with the current state.

```

The `parentSampleRate` is a propagated value inside the baggage, using key `sentry-sample_rand`.
The value stems from a truly random number between 0 and 1, generated when a new trace is started. If the SDK does not receive such a number in an incoming trace, a new, truly random number between 0 and 1 is generated.
Copy link
Member

Choose a reason for hiding this comment

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

nit: Should we clarify that the value must be placed in baggage and propagated from now on?

Copy link
Member Author

@cleptric cleptric Nov 8, 2024

Choose a reason for hiding this comment

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

See above, "The parentSampleRate is a propagated value inside the baggage, using key sentry-sample_rand."


## Parent Sampling Origins

If the SDK can parse an org ID from the configured DSN, this value must be propagated as a baggage entry with the key `sentry-org`. Given a DSN of `https://1234@o1.ingest.us.sentry.io/1`, the org ID is 1, based on `o1`.
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't cover self-hosted, most organizations there will have org ID 1. If we're OK with this restriction, I think we should write this down. If we're not OK with this restriction, we'd need to add an additional identifier from the instance, though I currently don't have a good idea where to get this from.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add this limitation for self-hosted and refer to using the org option in such cases.

cleptric and others added 2 commits November 8, 2024 13:45
Co-authored-by: Jan Michael Auer <mail@jauer.org>
Co-authored-by: Jan Michael Auer <mail@jauer.org>
- The APIs are optimized for trace completeness
- The APIs are optimized for conclusive sampling decisions

## Sample root spans with `tracesSampleRate` & `tracesSampler`
Copy link
Contributor

Choose a reason for hiding this comment

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

Before this gets merged, I would love it if this section contained one or two paragraphs on the goals of the API & behavior. As it stands, this reads very much like a "do this" with no context whatsoever but I assume this is due to it being WIP.

@cleptric
Copy link
Member Author

This PR was split into #11912, #11939, #11940, #11941 and #11943.

@cleptric cleptric closed this Nov 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants