NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/trace/tracer_provider.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/common/key_value_iterable.h"
7 #include "opentelemetry/common/key_value_iterable_view.h"
8 #include "opentelemetry/nostd/shared_ptr.h"
9 #include "opentelemetry/nostd/string_view.h"
10 #include "opentelemetry/version.h"
11 
13 namespace trace
14 {
15 
16 class Tracer;
17 
22 {
23 public:
24  virtual ~TracerProvider() = default;
25 
26 #if OPENTELEMETRY_ABI_VERSION_NO >= 2
27 
38  virtual nostd::shared_ptr<Tracer> GetTracer(
39  nostd::string_view name,
41  nostd::string_view schema_url,
42  const common::KeyValueIterable *attributes) noexcept = 0;
43 
55  nostd::string_view schema_url = "")
56  {
57  return GetTracer(name, version, schema_url, nullptr);
58  }
59 
70  nostd::shared_ptr<Tracer> GetTracer(
71  nostd::string_view name,
73  nostd::string_view schema_url,
74  std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes)
75  {
76  /* Build a container from std::initializer_list. */
78  attributes.begin(), attributes.end()};
79 
80  /* Build a view on the container. */
83  iterable_attributes{attributes_span};
84 
85  /* Add attributes using the view. */
86  return GetTracer(name, version, schema_url, &iterable_attributes);
87  }
88 
99  template <class T,
103  nostd::string_view schema_url,
104  const T &attributes)
105  {
106  /* Build a view on the container. */
107  common::KeyValueIterableView<T> iterable_attributes(attributes);
108 
109  /* Add attributes using the view. */
110  return GetTracer(name, version, schema_url, &iterable_attributes);
111  }
112 
113 #else
114 
121  virtual nostd::shared_ptr<Tracer> GetTracer(nostd::string_view name,
123  nostd::string_view schema_url = "") noexcept = 0;
124 #endif
125 };
126 } // namespace trace
trace
Definition: includes/opentelemetry/context/context_value.h:18
OPENTELEMETRY_EXPORT
#define OPENTELEMETRY_EXPORT
Definition: includes/opentelemetry/common/macros.h:386
nostd::shared_ptr
Provide a type-erased version of std::shared_ptr that has ABI stability.
Definition: includes/opentelemetry/nostd/shared_ptr.h:28
version
int version
Definition: sources/libs/nvll_batch_jpeg_encode/oss/jpeglib.h:908
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
nostd::span
Back port of std::span.
Definition: includes/opentelemetry/nostd/span.h:51
trace::TracerProvider
Creates new Tracer instances.
Definition: includes/opentelemetry/trace/tracer_provider.h:21
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
common::KeyValueIterable
Supports internal iteration over a collection of key-value pairs.
Definition: includes/opentelemetry/common/key_value_iterable.h:17
nostd::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Back port of std::enable_if_t.
Definition: includes/opentelemetry/nostd/type_traits.h:40
common::KeyValueIterableView
Container for key-value pairs that can transform every value in it to one of types listed in common::...
Definition: includes/opentelemetry/common/key_value_iterable_view.h:57
nostd::string_view
Back port of std::string_view to work with pre-cpp-17 compilers.
Definition: includes/opentelemetry/nostd/string_view.h:37