Package io.opentelemetry.contrib.sampler
Class RuleBasedRoutingSampler
java.lang.Object
io.opentelemetry.contrib.sampler.RuleBasedRoutingSampler
- All Implemented Interfaces:
io.opentelemetry.sdk.trace.samplers.Sampler
public final class RuleBasedRoutingSampler
extends Object
implements io.opentelemetry.sdk.trace.samplers.Sampler
This sampler accepts a list of
SamplingRules and tries to match every proposed span
against those rules. Every rule describes a span's attribute, a pattern against which to match
attribute's value, and a sampler that will make a decision about given span if match was
successful.
Matching is performed by Pattern.
Provided span kind is checked first and if differs from the one given to builder(SpanKind, Sampler), the default fallback sampler will make a decision.
Note that only attributes that were set on SpanBuilder will
be taken into account, attributes set after the span has been started are not used
If none of the rules matched, the default fallback sampler will make a decision.
-
Method Summary
Modifier and TypeMethodDescriptionbuilder(io.opentelemetry.api.trace.SpanKind kind, io.opentelemetry.sdk.trace.samplers.Sampler fallback) io.opentelemetry.sdk.trace.samplers.SamplingResultshouldSample(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks) toString()
-
Method Details
-
builder
public static RuleBasedRoutingSamplerBuilder builder(io.opentelemetry.api.trace.SpanKind kind, io.opentelemetry.sdk.trace.samplers.Sampler fallback) -
shouldSample
public io.opentelemetry.sdk.trace.samplers.SamplingResult shouldSample(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks) - Specified by:
shouldSamplein interfaceio.opentelemetry.sdk.trace.samplers.Sampler
-
getDescription
- Specified by:
getDescriptionin interfaceio.opentelemetry.sdk.trace.samplers.Sampler
-
toString
-