Defined in File sampler.h
public opentelemetry::sdk::trace::AlwaysOffSampler(Class AlwaysOffSampler)
public opentelemetry::sdk::trace::AlwaysOnSampler(Class AlwaysOnSampler)
public opentelemetry::sdk::trace::ParentBasedSampler(Class ParentBasedSampler)
public opentelemetry::sdk::trace::TraceIdRatioBasedSampler(Class TraceIdRatioBasedSampler)
The Sampler interface allows users to create custom samplers which will return a SamplingResult based on information that is typically available just before the Span was created.
Subclassed by opentelemetry::sdk::trace::AlwaysOffSampler, opentelemetry::sdk::trace::AlwaysOnSampler, opentelemetry::sdk::trace::ParentBasedSampler, opentelemetry::sdk::trace::TraceIdRatioBasedSampler
virtual ~Sampler() = default
virtual SamplingResult ShouldSample(const opentelemetry::trace::SpanContext &parent_context, opentelemetry::trace::TraceId trace_id, nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept = 0
Called during Span creation to make a sampling decision.
parent_context – a const reference to the SpanContext of a parent Span. An invalid SpanContext if this is a root span.
trace_id – the TraceId for the new Span. This will be identical to that in the parentContext, unless this is a root span.
name – the name of the new Span.
spanKind – the opentelemetry::trace::SpanKind of the Span.
attributes – list of AttributeValue with their keys.
links – Collection of links that will be associated with the Span to be created.
sampling result whether span should be sampled or not.
- virtual ~Sampler() = default