NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/sdk/logs/logger_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 <chrono>
7 #include <memory>
8 #include <vector>
9 
10 #include "logger_config.h"
11 #include "opentelemetry/sdk/instrumentationscope/scope_configurator.h"
12 #include "opentelemetry/sdk/logs/processor.h"
13 #include "opentelemetry/sdk/resource/resource.h"
14 #include "opentelemetry/version.h"
15 
17 namespace sdk
18 {
19 namespace logs
20 {
21 
36 {
37 public:
38  explicit LoggerContext(
39  std::vector<std::unique_ptr<LogRecordProcessor>> &&processors,
40  const opentelemetry::sdk::resource::Resource &resource =
41  opentelemetry::sdk::resource::Resource::Create({}),
46  .Build())) noexcept;
47 
56  void AddProcessor(std::unique_ptr<LogRecordProcessor> processor) noexcept;
57 
64  LogRecordProcessor &GetProcessor() const noexcept;
65 
70  const opentelemetry::sdk::resource::Resource &GetResource() const noexcept;
71 
77  const noexcept;
78 
83  bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
84 
88  bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
89 
90 private:
91  // order of declaration is important here - resource object should be destroyed after processor.
92  opentelemetry::sdk::resource::Resource resource_;
93  std::unique_ptr<LogRecordProcessor> processor_;
94 
95  std::unique_ptr<instrumentationscope::ScopeConfigurator<LoggerConfig>> logger_configurator_;
96 };
97 } // namespace logs
98 } // namespace sdk
99 
nostd::unique_ptr
std::unique_ptr< _Types... > unique_ptr
Definition: includes/opentelemetry/std/unique_ptr.h:19
prometheus::detail::make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: includes/prometheus/detail/future_std.h:28
sdk::logs::LoggerContext::ForceFlush
bool ForceFlush(std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
Force all active LogProcessors to flush any buffered logs within the given timeout.
sdk::logs::LoggerContext::GetLoggerConfigurator
const instrumentationscope::ScopeConfigurator< LoggerConfig > & GetLoggerConfigurator() const noexcept
Obtain the ScopeConfigurator with this logger context.
logs
Definition: includes/opentelemetry/logs/event_id.h:13
logger_config.h
sdk::logs::LoggerContext
A class which stores the LoggerContext context.
Definition: includes/opentelemetry/sdk/logs/logger_context.h:35
sdk::logs::LoggerContext::Shutdown
bool Shutdown(std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
Shutdown the log processor associated with this tracer provider.
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
sdk::logs::LoggerContext::LoggerContext
LoggerContext(std::vector< std::unique_ptr< LogRecordProcessor >> &&processors, const opentelemetry::sdk::resource::Resource &resource=opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr< instrumentationscope::ScopeConfigurator< LoggerConfig >> logger_configurator=std::make_unique< instrumentationscope::ScopeConfigurator< LoggerConfig >>(instrumentationscope::ScopeConfigurator< LoggerConfig >::Builder(LoggerConfig::Default()) .Build())) noexcept
max
int max(int a, int b)
Compute the component-wise maximum.
Definition: sources/libs/nvmultiobjecttracker/include/modules/cuDCFv2/helper_math.h:60
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
sdk::instrumentationscope::ScopeConfigurator::Builder
A builder class for the ScopeConfigurator that facilitates the creation of ScopeConfigurators.
Definition: includes/opentelemetry/sdk/instrumentationscope/scope_configurator.h:26
sdk::logs::LoggerContext::GetResource
const opentelemetry::sdk::resource::Resource & GetResource() const noexcept
Obtain the resource associated with this tracer context.
sdk::instrumentationscope::ScopeConfigurator
A scope configurator is a function that returns the scope config for a given instrumentation scope.
Definition: includes/opentelemetry/sdk/instrumentationscope/scope_configurator.h:20
sdk::logs::LoggerContext::GetProcessor
LogRecordProcessor & GetProcessor() const noexcept
Obtain the configured (composite) processor.
sdk::logs::LoggerContext::AddProcessor
void AddProcessor(std::unique_ptr< LogRecordProcessor > processor) noexcept
Attaches a log processor to list of configured processors to this logger context.
sdk::logs::LoggerConfig::Default
static LoggerConfig Default()
Returns a LoggerConfig that represents a Logger configured with the default behavior.
sdk
Definition: includes/opentelemetry/sdk/common/atomic_shared_ptr.h:13
sdk::logs::LogRecordProcessor
The Log Processor is responsible for passing log records to the configured exporter.
Definition: includes/opentelemetry/sdk/logs/processor.h:22