Interface ComposableSampler
public interface ComposableSampler
A sampler that can be composed to make a final sampling decision.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ComposableSamplerReturns aComposableSamplerthat does not sample any span.static ComposableSampleralwaysOn()Returns aComposableSamplerthat samples all spans.static ComposableSamplerannotating(ComposableSampler sampler, io.opentelemetry.api.common.Attributes attributes) Returns aComposableSamplerthat adds the givenAttributesto all sampled spans.Returns a description of the sampler implementation.getSamplingIntent(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) Returns theSamplingIntentto use to make a sampling decision.static ComposableSamplerparentThreshold(ComposableSampler rootSampler) Returns aComposableSamplerthat respects the sampling decision of the parent span or falls back to the given sampler if it is a root span.static ComposableSamplerprobability(double ratio) Returns aComposableSamplerthat samples each span with a fixed ratio.Returns aComposableRuleBasedSamplerBuilderto create a composable rule-based sampler.
-
Method Details
-
alwaysOff
Returns aComposableSamplerthat does not sample any span. -
alwaysOn
Returns aComposableSamplerthat samples all spans. -
probability
Returns aComposableSamplerthat samples each span with a fixed ratio. -
parentThreshold
Returns aComposableSamplerthat respects the sampling decision of the parent span or falls back to the given sampler if it is a root span. -
ruleBasedBuilder
Returns aComposableRuleBasedSamplerBuilderto create a composable rule-based sampler. Rules will be tested in order, and the first to match will have itsComposableSamplerused for a sampling decision. If no rule matches, the span will be dropped. -
annotating
static ComposableSampler annotating(ComposableSampler sampler, io.opentelemetry.api.common.Attributes attributes) Returns aComposableSamplerthat adds the givenAttributesto all sampled spans. -
getSamplingIntent
SamplingIntent getSamplingIntent(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) Returns theSamplingIntentto use to make a sampling decision. -
getDescription
String getDescription()Returns a description of the sampler implementation.
-