Please take the OpenCensus user survey

Probabilistic

Probabilistic sampler

The probabilistic sampler probabilistically returns True or False for whether a span should be sampled depending on the results of a coin flip.

By default, the probabilistic sampling rate is 1 in 10,000

Code samples

import "go.opencensus.io/trace"

theSampler = trace.ProbabilitySampler(1/1000.0);
Samplers.probabilitySampler(1/1000.0);
// Samplers are potentially expensive to construct. Use one long-lived
// sampler instead of constructing one for every Span.
static opencensus::trace::ProbabilitySampler sampler(1/1000.0);
const root = new RootSpan(tracer);
const sampler = SamplerBuilder.getSampler(0.01);
const samplerProbability = sampler.shouldSample(root.traceId);

Reference

Resource URL
Probability sampler in specs https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/Sampling.md#what-kind-of-samplers-does-opencensus-support
Go ProbabilitySample trace.ProbabilitySampler
Java ProbabilitySampler trace.ProbabilitySampler
C++ ProbabilitySampler trace.ProbabilitySampler
Node.js TracerConfig trace.TracerConfig