-
- All Implemented Interfaces:
-
com.datadog.trace.common.sampling.PrioritySampler,com.datadog.trace.common.sampling.Sampler,com.datadog.trace.common.writer.RemoteResponseListener
public class RateByServiceTraceSampler implements Sampler, PrioritySampler, RemoteResponseListener
A rate sampler which maintains different sample rates per service+env name.
The configuration of (serviceName,env)->rate is configured by the core agent.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringSAMPLING_AGENT_RATE
-
Constructor Summary
Constructors Constructor Description RateByServiceTraceSampler()RateByServiceTraceSampler(Double defaultSampleRate)
-
Method Summary
Modifier and Type Method Description <T extends CoreSpan<T>> booleansample(T span)Sample a collection of traces based on the parent span <T extends CoreSpan<T>> voidsetSamplingPriority(T span)If span is a root span, set the span context samplingPriority to keep or drop voidonResponse(String endpoint, Map<String, Map<String, Number>> responseJson)Invoked after the api receives a response from the remote service. doublegetSampleRate()-
Methods inherited from class com.datadog.trace.common.sampling.Sampler
sample -
Methods inherited from class com.datadog.trace.common.sampling.PrioritySampler
setSamplingPriority -
Methods inherited from class com.datadog.trace.common.writer.RemoteResponseListener
onResponse -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
RateByServiceTraceSampler
RateByServiceTraceSampler()
-
RateByServiceTraceSampler
RateByServiceTraceSampler(Double defaultSampleRate)
-
-
Method Detail
-
sample
<T extends CoreSpan<T>> boolean sample(T span)
Sample a collection of traces based on the parent span
- Parameters:
span- the parent span with its context
-
setSamplingPriority
<T extends CoreSpan<T>> void setSamplingPriority(T span)
If span is a root span, set the span context samplingPriority to keep or drop
-
onResponse
void onResponse(String endpoint, Map<String, Map<String, Number>> responseJson)
Invoked after the api receives a response from the remote service.
-
getSampleRate
@VisibleForTesting() double getSampleRate()
-
-
-
-