Interface Sampler
-
- All Known Implementing Classes:
ConstantSampler
,ProbabilitySampler
public interface Sampler
A sampler is responsible for determining whether aTransaction
should be sampled.In contrast other tracing systems, in Elastic APM, non-sampled
Transaction
s do get reported to the APM server. However, to keep the size at a minimum, the reportedTransaction
only contains the transaction name, the duration and the id. Also,Span
s of non sampledTransaction
s are not reported.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
getSampleRate()
java.lang.String
getTraceStateHeader()
boolean
isSampled(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
tracestate
header is not related to sampler itself, putting this here allows to reuse the sameString
instance as long as the sample rate does not change to minimize allocation
-
-