Class Sampler
Defined in File sampler.h
Inheritance Relationships
Derived Types
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)
Class Documentation
-
class opentelemetry::sdk::trace::Sampler
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
Public Functions
-
virtual ~Sampler() = default
-
virtual SamplingResult ShouldSample(const trace_api::SpanContext &parent_context, trace_api::TraceId trace_id, nostd::string_view name, trace_api::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, const trace_api::SpanContextKeyValueIterable &links) noexcept = 0
Called during Span creation to make a sampling decision.
- Since
0.1.0
- Parameters
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 trace_api::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.
- Returns
sampling result whether span should be sampled or not.
-
virtual ~Sampler() = default