Class SpanSampler


  • public class SpanSampler
    extends Object
    Sampler that takes a Span as input and delegates to a Sampler when evaluating the sampling decision.
    Author:
    Han Zhang ([email protected])
    • 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.
    • 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.