Class ConstantSampler
- java.lang.Object
-
- co.elastic.apm.agent.impl.sampling.ConstantSampler
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetSampleRate()java.lang.StringgetTraceStateHeader()booleanisSampled(Id traceId)Determines whether the given transaction should be sampled.static Samplerof(boolean decision)
-
-
-
Method Detail
-
of
public static Sampler of(boolean decision)
-
isSampled
public boolean isSampled(Id traceId)
Description copied from interface:SamplerDetermines whether the given transaction should be sampled.
-
getSampleRate
public double getSampleRate()
- Specified by:
getSampleRatein interfaceSampler- Returns:
- current sample rate
-
getTraceStateHeader
public java.lang.String getTraceStateHeader()
- Specified by:
getTraceStateHeaderin interfaceSampler- Returns:
- sample rate as (constant) header for context propagation
While the
tracestateheader is not related to sampler itself, putting this here allows to reuse the sameStringinstance as long as the sample rate does not change to minimize allocation
-
-