NVIDIA DeepStream SDK API Reference
9.2 Release
includes/opentelemetry/trace/context.h
Go to the documentation of this file.
1
// Copyright The OpenTelemetry Authors
2
// SPDX-License-Identifier: Apache-2.0
3
4
#pragma once
5
6
#include "opentelemetry/context/context.h"
7
#include "opentelemetry/nostd/shared_ptr.h"
8
#include "opentelemetry/trace/default_span.h"
9
#include "opentelemetry/version.h"
10
11
OPENTELEMETRY_BEGIN_NAMESPACE
12
namespace
trace
13
{
14
15
// Get Span from explicit context
16
inline
nostd::shared_ptr<Span>
GetSpan
(
const
context::Context
&
context
) noexcept
17
{
18
context::ContextValue
span =
context
.GetValue(
kSpanKey
);
19
if
(
nostd::holds_alternative
<
nostd::shared_ptr<Span>
>(span))
20
{
21
return
nostd::get<nostd::shared_ptr<Span>>(span);
22
}
23
return
nostd::shared_ptr<Span>
(
new
DefaultSpan
(
SpanContext::GetInvalid
()));
24
}
25
26
inline
bool
IsRootSpan
(
const
context::Context
&
context
) noexcept
27
{
28
context::ContextValue
is_root_span =
context
.GetValue(
kIsRootSpanKey
);
29
if
(nostd::holds_alternative<bool>(is_root_span))
30
{
31
return
nostd::get<bool>(is_root_span);
32
}
33
return
false
;
34
}
35
36
// Set Span into explicit context
37
inline
context::Context
SetSpan
(
context::Context
&
context
,
38
const
nostd::shared_ptr<Span>
&span) noexcept
39
{
40
return
context
.SetValue(
kSpanKey
, span);
41
}
42
43
}
// namespace trace
44
OPENTELEMETRY_END_NAMESPACE
trace::SetSpan
context::Context SetSpan(context::Context &context, const nostd::shared_ptr< Span > &span) noexcept
Definition:
includes/opentelemetry/trace/context.h:37
trace
Definition:
includes/opentelemetry/context/context_value.h:18
absl::OTABSL_OPTION_NAMESPACE_NAME::variant
Definition:
includes/opentelemetry/nostd/variant.h:61
trace::DefaultSpan
DefaultSpan provides a non-operational Span that propagates the tracer context by wrapping it inside ...
Definition:
includes/opentelemetry/trace/default_span.h:21
nostd::shared_ptr
Provide a type-erased version of std::shared_ptr that has ABI stability.
Definition:
includes/opentelemetry/nostd/shared_ptr.h:28
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition:
includes/opentelemetry/version.h:21
trace::IsRootSpan
bool IsRootSpan(const context::Context &context) noexcept
Definition:
includes/opentelemetry/trace/context.h:26
context
Definition:
includes/opentelemetry/context/context.h:16
trace::GetSpan
nostd::shared_ptr< Span > GetSpan(const context::Context &context) noexcept
Definition:
includes/opentelemetry/trace/context.h:16
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition:
includes/opentelemetry/version.h:24
context::Context
Definition:
includes/opentelemetry/context/context.h:23
trace::kSpanKey
constexpr char kSpanKey[]
Definition:
includes/opentelemetry/trace/span_metadata.h:23
nostd::holds_alternative
constexpr bool holds_alternative(const variant< Ts... > &v) noexcept
Definition:
includes/opentelemetry/std/variant.h:218
trace::kIsRootSpanKey
constexpr char kIsRootSpanKey[]
Definition:
includes/opentelemetry/trace/span_metadata.h:24
trace::SpanContext::GetInvalid
static SpanContext GetInvalid() noexcept
Definition:
includes/opentelemetry/trace/span_context.h:86
Privacy Policy
|
Your Privacy Choices
|
Terms of Service
|
Accessibility
|
Corporate Policies
|
Product Security
|
Contact
© 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
NVIDIA Confidential | Subject to Change | For test and development only.
Wed Oct 28 2026 12:02:01 | PR-09318-R32