NVIDIA DeepStream SDK API Reference

9.2 Release
sdk::trace::Sampler Class Referenceabstract

Detailed Description

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.

Definition at line 71 of file includes/opentelemetry/sdk/trace/sampler.h.

Inheritance diagram for sdk::trace::Sampler:

Public Member Functions

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. More...
 
virtual nostd::string_view GetDescription () const noexcept=0
 Returns the sampler name or short description with the configuration. More...
 
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. More...
 
virtual nostd::string_view GetDescription () const noexcept=0
 Returns the sampler name or short description with the configuration. More...
 

Constructor & Destructor Documentation

◆ ~Sampler() [1/2]

virtual sdk::trace::Sampler::~Sampler ( )
virtualdefault

◆ ~Sampler() [2/2]

virtual sdk::trace::Sampler::~Sampler ( )
virtualdefault

Member Function Documentation

◆ GetDescription() [1/2]

virtual nostd::string_view sdk::trace::Sampler::GetDescription ( ) const
pure virtualnoexcept

Returns the sampler name or short description with the configuration.

This may be displayed on debug pages or in the logs.

Returns
the description of this Sampler.

Implemented in sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::AlwaysOffSampler, and sdk::trace::AlwaysOffSampler.

◆ GetDescription() [2/2]

virtual nostd::string_view sdk::trace::Sampler::GetDescription ( ) const
pure virtualnoexcept

Returns the sampler name or short description with the configuration.

This may be displayed on debug pages or in the logs.

Returns
the description of this Sampler.

Implemented in sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::AlwaysOffSampler, and sdk::trace::AlwaysOffSampler.

◆ ShouldSample() [1/2]

virtual SamplingResult sdk::trace::Sampler::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 
)
pure virtualnoexcept

Called during Span creation to make a sampling decision.

Parameters
parent_contexta const reference to the SpanContext of a parent Span. An invalid SpanContext if this is a root span.
trace_idthe TraceId for the new Span. This will be identical to that in the parentContext, unless this is a root span.
namethe name of the new Span.
span_kindthe opentelemetry::trace::SpanKind of the Span.
attributeslist of AttributeValue with their keys.
linksCollection of links that will be associated with the Span to be created.
Returns
sampling result whether span should be sampled or not.
Since
0.1.0

Implemented in sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOffSampler, sdk::trace::AlwaysOffSampler, sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::TraceIdRatioBasedSampler, and sdk::trace::TraceIdRatioBasedSampler.

◆ ShouldSample() [2/2]

virtual SamplingResult sdk::trace::Sampler::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 
)
pure virtualnoexcept

Called during Span creation to make a sampling decision.

Parameters
parent_contexta const reference to the SpanContext of a parent Span. An invalid SpanContext if this is a root span.
trace_idthe TraceId for the new Span. This will be identical to that in the parentContext, unless this is a root span.
namethe name of the new Span.
span_kindthe opentelemetry::trace::SpanKind of the Span.
attributeslist of AttributeValue with their keys.
linksCollection of links that will be associated with the Span to be created.
Returns
sampling result whether span should be sampled or not.
Since
0.1.0

Implemented in sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOffSampler, sdk::trace::AlwaysOffSampler, sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::TraceIdRatioBasedSampler, and sdk::trace::TraceIdRatioBasedSampler.


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