NVIDIA DeepStream SDK API Reference

9.2 Release
sdk::trace::ParentBasedSampler Class Reference

Detailed Description

The ParentBased sampler is a composite sampler that delegates sampling decisions based on the parent span's context.

The decision is delegated to one of five configurable samplers:

  • No parent exists (root span): delegates to root sampler.
  • A remote parent exists and was sampled: delegates to remote_parent_sampled_sampler (default to AlwaysOnSampler).
  • A remote parent exists and was not sampled: delegates to remote_parent_nonsampled_sampler (default to AlwaysOffSampler).
  • A local parent exists and was sampled: delegates to local_parent_sampled_sampler (default to AlwaysOnSampler).
  • A local parent exists and was not sampled: delegates to local_parent_nonsampled_sampler (default to AlwaysOffSampler).

Definition at line 40 of file includes/opentelemetry/sdk/trace/samplers/parent.h.

Inheritance diagram for sdk::trace::ParentBasedSampler:
Collaboration diagram for sdk::trace::ParentBasedSampler:

Public Member Functions

 ParentBasedSampler (const std::shared_ptr< Sampler > &root_sampler, const std::shared_ptr< Sampler > &remote_parent_sampled_sampler=std::make_shared< AlwaysOnSampler >(), const std::shared_ptr< Sampler > &remote_parent_nonsampled_sampler=std::make_shared< AlwaysOffSampler >(), const std::shared_ptr< Sampler > &local_parent_sampled_sampler=std::make_shared< AlwaysOnSampler >(), const std::shared_ptr< Sampler > &local_parent_nonsampled_sampler=std::make_shared< AlwaysOffSampler >()) noexcept
 
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
 Implements the decision logic by checking the parent context and delegating to the appropriate configured sampler. More...
 
nostd::string_view GetDescription () const noexcept override
 
 ParentBasedSampler (const std::shared_ptr< Sampler > &root_sampler, const std::shared_ptr< Sampler > &remote_parent_sampled_sampler=std::make_shared< AlwaysOnSampler >(), const std::shared_ptr< Sampler > &remote_parent_nonsampled_sampler=std::make_shared< AlwaysOffSampler >(), const std::shared_ptr< Sampler > &local_parent_sampled_sampler=std::make_shared< AlwaysOnSampler >(), const std::shared_ptr< Sampler > &local_parent_nonsampled_sampler=std::make_shared< AlwaysOffSampler >()) noexcept
 
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
 Implements the decision logic by checking the parent context and delegating to the appropriate configured sampler. More...
 
nostd::string_view GetDescription () const noexcept override
 

Constructor & Destructor Documentation

◆ ParentBasedSampler() [1/2]

sdk::trace::ParentBasedSampler::ParentBasedSampler ( const std::shared_ptr< Sampler > &  root_sampler,
const std::shared_ptr< Sampler > &  remote_parent_sampled_sampler = std::make_shared< AlwaysOnSampler >(),
const std::shared_ptr< Sampler > &  remote_parent_nonsampled_sampler = std::make_shared< AlwaysOffSampler >(),
const std::shared_ptr< Sampler > &  local_parent_sampled_sampler = std::make_shared< AlwaysOnSampler >(),
const std::shared_ptr< Sampler > &  local_parent_nonsampled_sampler = std::make_shared< AlwaysOffSampler >() 
)
explicitnoexcept

◆ ParentBasedSampler() [2/2]

sdk::trace::ParentBasedSampler::ParentBasedSampler ( const std::shared_ptr< Sampler > &  root_sampler,
const std::shared_ptr< Sampler > &  remote_parent_sampled_sampler = std::make_shared< AlwaysOnSampler >(),
const std::shared_ptr< Sampler > &  remote_parent_nonsampled_sampler = std::make_shared< AlwaysOffSampler >(),
const std::shared_ptr< Sampler > &  local_parent_sampled_sampler = std::make_shared< AlwaysOnSampler >(),
const std::shared_ptr< Sampler > &  local_parent_nonsampled_sampler = std::make_shared< AlwaysOffSampler >() 
)
explicitnoexcept

Member Function Documentation

◆ GetDescription() [1/2]

nostd::string_view sdk::trace::ParentBasedSampler::GetDescription ( ) const
overridevirtualnoexcept
Returns
Description MUST be ParentBased{delegate_sampler_.getDescription()}

Implements sdk::trace::Sampler.

◆ GetDescription() [2/2]

nostd::string_view sdk::trace::ParentBasedSampler::GetDescription ( ) const
overridevirtualnoexcept
Returns
Description MUST be ParentBased{delegate_sampler_.getDescription()}

Implements sdk::trace::Sampler.

◆ ShouldSample() [1/2]

SamplingResult sdk::trace::ParentBasedSampler::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 
)
overridevirtualnoexcept

Implements the decision logic by checking the parent context and delegating to the appropriate configured sampler.

Returns
The SamplingResult from the delegated sampler

Implements sdk::trace::Sampler.

◆ ShouldSample() [2/2]

SamplingResult sdk::trace::ParentBasedSampler::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 
)
overridevirtualnoexcept

Implements the decision logic by checking the parent context and delegating to the appropriate configured sampler.

Returns
The SamplingResult from the delegated sampler

Implements sdk::trace::Sampler.


The documentation for this class was generated from the following file: