Interface Sampler
-
- All Known Implementing Classes:
ConstantSampler,ProbabilitySampler
public interface SamplerA sampler is responsible for determining whether aTransactionshould be sampled.In contrast other tracing systems, in Elastic APM, non-sampled
Transactions do get reported to the APM server. However, to keep the size at a minimum, the reportedTransactiononly contains the transaction name, the duration and the id. Also,Spans of non sampledTransactions are not reported.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description doublegetSampleRate()java.lang.StringgetTraceStateHeader()booleanisSampled(Id traceId)Determines whether the given transaction should be sampled.
-
-
-
Method Detail
-
isSampled
boolean isSampled(Id traceId)
Determines whether the given transaction should be sampled.- Parameters:
traceId- The id of the transaction.- Returns:
- The sampling decision.
-
getSampleRate
double getSampleRate()
- Returns:
- current sample rate
-
getTraceStateHeader
java.lang.String getTraceStateHeader()
- 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
-
-