-
- All Implemented Interfaces:
-
com.datadog.android.core.sampling.Sampler,com.datadog.android.trace.internal.net.SpanAwareSampler
public final class SessionRebasedSampler implements Sampler<DatadogSpan>, SpanAwareSampler
A Sampler decorator that rebases the trace sample rate against the RUM session sample rate.
When the span carries a LogAttributes.RUM_SESSION_SAMPLE_RATE tag (injected by com.datadog.android.trace.internal.RumContextPropagator), the effective sample rate becomes
traceSampleRate * sessionSampleRate / 100. This ensures that the combined probability of a trace being sampled within a sampled RUM session is correctly represented.Only DeterministicTraceSampler delegates participate in rebasing; this constraint is enforced at the construction sites, which only wrap the default trace sampler (or one set via
setTraceSampleRate). Custom samplers passed viasetTraceSamplerare not wrapped and bypass rebasing entirely.
-
-
Constructor Summary
Constructors Constructor Description SessionRebasedSampler(DeterministicTraceSampler delegate)
-
Method Summary
Modifier and Type Method Description Booleansample(DatadogSpan item)FloatgetSampleRate()FloatgetSampleRate(DatadogSpan span)Returns the effective sample rate for the given span. -
-
Constructor Detail
-
SessionRebasedSampler
SessionRebasedSampler(DeterministicTraceSampler delegate)
- Parameters:
delegate- the underlying DeterministicTraceSampler to wrap.
-
-
Method Detail
-
getSampleRate
Float getSampleRate()
-
getSampleRate
Float getSampleRate(DatadogSpan span)
Returns the effective sample rate for the given span.
- Parameters:
span- the span for which to compute the sample rate.
-
-
-
-