Class ParentBasedSampler

Inheritance Relationships

Base Type

Class Documentation

class ParentBasedSampler : public opentelemetry::sdk::trace::Sampler

The ParentBased sampler is a composite sampler. ParentBased(delegateSampler) either respects the parent span’s sampling decision or delegates to delegateSampler for root spans.

Public Functions

explicit ParentBasedSampler(std::shared_ptr<Sampler> delegate_sampler) noexcept
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 override

The decision either respects the parent span’s sampling decision or delegates to delegateSampler for root spans

Returns

Returns DROP always

virtual nostd::string_view GetDescription() const noexcept override
Returns

Description MUST be ParentBased{delegate_sampler_.getDescription()}