|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
11 #include "opentelemetry/common/spin_lock_mutex.h"
12 #include "opentelemetry/common/timestamp.h"
13 #include "opentelemetry/nostd/function_ref.h"
14 #include "opentelemetry/nostd/span.h"
15 #include "opentelemetry/nostd/string_view.h"
16 #include "opentelemetry/sdk/instrumentationscope/scope_configurator.h"
17 #include "opentelemetry/sdk/metrics/export/metric_filter.h"
18 #include "opentelemetry/sdk/metrics/meter_config.h"
19 #include "opentelemetry/sdk/metrics/metric_reader.h"
20 #include "opentelemetry/sdk/metrics/state/metric_collector.h"
21 #include "opentelemetry/sdk/metrics/view/instrument_selector.h"
22 #include "opentelemetry/sdk/metrics/view/meter_selector.h"
23 #include "opentelemetry/sdk/metrics/view/view.h"
24 #include "opentelemetry/sdk/metrics/view/view_registry.h"
25 #include "opentelemetry/sdk/resource/resource.h"
26 #include "opentelemetry/version.h"
28 #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
29 # include "opentelemetry/sdk/metrics/exemplar/filter_type.h"
34 class MetricCollectorTest;
44 class CollectorHandle;
45 class InstrumentSelector;
54 class MeterContext :
public std::enable_shared_from_this<MeterContext>
63 std::unique_ptr<ViewRegistry> views = std::unique_ptr<ViewRegistry>(
new ViewRegistry()),
64 const opentelemetry::sdk::resource::Resource &resource =
65 opentelemetry::sdk::resource::Resource::Create({}),
75 const opentelemetry::sdk::resource::Resource &
GetResource()
const noexcept;
127 std::unique_ptr<MetricFilter> metric_filter =
nullptr) noexcept;
137 void AddView(std::unique_ptr<InstrumentSelector> instrument_selector,
138 std::unique_ptr<MeterSelector> meter_selector,
139 std::unique_ptr<View> view) noexcept;
141 #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
143 void SetExemplarFilter(ExemplarFilterType exemplar_filter_type) noexcept;
145 ExemplarFilterType GetExemplarFilter()
const noexcept;
155 void AddMeter(
const std::shared_ptr<Meter> &meter);
174 friend class ::testing::MetricCollectorTest;
176 opentelemetry::sdk::resource::Resource resource_;
177 std::vector<std::shared_ptr<CollectorHandle>> collectors_;
178 std::unique_ptr<ViewRegistry> views_;
179 opentelemetry::common::SystemTimestamp sdk_start_ts_;
180 std::unique_ptr<instrumentationscope::ScopeConfigurator<MeterConfig>> meter_configurator_;
181 std::vector<std::shared_ptr<Meter>> meters_;
183 #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
184 metrics::ExemplarFilterType exemplar_filter_type_ = metrics::ExemplarFilterType::kAlwaysOff;
187 #if defined(__cpp_lib_atomic_value_initialization) && \
188 __cpp_lib_atomic_value_initialization >= 201911L
189 std::atomic_flag shutdown_latch_{};
191 std::atomic_flag shutdown_latch_ = ATOMIC_FLAG_INIT;
193 opentelemetry::common::SpinLockMutex forceflush_lock_;
194 opentelemetry::common::SpinLockMutex meter_lock_;
void AddView(std::unique_ptr< InstrumentSelector > instrument_selector, std::unique_ptr< MeterSelector > meter_selector, std::unique_ptr< View > view) noexcept
Attaches a View to list of configured Views for this Meter context.
ViewRegistry * GetViewRegistry() const noexcept
Obtain the View Registry configured.
std::unique_ptr< _Types... > unique_ptr
static MeterConfig Default()
Returns a MeterConfig that represents a Meter configured with the default behavior.
std::unique_ptr< T > make_unique(Args &&... args)
bool ForEachMeter(nostd::function_ref< bool(std::shared_ptr< Meter > &meter)> callback) noexcept
NOTE - INTERNAL method, can change in the future.
nostd::span< std::shared_ptr< Meter > > GetMeters() noexcept
NOTE - INTERNAL method, can change in the future.
void RemoveMeter(nostd::string_view name, nostd::string_view version, nostd::string_view schema_url)
const instrumentationscope::ScopeConfigurator< MeterConfig > & GetMeterConfigurator() const noexcept
Obtain the ScopeConfigurator with this meter context.
A class which stores the MeterProvider context.
#define OPENTELEMETRY_BEGIN_NAMESPACE
MeterContext(std::unique_ptr< ViewRegistry > views=std::unique_ptr< ViewRegistry >(new ViewRegistry()), const opentelemetry::sdk::resource::Resource &resource=opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr< instrumentationscope::ScopeConfigurator< MeterConfig >> meter_configurator=std::make_unique< instrumentationscope::ScopeConfigurator< MeterConfig >>(instrumentationscope::ScopeConfigurator< MeterConfig >::Builder(MeterConfig::Default()) .Build())) noexcept
Initialize a new meter provider.
bool ForceFlush(std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
Force all active Collectors to flush any buffered meter data within the given timeout.
int max(int a, int b)
Compute the component-wise maximum.
#define OPENTELEMETRY_END_NAMESPACE
opentelemetry::common::SystemTimestamp GetSDKStartTime() noexcept
GET SDK Start time.
A builder class for the ScopeConfigurator that facilitates the creation of ScopeConfigurators.
A scope configurator is a function that returns the scope config for a given instrumentation scope.
void AddMetricReader(std::shared_ptr< MetricReader > reader, std::unique_ptr< MetricFilter > metric_filter=nullptr) noexcept
Create a MetricCollector from a MetricReader using this MeterContext and add it to the list of config...
void AddMeter(const std::shared_ptr< Meter > &meter)
NOTE - INTERNAL method, can change in future.
bool Shutdown(std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
Shutdown the Collectors associated with this meter provider.
nostd::span< std::shared_ptr< CollectorHandle > > GetCollectors() noexcept
Obtain the configured collectors.
Back port of std::string_view to work with pre-cpp-17 compilers.
const opentelemetry::sdk::resource::Resource & GetResource() const noexcept
Obtain the resource associated with this meter context.