-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[v9] Rethink spanId
on propagationContext
#12385
Comments
More concretely, I propose the following changes:
interface LocalPropagationContext {
traceId: string;
virtualSpanId: string;
}
interface ContinuedPropagationContext {
traceId: string;
sampled?: boolean;
parentSpanId: string;
dsc?: Partial<DynamicSamplingContext>
}
interface Scope {
// undefined: this is probably not an isolation scope. should never be undefined on an isolation scope
// LocalPropagationContext: TWP mode (else this is ignored anyhow), default
// ContinuedPropagationContext: Incoming trace is continued
propagationContext: undefined | LocalPropagationContext | ContinuedPropagationContext;
} This way, you can always differentiate what state you are in, if you are using a "local/virtual" propatation context (by checking if |
As a first step for #12385, I looked though our current implementations, and tried to streamline this. We have a bunch of somewhat duplicate code there that handles sentry-trace & baggage headers _mostly_ the same but not _fully_ the same, as well as relatedly the DSC. To streamline this, I added some new methods in core: * `getTraceData` already exists, but was extended to also allow to pass a specific `span` to it. I updated some code to use this method that hasn't used it before, and also added some more tests - also around the ACS and the otel-specific implementation for this. * For this and edge cases, there are new primitives `getDynamicSamplingContextFromScope` and `getTraceContextFromScope` which handle picking these things from given scope etc. While working on this, I also noticed that `captureCheckIn` in ServerRuntimeClient was actually not properly working in Node (OTEL), as it relied on the core way of scope-span coupling. So I also updated this to actually work as expected.
Our current view on this topic is that span ID on the prop context can be safely removed. Architecturally we need to ensure that performance and the prop context are completely decoupled. Performance data may feed into the prop context but not the other way around. The prop context was designed for tracing without performance. As part of this task we need to go through the entire SDK and make sure that the any performance tracking mechanisms don't read from the propagation context. |
Closes #12385 This also deprecates `getPropagationContextFromSpan` as it is no longer used/needed. We may think about removing this in v9, but IMHO we can also just leave this for v9, it does not hurt too much to have it in there...
Closes #12385 This also deprecates `getPropagationContextFromSpan` as it is no longer used/needed. We may think about removing this in v9, but IMHO we can also just leave this for v9, it does not hurt too much to have it in there...
Closes #12385 This also deprecates `getPropagationContextFromSpan` as it is no longer used/needed. We may think about removing this in v9, but IMHO we can also just leave this for v9, it does not hurt too much to have it in there...
Closes #12385 This also deprecates `getPropagationContextFromSpan` as it is no longer used/needed. We may think about removing this in v9, but IMHO we can also just leave this for v9, it does not hurt too much to have it in there...
Today, we have a propagation context on every span that receives a random
traceId
andspanId
(unless it is continued from an external service). We use these IDs to populate trace headers for further propagation.A scope always has a propagation context, and you can't really tell if this is a "random" one or one that is continued from somewhere...
We should maybe reconsider this, as today this leads to a bunch of confusion, and may lead to cases where we send a parent_span_id that does not exist (because it comes from the propagationContext, not an actual span).
The text was updated successfully, but these errors were encountered: