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

[trace-sdk-sampler] Differentiate between root and child span creation in trace sampling spec #3888

Closed
9 changes: 6 additions & 3 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,12 @@ When asked to create a Span, the SDK MUST act as if doing the following in order
(Note that the [built-in `ParentBasedSampler`](#parentbased) can be used to
use the sampling decision of the parent,
translating a set SampledFlag to RECORD and an unset one to DROP).
3. Generate a new span ID for the `Span`, independently of the sampling decision.
This is done so other components (such as logs or exception handling) can rely on
a unique span ID, even if the `Span` is a non-recording instance.
3. If there isn't currently a span (the span being created will become the root
Copy link
Member

Choose a reason for hiding this comment

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

@Oberon00 to share early comments. (the PR is still draft)

CodeBlanch marked this conversation as resolved.
Show resolved Hide resolved
span), SDKs MUST generate a new span ID for the `Span`, independently of the
sampling decision. This is done so other components (such as logs or
exception handling) can rely on a unique span ID, even if the `Span` is a
non-recording instance. For children, SDKs MAY skip creation of spans if
CodeBlanch marked this conversation as resolved.
Show resolved Hide resolved
`ShouldSample` results in a non-recording instance (`DROP`).
CodeBlanch marked this conversation as resolved.
Show resolved Hide resolved
4. Create a span depending on the decision returned by `ShouldSample`:
see description of [`ShouldSample`'s](#shouldsample) return value below
for how to set `IsRecording` and `Sampled` on the Span,
Expand Down