You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, we already have PropagationAPIs on the Scope ((get|set)PropagationContext). The propagation context also holds a dynamic sampling context. However, we also have/had (#10094) APIs like transaction.getDynamicSamplingContext which in many situations returned different DSC data than propagation context.
This leads to the inconvenience that everywhere where we need to propagate tracing data, we kinda have to check if there's an active txn, if yes, get the DSC from there and only otherwise use the DSC from the propagation context.
Solution Brainstorm
An ideal solution IMO is to always view Scope.getPropagationContext as the source of truth for trace propagation.
Calling getIsolationScope().getPropagationContext always returns the correct distributed tracing data (that is, traceparent data and DSC). Regardless of if there is an active span or not (TwP).
There should be no need to call any additional function or method when propagating tracing information
Ensuring DSC is immutable for transactions should still work, although it’s not enforced at the moment
In this case, the first getPropagationContext call would “freeze” the DSC for the current active transaction/root span
This differs from the DSC spec that postulates that once populated for a trace, the DSC must not be mutated.
We did this on purpose for a experiment and never revisited the logic, hence it’s still active
Talked with Jan: Let’s leave it as is for now, document it well, but once things stabilize with new APIs and the major is out, we should reevaluate if the current data works for our server-side DS logic or if we should re-introduce immutability.
The text was updated successfully, but these errors were encountered:
Lms24
changed the title
Consolidate propagation and dynamic sampling context on Scope
Consolidate propagation and dynamic sampling contexts on Scope
Jan 8, 2024
To add: This is behaviourally breaking in the sense that loose/inactive transactions and root spans won't be able obtain a DSC with mutability guarantees in the same way as active transactions.
…ur of `getDynamicSamplingContextFromSpan` (#10094)
Deprecate `Transaction.getDynamicSamplingContext` and
introduce its direct replacement, a top-level utility function. Note
that this only is an intermediate step we should take to rework how
we generate and handle the DSC creation. More details in #10095
Problem Statement
Right now, we already have
PropagationAPIs
on the Scope ((get|set)PropagationContext
). The propagation context also holds a dynamic sampling context. However, we also have/had (#10094) APIs liketransaction.getDynamicSamplingContext
which in many situations returned different DSC data than propagation context.This leads to the inconvenience that everywhere where we need to propagate tracing data, we kinda have to check if there's an active txn, if yes, get the DSC from there and only otherwise use the DSC from the propagation context.
Solution Brainstorm
An ideal solution IMO is to always view
Scope.getPropagationContext
as the source of truth for trace propagation.getIsolationScope().getPropagationContext
always returns the correct distributed tracing data (that is, traceparent data and DSC). Regardless of if there is an active span or not (TwP).getPropagationContext
call would “freeze” the DSC for the current active transaction/root spanAlso, this is how propagation context should work according to our distributed tracing dev spec.
getPropagationContext
Cases (with immutability)setPropagationContext
Note: Current State of mutability of DSC
getDynamicSamplingContext
getDynamicSamplingContext
will always return a fresh DSC and ignore previously calculated DSC.The text was updated successfully, but these errors were encountered: