NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/metrics/meter_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/nostd/type_traits.h"
11 #include "opentelemetry/version.h"
12 
14 namespace metrics
15 {
16 
17 class Meter;
18 
23 {
24 public:
25  virtual ~MeterProvider() = default;
26 
27 #if OPENTELEMETRY_ABI_VERSION_NO >= 2
28 
40  nostd::string_view name,
42  nostd::string_view schema_url,
43  const common::KeyValueIterable *attributes) noexcept = 0;
44 
56  nostd::string_view schema_url = "")
57  {
58  return GetMeter(name, version, schema_url, nullptr);
59  }
60 
72  nostd::string_view name,
74  nostd::string_view schema_url,
75  std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes)
76  {
77  /* Build a container from std::initializer_list. */
79  attributes.begin(), attributes.end()};
80 
81  /* Build a view on the container. */
84  iterable_attributes{attributes_span};
85 
86  /* Add attributes using the view. */
87  return GetMeter(name, version, schema_url, &iterable_attributes);
88  }
89 
100  template <class T,
104  nostd::string_view schema_url,
105  const T &attributes)
106  {
107  /* Build a view on the container. */
108  common::KeyValueIterableView<T> iterable_attributes(attributes);
109 
110  /* Add attributes using the view. */
111  return GetMeter(name, version, schema_url, &iterable_attributes);
112  }
113 
114 #else
115 
126  nostd::string_view schema_url = "") noexcept = 0;
127 #endif
128 
129 #if OPENTELEMETRY_ABI_VERSION_NO >= 2
130 
142  virtual void RemoveMeter(nostd::string_view name,
144  nostd::string_view schema_url = "") noexcept = 0;
145 #endif
146 };
147 } // namespace metrics
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
metrics::MeterProvider::GetMeter
virtual nostd::shared_ptr< Meter > GetMeter(nostd::string_view name, nostd::string_view version="", nostd::string_view schema_url="") noexcept=0
Gets or creates a named Meter instance (ABI)
metrics::MeterProvider::~MeterProvider
virtual ~MeterProvider()=default
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
metrics
Definition: includes/opentelemetry/metrics/async_instruments.h:10
metrics::MeterProvider
Creates new Meter instances.
Definition: includes/opentelemetry/metrics/meter_provider.h:22
nostd::string_view
Back port of std::string_view to work with pre-cpp-17 compilers.
Definition: includes/opentelemetry/nostd/string_view.h:37