Class ProbabilityBasedSampler

java.lang.Object
brave.sampler.Sampler
io.micrometer.tracing.brave.sampler.ProbabilityBasedSampler

public class ProbabilityBasedSampler extends brave.sampler.Sampler
This sampler is appropriate for low-traffic instrumentation (ex servers that each receive less than 100K requests), or those who do not provision random trace ids. It not appropriate for collectors as the sampling decision isn't idempotent (consistent based on trace id).

Implementation

Taken from CountingTraceIdSampler class from Zipkin project.

This counts to see how many out of 100 traces should be retained. This means that it is accurate in units of 100 traces.

Since:
1.0.0
  • Constructor Details

    • ProbabilityBasedSampler

      public ProbabilityBasedSampler(Supplier<Float> probability)
      Creates a new instance of ProbabilityBasedSampler.
      Parameters:
      probability - supplier of probability
  • Method Details

    • isSampled

      public boolean isSampled(long traceId)
      Specified by:
      isSampled in class brave.sampler.Sampler