OpenCensus is being archived! Read the blog post to learn more

Always

Always sampler

The Always sampler always returns a decision of True for any sampling decision

Code samples

import "go.opencensus.io/trace"

_ = trace.AlwaysSample()
Samplers.alwaysSample();
from opencensus.trace.samplers import always_on
from opencensus.trace import tracer as tracer_module

# This is the default sampler
sampler = always_on.AlwaysOnSampler()
tracer = tracer_module.Tracer(sampler=sampler)
// Samplers are potentially expensive to construct. Use one long-lived
// sampler instead of constructing one for every Span.
static opencensus::trace::AlwaysSampler sampler;
const root = new RootSpan(tracer);
const sampler = SamplerBuilder.getSampler(1); // Always samples when value is >= 1
const samplerShouldSample = sampler.shouldSample(root.traceId);

Reference

Resource URL
Go AlwaysSample trace.AlwaysSample
Python samplers trace.samplers
Java AlwaysSample trace.AlwaysSample
C++ AlwaysSample trace.AlwaysSample
Node.js TracerConfig trace.TracerConfig