@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 dropped.
|
static interface |
Sampler.SamplingResult
Sampling result returned by
Sampler#shouldSample(SpanContext, String, 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,
String traceId,
String name,
io.opentelemetry.trace.Span.Kind spanKind,
io.opentelemetry.common.ReadableAttributes attributes,
List<SpanData.Link> parentLinks)
Called during
Span creation to make a sampling samplingResult. |
Sampler.SamplingResult shouldSample(io.opentelemetry.trace.SpanContext parentContext, String traceId, String name, io.opentelemetry.trace.Span.Kind spanKind, io.opentelemetry.common.ReadableAttributes attributes, List<SpanData.Link> parentLinks)
Span creation to make a sampling samplingResult.parentContext - the parent span's SpanContext. This can be SpanContext.INVALID 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 - ReadableAttributes associated with the span.parentLinks - the parentLinks associated with the new Span.String getDescription()
Sampler. This may be displayed on debug pages or in the
logs.
Example: "TraceIdRatioBased{0.000100}"
Sampler.