@ThreadSafe public interface Sampler
Span
sampling.Modifier and Type | Interface and Description |
---|---|
static class |
Sampler.Decision
A decision on whether a span should be recorded, recorded and sampled or not recorded.
|
static interface |
Sampler.SamplingResult
Sampling result returned by
Sampler#shouldSample(SpanContext, TraceId, String, Kind,
ReadableAttributes, List) . |
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Returns the description of this
Sampler . |
Sampler.SamplingResult |
shouldSample(io.opentelemetry.trace.SpanContext parentContext,
io.opentelemetry.trace.TraceId traceId,
String name,
io.opentelemetry.trace.Span.Kind spanKind,
io.opentelemetry.common.ReadableAttributes attributes,
List<io.opentelemetry.trace.Link> parentLinks)
Called during
Span creation to make a sampling samplingResult. |
Sampler.SamplingResult shouldSample(@Nullable io.opentelemetry.trace.SpanContext parentContext, io.opentelemetry.trace.TraceId traceId, String name, io.opentelemetry.trace.Span.Kind spanKind, io.opentelemetry.common.ReadableAttributes attributes, List<io.opentelemetry.trace.Link> parentLinks)
Span
creation to make a sampling samplingResult.parentContext
- the parent span's SpanContext
. null
if this is a root
span.traceId
- the TraceId
for the new Span
. This will be identical to that in
the parentContext, unless this is a root span.name
- the name of the new Span
.spanKind
- the Span.Kind
of the Span
.attributes
- list of AttributeValue
with their keys.parentLinks
- the parentLinks associated with the new Span
.String getDescription()
Sampler
. This may be displayed on debug pages or in the
logs.
Example: "ProbabilitySampler{0.000100}"
Sampler
.