Package com.wavefront.agent.sampler
Class SpanSampler
- java.lang.Object
-
- com.wavefront.agent.sampler.SpanSampler
-
public class SpanSampler extends Object
Sampler that takes aSpan
as input and delegates to aSampler
when evaluating the sampling decision.- Author:
- Han Zhang ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static String
SPAN_SAMPLING_POLICY_TAG
-
Constructor Summary
Constructors Constructor Description SpanSampler(com.wavefront.sdk.entities.tracing.sampling.Sampler delegate, Supplier<List<com.wavefront.api.agent.SpanSamplingPolicy>> activeSpanSamplingPoliciesSupplier)
Creates a new instance from a delegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
sample(wavefront.report.Span span)
Evaluates whether a span should be allowed or discarded.boolean
sample(wavefront.report.Span span, com.yammer.metrics.core.Counter discarded)
Evaluates whether a span should be allowed or discarded, and increment a counter if it should be discarded.
-
-
-
Field Detail
-
SPAN_SAMPLING_POLICY_TAG
public static final String SPAN_SAMPLING_POLICY_TAG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpanSampler
public SpanSampler(com.wavefront.sdk.entities.tracing.sampling.Sampler delegate, @Nonnull Supplier<List<com.wavefront.api.agent.SpanSamplingPolicy>> activeSpanSamplingPoliciesSupplier)
Creates a new instance from a delegate.- Parameters:
delegate
- The delegate .activeSpanSamplingPoliciesSupplier
- Active span sampling policies to be applied.
-
-
Method Detail
-
sample
public boolean sample(wavefront.report.Span span)
Evaluates whether a span should be allowed or discarded.- Parameters:
span
- The span to sample.- Returns:
- true if the span should be allowed, false otherwise.
-
sample
public boolean sample(wavefront.report.Span span, @Nullable com.yammer.metrics.core.Counter discarded)
Evaluates whether a span should be allowed or discarded, and increment a counter if it should be discarded.- Parameters:
span
- The span to sample.discarded
- The counter to increment if the decision is to discard the span.- Returns:
- true if the span should be allowed, false otherwise.
-
-