-
-
Notifications
You must be signed in to change notification settings - Fork 230
perf: Avoid shallow copies of DSC when sample_rate or replay_id are overwritten #4381
Copy link
Copy link
Closed
Labels
Description
Description
So far, the Dynamic Sampling Context (DSC) was immutable after the first propagation.
But in the meantime, immutability only partially applies, after
- feat: Associate replays with errors and traces on Android #4133
- fix: overwrite DSC
sample_ratewhen sampling #4374
For both cases, we allocate a shallow copy of the DynamicSamplingContext instance, and the underlying IReadOnlyDictionary.
Since DynamicSamplingContext is an internal class, we can optimize the implementation details to avoid copy allocations, and instead mutate the internal Dictionary that we create in the .ctor.
Alternatively, we could rewrite or derive a DynamicSamplingContext, and/or introduce something similar like a DynamicSamplingContextBuilder. But since the DynamicSamplingContext is internal this may not be required.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done