NVIDIA DeepStream SDK API Reference

9.2 Release
sdk::trace::TracerContext Class Reference

Detailed Description

A class which stores the TracerProvider context.

This class meets the following design criteria:

  • A shared reference between TracerProvider and Tracers instantiated.
  • A thread-safe class that allows updating/altering processor/exporter pipelines and sampling config.
  • The owner/destroyer of Processors/Exporters. These will remain active until this class is destroyed. I.e. Sampling, Exporting, flushing, Custom Iterator etc. are all ok if this object is alive, and they will work together. If this object is destroyed, then no shared references to Processor, Exporter, Recordable, Custom Iterator etc. should exist, and all associated pipelines will have been flushed.

Definition at line 39 of file includes/opentelemetry/sdk/trace/tracer_context.h.

Public Member Functions

 TracerContext (std::vector< std::unique_ptr< SpanProcessor >> &&processor, const opentelemetry::sdk::resource::Resource &resource=opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr< Sampler > sampler=std::unique_ptr< AlwaysOnSampler >(new AlwaysOnSampler), std::unique_ptr< IdGenerator > id_generator=std::unique_ptr< IdGenerator >(new RandomIdGenerator()), std::unique_ptr< instrumentationscope::ScopeConfigurator< TracerConfig >> tracer_configurator=std::make_unique< instrumentationscope::ScopeConfigurator< TracerConfig >>(instrumentationscope::ScopeConfigurator< TracerConfig >::Builder(TracerConfig::Default()) .Build())) noexcept
 
virtual ~TracerContext ()=default
 
void AddProcessor (std::unique_ptr< SpanProcessor > processor) noexcept
 Attaches a span processor to list of configured processors to this tracer context. More...
 
Sampler & GetSampler () const noexcept
 Obtain the sampler associated with this tracer. More...
 
SpanProcessor & GetProcessor () const noexcept
 Obtain the configured (composite) processor. More...
 
const opentelemetry::sdk::resource::Resource & GetResource () const noexcept
 Obtain the resource associated with this tracer context. More...
 
const instrumentationscope::ScopeConfigurator< TracerConfig > & GetTracerConfigurator () const noexcept
 Obtain the ScopeConfigurator with this tracer context. More...
 
opentelemetry::sdk::trace::IdGenerator & GetIdGenerator () const noexcept
 Obtain the Id Generator associated with this tracer context. More...
 
bool ForceFlush (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Force all active SpanProcessors to flush any buffered spans within the given timeout. More...
 
bool Shutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Shutdown the span processor associated with this tracer provider. More...
 
 TracerContext (std::vector< std::unique_ptr< SpanProcessor >> &&processor, const opentelemetry::sdk::resource::Resource &resource=opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr< Sampler > sampler=std::unique_ptr< AlwaysOnSampler >(new AlwaysOnSampler), std::unique_ptr< IdGenerator > id_generator=std::unique_ptr< IdGenerator >(new RandomIdGenerator()), std::unique_ptr< instrumentationscope::ScopeConfigurator< TracerConfig >> tracer_configurator=std::make_unique< instrumentationscope::ScopeConfigurator< TracerConfig >>(instrumentationscope::ScopeConfigurator< TracerConfig >::Builder(TracerConfig::Default()) .Build())) noexcept
 
virtual ~TracerContext ()=default
 
void AddProcessor (std::unique_ptr< SpanProcessor > processor) noexcept
 Attaches a span processor to list of configured processors to this tracer context. More...
 
Sampler & GetSampler () const noexcept
 Obtain the sampler associated with this tracer. More...
 
SpanProcessor & GetProcessor () const noexcept
 Obtain the configured (composite) processor. More...
 
const opentelemetry::sdk::resource::Resource & GetResource () const noexcept
 Obtain the resource associated with this tracer context. More...
 
const instrumentationscope::ScopeConfigurator< TracerConfig > & GetTracerConfigurator () const noexcept
 Obtain the ScopeConfigurator with this tracer context. More...
 
opentelemetry::sdk::trace::IdGenerator & GetIdGenerator () const noexcept
 Obtain the Id Generator associated with this tracer context. More...
 
bool ForceFlush (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Force all active SpanProcessors to flush any buffered spans within the given timeout. More...
 
bool Shutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Shutdown the span processor associated with this tracer provider. More...
 

Constructor & Destructor Documentation

◆ TracerContext() [1/2]

sdk::trace::TracerContext::TracerContext ( std::vector< std::unique_ptr< SpanProcessor >> &&  processor,
const opentelemetry::sdk::resource::Resource &  resource = opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr< Sampler >  sampler = std::unique_ptr< AlwaysOnSampler >(new AlwaysOnSampler),
std::unique_ptr< IdGenerator >  id_generator = std::unique_ptr< IdGenerator >(new RandomIdGenerator()),
std::unique_ptr< instrumentationscope::ScopeConfigurator< TracerConfig >>  tracer_configurator = std::make_unique< instrumentationscope::ScopeConfigurator< TracerConfig >>(instrumentationscope::ScopeConfigurator< TracerConfig >::Builder(TracerConfig::Default()) .Build()) 
)
explicitnoexcept

◆ ~TracerContext() [1/2]

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

◆ TracerContext() [2/2]

sdk::trace::TracerContext::TracerContext ( std::vector< std::unique_ptr< SpanProcessor >> &&  processor,
const opentelemetry::sdk::resource::Resource &  resource = opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr< Sampler >  sampler = std::unique_ptr< AlwaysOnSampler >(new AlwaysOnSampler),
std::unique_ptr< IdGenerator >  id_generator = std::unique_ptr< IdGenerator >(new RandomIdGenerator()),
std::unique_ptr< instrumentationscope::ScopeConfigurator< TracerConfig >>  tracer_configurator = std::make_unique< instrumentationscope::ScopeConfigurator< TracerConfig >>(instrumentationscope::ScopeConfigurator< TracerConfig >::Builder(TracerConfig::Default()) .Build()) 
)
explicitnoexcept

◆ ~TracerContext() [2/2]

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

Member Function Documentation

◆ AddProcessor() [1/2]

void sdk::trace::TracerContext::AddProcessor ( std::unique_ptr< SpanProcessor >  processor)
noexcept

Attaches a span processor to list of configured processors to this tracer context.

Processor once attached can't be removed.

Parameters
processorThe new span processor for this tracer. This must not be a nullptr. Ownership is given to the TracerContext.

Note: This method is not thread safe.

◆ AddProcessor() [2/2]

void sdk::trace::TracerContext::AddProcessor ( std::unique_ptr< SpanProcessor >  processor)
noexcept

Attaches a span processor to list of configured processors to this tracer context.

Processor once attached can't be removed.

Parameters
processorThe new span processor for this tracer. This must not be a nullptr. Ownership is given to the TracerContext.

Note: This method is not thread safe.

◆ ForceFlush() [1/2]

bool sdk::trace::TracerContext::ForceFlush ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Force all active SpanProcessors to flush any buffered spans within the given timeout.

◆ ForceFlush() [2/2]

bool sdk::trace::TracerContext::ForceFlush ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Force all active SpanProcessors to flush any buffered spans within the given timeout.

◆ GetIdGenerator() [1/2]

opentelemetry::sdk::trace::IdGenerator& sdk::trace::TracerContext::GetIdGenerator ( ) const
noexcept

Obtain the Id Generator associated with this tracer context.

Returns
The ID Generator for this tracer context.

◆ GetIdGenerator() [2/2]

opentelemetry::sdk::trace::IdGenerator& sdk::trace::TracerContext::GetIdGenerator ( ) const
noexcept

Obtain the Id Generator associated with this tracer context.

Returns
The ID Generator for this tracer context.

◆ GetProcessor() [1/2]

SpanProcessor& sdk::trace::TracerContext::GetProcessor ( ) const
noexcept

Obtain the configured (composite) processor.

Note: When more than one processor is active, this will return an "aggregate" processor

◆ GetProcessor() [2/2]

SpanProcessor& sdk::trace::TracerContext::GetProcessor ( ) const
noexcept

Obtain the configured (composite) processor.

Note: When more than one processor is active, this will return an "aggregate" processor

◆ GetResource() [1/2]

const opentelemetry::sdk::resource::Resource& sdk::trace::TracerContext::GetResource ( ) const
noexcept

Obtain the resource associated with this tracer context.

Returns
The resource for this tracer context.

◆ GetResource() [2/2]

const opentelemetry::sdk::resource::Resource& sdk::trace::TracerContext::GetResource ( ) const
noexcept

Obtain the resource associated with this tracer context.

Returns
The resource for this tracer context.

◆ GetSampler() [1/2]

Sampler& sdk::trace::TracerContext::GetSampler ( ) const
noexcept

Obtain the sampler associated with this tracer.

Returns
The sampler for this tracer.

◆ GetSampler() [2/2]

Sampler& sdk::trace::TracerContext::GetSampler ( ) const
noexcept

Obtain the sampler associated with this tracer.

Returns
The sampler for this tracer.

◆ GetTracerConfigurator() [1/2]

const instrumentationscope::ScopeConfigurator<TracerConfig>& sdk::trace::TracerContext::GetTracerConfigurator ( ) const
noexcept

Obtain the ScopeConfigurator with this tracer context.

Returns
The ScopeConfigurator for this tracer context.

◆ GetTracerConfigurator() [2/2]

const instrumentationscope::ScopeConfigurator<TracerConfig>& sdk::trace::TracerContext::GetTracerConfigurator ( ) const
noexcept

Obtain the ScopeConfigurator with this tracer context.

Returns
The ScopeConfigurator for this tracer context.

◆ Shutdown() [1/2]

bool sdk::trace::TracerContext::Shutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Shutdown the span processor associated with this tracer provider.

◆ Shutdown() [2/2]

bool sdk::trace::TracerContext::Shutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Shutdown the span processor associated with this tracer provider.


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