public abstract class Sampler extends Object
Zipkin v1 uses before-the-fact sampling. This means that the decision to keep or drop the trace is made before any work is measured, or annotations are added. As such, the input parameter to zipkin v1 samplers is the trace ID (64-bit random number).
The instrumentation sampling decision happens once, at the root of the trace, and is propagated downstream. For this reason, the decision needn't be consistent based on trace ID.
Modifier and Type | Field and Description |
---|---|
static Sampler |
ALWAYS_SAMPLE |
static Sampler |
NEVER_SAMPLE |
Constructor and Description |
---|
Sampler() |
Modifier and Type | Method and Description |
---|---|
static Sampler |
create(float rate)
Returns a sampler, given a rate expressed as a percentage.
|
abstract boolean |
isSampled(long traceId)
Returns true if the trace ID should be measured.
|
public static final Sampler ALWAYS_SAMPLE
public static final Sampler NEVER_SAMPLE
public abstract boolean isSampled(long traceId)
public static Sampler create(float rate)
The sampler returned is good for low volumes of traffic (<100K requests), as it is precise.
If you have high volumes of traffic, consider BoundarySampler
.
rate
- minimum sample rate is 0.01, or 1% of tracesCopyright © 2017. All rights reserved.