NVIDIA DeepStream SDK API Reference

9.2 Release
trace::TraceState Class Reference

Detailed Description

TraceState carries tracing-system specific context in a list of key-value pairs.

TraceState allows different vendors to propagate additional information and inter-operate with their legacy id formats.

For more information, see the W3C Trace Context specification: https://www.w3.org/TR/trace-context

Definition at line 34 of file includes/opentelemetry/trace/trace_state.h.

Public Member Functions

std::string ToHeader () const noexcept
 Creates a w3c tracestate header from TraceState object. More...
 
bool Get (nostd::string_view key, std::string &value) const noexcept
 Returns value associated with key passed as argument Returns empty string if key is invalid or not found. More...
 
nostd::shared_ptr< TraceState > Set (const nostd::string_view &key, const nostd::string_view &value) noexcept
 Returns shared_ptr of new TraceState object with following mutations applied to the existing instance: Update Key value: The updated value must be moved to beginning of List Add : The new key-value pair SHOULD be added to beginning of List. More...
 
nostd::shared_ptr< TraceState > Delete (const nostd::string_view &key) noexcept
 Returns shared_ptr to a new TraceState object after removing the attribute with given key ( if present ) More...
 
bool Empty () const noexcept
 
bool GetAllEntries (nostd::function_ref< bool(nostd::string_view, nostd::string_view)> callback) const noexcept
 
std::string ToHeader () const noexcept
 Creates a w3c tracestate header from TraceState object. More...
 
bool Get (nostd::string_view key, std::string &value) const noexcept
 Returns value associated with key passed as argument Returns empty string if key is invalid or not found. More...
 
nostd::shared_ptr< TraceState > Set (const nostd::string_view &key, const nostd::string_view &value) noexcept
 Returns shared_ptr of new TraceState object with following mutations applied to the existing instance: Update Key value: The updated value must be moved to beginning of List Add : The new key-value pair SHOULD be added to beginning of List. More...
 
nostd::shared_ptr< TraceState > Delete (const nostd::string_view &key) noexcept
 Returns shared_ptr to a new TraceState object after removing the attribute with given key ( if present ) More...
 
bool Empty () const noexcept
 
bool GetAllEntries (nostd::function_ref< bool(nostd::string_view, nostd::string_view)> callback) const noexcept
 

Static Public Member Functions

static OPENTELEMETRY_API_SINGLETON nostd::shared_ptr< TraceState > GetDefault ()
 
static nostd::shared_ptr< TraceState > FromHeader (nostd::string_view header) noexcept
 Returns shared_ptr to a newly created TraceState parsed from the header provided. More...
 
static bool IsValidKey (nostd::string_view key)
 Returns whether key is a valid key. More...
 
static bool IsValidValue (nostd::string_view value)
 Returns whether value is a valid value. More...
 
static OPENTELEMETRY_API_SINGLETON nostd::shared_ptr< TraceState > GetDefault ()
 
static nostd::shared_ptr< TraceState > FromHeader (nostd::string_view header) noexcept
 Returns shared_ptr to a newly created TraceState parsed from the header provided. More...
 
static bool IsValidKey (nostd::string_view key)
 Returns whether key is a valid key. More...
 
static bool IsValidValue (nostd::string_view value)
 Returns whether value is a valid value. More...
 

Static Public Attributes

static constexpr int kKeyMaxSize = 256
 
static constexpr int kValueMaxSize = 256
 
static constexpr int kMaxKeyValuePairs = 32
 
static constexpr auto kKeyValueSeparator = '='
 
static constexpr auto kMembersSeparator = ','
 

Member Function Documentation

◆ Delete() [1/2]

nostd::shared_ptr<TraceState> trace::TraceState::Delete ( const nostd::string_view &  key)
inlinenoexcept

Returns shared_ptr to a new TraceState object after removing the attribute with given key ( if present )

Returns
empty TraceState object if key is invalid
copy of original TraceState object if key is not present (??)

Definition at line 172 of file includes/opentelemetry/trace/trace_state.h.

References GetDefault().

◆ Delete() [2/2]

nostd::shared_ptr<TraceState> trace::TraceState::Delete ( const nostd::string_view &  key)
inlinenoexcept

Returns shared_ptr to a new TraceState object after removing the attribute with given key ( if present )

Returns
empty TraceState object if key is invalid
copy of original TraceState object if key is not present (??)

Definition at line 172 of file 9.2/includes/opentelemetry/trace/trace_state.h.

References GetDefault().

◆ Empty() [1/2]

bool trace::TraceState::Empty ( ) const
inlinenoexcept

◆ Empty() [2/2]

bool trace::TraceState::Empty ( ) const
inlinenoexcept

Definition at line 196 of file includes/opentelemetry/trace/trace_state.h.

◆ FromHeader() [1/2]

static nostd::shared_ptr<TraceState> trace::TraceState::FromHeader ( nostd::string_view  header)
inlinestaticnoexcept

Returns shared_ptr to a newly created TraceState parsed from the header provided.

Parameters
headerEncoding of the tracestate header defined by the W3C Trace Context specification https://www.w3.org/TR/trace-context/
Returns
TraceState A new TraceState instance or DEFAULT

Definition at line 55 of file 9.2/includes/opentelemetry/trace/trace_state.h.

References common::KeyValueStringTokenizer::next(), and common::KeyValueStringTokenizer::NumTokens().

◆ FromHeader() [2/2]

static nostd::shared_ptr<TraceState> trace::TraceState::FromHeader ( nostd::string_view  header)
inlinestaticnoexcept

Returns shared_ptr to a newly created TraceState parsed from the header provided.

Parameters
headerEncoding of the tracestate header defined by the W3C Trace Context specification https://www.w3.org/TR/trace-context/
Returns
TraceState A new TraceState instance or DEFAULT

Definition at line 55 of file includes/opentelemetry/trace/trace_state.h.

References common::KeyValueStringTokenizer::next(), and common::KeyValueStringTokenizer::NumTokens().

◆ Get() [1/2]

bool trace::TraceState::Get ( nostd::string_view  key,
std::string &  value 
) const
inlinenoexcept

Returns value associated with key passed as argument Returns empty string if key is invalid or not found.

Definition at line 118 of file includes/opentelemetry/trace/trace_state.h.

◆ Get() [2/2]

bool trace::TraceState::Get ( nostd::string_view  key,
std::string &  value 
) const
inlinenoexcept

Returns value associated with key passed as argument Returns empty string if key is invalid or not found.

Definition at line 118 of file 9.2/includes/opentelemetry/trace/trace_state.h.

◆ GetAllEntries() [1/2]

bool trace::TraceState::GetAllEntries ( nostd::function_ref< bool(nostd::string_view, nostd::string_view)>  callback) const
inlinenoexcept

Definition at line 200 of file includes/opentelemetry/trace/trace_state.h.

◆ GetAllEntries() [2/2]

bool trace::TraceState::GetAllEntries ( nostd::function_ref< bool(nostd::string_view, nostd::string_view)>  callback) const
inlinenoexcept

◆ GetDefault() [1/2]

static OPENTELEMETRY_API_SINGLETON nostd::shared_ptr<TraceState> trace::TraceState::GetDefault ( )
inlinestatic

Definition at line 43 of file includes/opentelemetry/trace/trace_state.h.

Referenced by Delete(), and Set().

◆ GetDefault() [2/2]

static OPENTELEMETRY_API_SINGLETON nostd::shared_ptr<TraceState> trace::TraceState::GetDefault ( )
inlinestatic

◆ IsValidKey() [1/2]

static bool trace::TraceState::IsValidKey ( nostd::string_view  key)
inlinestatic

Returns whether key is a valid key.

See https://www.w3.org/TR/trace-context/#key Identifiers MUST begin with a lowercase letter or a digit, and can only contain lowercase letters (a-z), digits (0-9), underscores (_), dashes (-), asterisks (*), and forward slashes (/). For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the vendor name.

Definition at line 212 of file includes/opentelemetry/trace/trace_state.h.

◆ IsValidKey() [2/2]

static bool trace::TraceState::IsValidKey ( nostd::string_view  key)
inlinestatic

Returns whether key is a valid key.

See https://www.w3.org/TR/trace-context/#key Identifiers MUST begin with a lowercase letter or a digit, and can only contain lowercase letters (a-z), digits (0-9), underscores (_), dashes (-), asterisks (*), and forward slashes (/). For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the vendor name.

Definition at line 212 of file 9.2/includes/opentelemetry/trace/trace_state.h.

◆ IsValidValue() [1/2]

static bool trace::TraceState::IsValidValue ( nostd::string_view  value)
inlinestatic

Returns whether value is a valid value.

See https://www.w3.org/TR/trace-context/#value The value is an opaque string containing up to 256 printable ASCII (RFC0020) characters ((i.e., the range 0x20 to 0x7E) except comma , and equal =)

Definition at line 225 of file 9.2/includes/opentelemetry/trace/trace_state.h.

◆ IsValidValue() [2/2]

static bool trace::TraceState::IsValidValue ( nostd::string_view  value)
inlinestatic

Returns whether value is a valid value.

See https://www.w3.org/TR/trace-context/#value The value is an opaque string containing up to 256 printable ASCII (RFC0020) characters ((i.e., the range 0x20 to 0x7E) except comma , and equal =)

Definition at line 225 of file includes/opentelemetry/trace/trace_state.h.

◆ Set() [1/2]

nostd::shared_ptr<TraceState> trace::TraceState::Set ( const nostd::string_view &  key,
const nostd::string_view &  value 
)
inlinenoexcept

Returns shared_ptr of new TraceState object with following mutations applied to the existing instance: Update Key value: The updated value must be moved to beginning of List Add : The new key-value pair SHOULD be added to beginning of List.

If the provided key-value pair is invalid, or results in transtate that violates the tracecontext specification, empty TraceState instance will be returned.

If the existing object has maximum list members, it's copy is returned.

Definition at line 138 of file 9.2/includes/opentelemetry/trace/trace_state.h.

References GetDefault().

◆ Set() [2/2]

nostd::shared_ptr<TraceState> trace::TraceState::Set ( const nostd::string_view &  key,
const nostd::string_view &  value 
)
inlinenoexcept

Returns shared_ptr of new TraceState object with following mutations applied to the existing instance: Update Key value: The updated value must be moved to beginning of List Add : The new key-value pair SHOULD be added to beginning of List.

If the provided key-value pair is invalid, or results in transtate that violates the tracecontext specification, empty TraceState instance will be returned.

If the existing object has maximum list members, it's copy is returned.

Definition at line 138 of file includes/opentelemetry/trace/trace_state.h.

References GetDefault().

◆ ToHeader() [1/2]

std::string trace::TraceState::ToHeader ( ) const
inlinenoexcept

Creates a w3c tracestate header from TraceState object.

Definition at line 92 of file 9.2/includes/opentelemetry/trace/trace_state.h.

References nostd::string_view::data(), and nostd::string_view::size().

◆ ToHeader() [2/2]

std::string trace::TraceState::ToHeader ( ) const
inlinenoexcept

Creates a w3c tracestate header from TraceState object.

Definition at line 92 of file includes/opentelemetry/trace/trace_state.h.

References nostd::string_view::data(), and nostd::string_view::size().

Field Documentation

◆ kKeyMaxSize

static constexpr int trace::TraceState::kKeyMaxSize = 256
staticconstexpr

Definition at line 37 of file includes/opentelemetry/trace/trace_state.h.

◆ kKeyValueSeparator

static constexpr auto trace::TraceState::kKeyValueSeparator = '='
staticconstexpr

Definition at line 40 of file includes/opentelemetry/trace/trace_state.h.

◆ kMaxKeyValuePairs

static constexpr int trace::TraceState::kMaxKeyValuePairs = 32
staticconstexpr

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

◆ kMembersSeparator

static constexpr auto trace::TraceState::kMembersSeparator = ','
staticconstexpr

Definition at line 41 of file includes/opentelemetry/trace/trace_state.h.

◆ kValueMaxSize

static constexpr int trace::TraceState::kValueMaxSize = 256
staticconstexpr

Definition at line 38 of file includes/opentelemetry/trace/trace_state.h.


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