NVIDIA DeepStream SDK API Reference

9.2 Release
sdk::logs::BatchLogRecordProcessor Class Reference

Detailed Description

This is an implementation of the LogRecordProcessor which creates batches of finished logs and passes the export-friendly log data representations to the configured LogRecordExporter.

Definition at line 34 of file includes/opentelemetry/sdk/logs/batch_log_record_processor.h.

Inheritance diagram for sdk::logs::BatchLogRecordProcessor:
Collaboration diagram for sdk::logs::BatchLogRecordProcessor:

Data Structures

struct  SynchronizationData
 

Public Member Functions

 BatchLogRecordProcessor (std::unique_ptr< LogRecordExporter > &&exporter, const size_t max_queue_size=2048, const std::chrono::milliseconds scheduled_delay_millis=std::chrono::milliseconds(5000), const size_t max_export_batch_size=512)
 Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs. More...
 
 BatchLogRecordProcessor (std::unique_ptr< LogRecordExporter > &&exporter, const BatchLogRecordProcessorOptions &options)
 Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs. More...
 
 BatchLogRecordProcessor (std::unique_ptr< LogRecordExporter > &&exporter, const BatchLogRecordProcessorOptions &options, const BatchLogRecordProcessorRuntimeOptions &runtime_options)
 Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs. More...
 
std::unique_ptr< Recordable > MakeRecordable () noexcept override
 Makes a new recordable. More...
 
void OnEmit (std::unique_ptr< Recordable > &&record) noexcept override
 Called when the Logger's log method creates a log record. More...
 
bool ForceFlush (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept override
 Export all log records that have not been exported yet. More...
 
bool Shutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept override
 Shuts down the processor and does any cleanup required. More...
 
 ~BatchLogRecordProcessor () override
 Class destructor which invokes the Shutdown() method. More...
 
 BatchLogRecordProcessor (std::unique_ptr< LogRecordExporter > &&exporter, const size_t max_queue_size=2048, const std::chrono::milliseconds scheduled_delay_millis=std::chrono::milliseconds(5000), const size_t max_export_batch_size=512)
 Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs. More...
 
 BatchLogRecordProcessor (std::unique_ptr< LogRecordExporter > &&exporter, const BatchLogRecordProcessorOptions &options)
 Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs. More...
 
 BatchLogRecordProcessor (std::unique_ptr< LogRecordExporter > &&exporter, const BatchLogRecordProcessorOptions &options, const BatchLogRecordProcessorRuntimeOptions &runtime_options)
 Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs. More...
 
std::unique_ptr< Recordable > MakeRecordable () noexcept override
 Makes a new recordable. More...
 
void OnEmit (std::unique_ptr< Recordable > &&record) noexcept override
 Called when the Logger's log method creates a log record. More...
 
bool ForceFlush (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept override
 Export all log records that have not been exported yet. More...
 
bool Shutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept override
 Shuts down the processor and does any cleanup required. More...
 
 ~BatchLogRecordProcessor () override
 Class destructor which invokes the Shutdown() method. More...
 

Protected Member Functions

bool InternalShutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Shuts down the processor and does any cleanup required. More...
 
void DoBackgroundWork ()
 The background routine performed by the worker thread. More...
 
virtual void Export ()
 Exports all logs to the configured exporter. More...
 
void DrainQueue ()
 Called when Shutdown() is invoked. More...
 
void GetWaitAdjustedTime (std::chrono::microseconds &timeout, std::chrono::time_point< std::chrono::system_clock > &start_time)
 
bool InternalShutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Shuts down the processor and does any cleanup required. More...
 
void DoBackgroundWork ()
 The background routine performed by the worker thread. More...
 
virtual void Export ()
 Exports all logs to the configured exporter. More...
 
void DrainQueue ()
 Called when Shutdown() is invoked. More...
 
void GetWaitAdjustedTime (std::chrono::microseconds &timeout, std::chrono::time_point< std::chrono::system_clock > &start_time)
 

Static Protected Member Functions

static void NotifyCompletion (uint64_t notify_force_flush, const std::unique_ptr< LogRecordExporter > &exporter, const std::shared_ptr< SynchronizationData > &synchronization_data)
 Notify completion of shutdown and force flush. More...
 
static void NotifyCompletion (uint64_t notify_force_flush, const std::unique_ptr< LogRecordExporter > &exporter, const std::shared_ptr< SynchronizationData > &synchronization_data)
 Notify completion of shutdown and force flush. More...
 

Protected Attributes

std::unique_ptr< LogRecordExporter > exporter_
 
const size_t max_queue_size_
 
const std::chrono::milliseconds scheduled_delay_millis_
 
const size_t max_export_batch_size_
 
opentelemetry::sdk::common::CircularBuffer< Recordable > buffer_
 
std::shared_ptr< SynchronizationData > synchronization_data_
 
std::shared_ptr< sdk::common::ThreadInstrumentation > worker_thread_instrumentation_
 
std::thread worker_thread_
 

Constructor & Destructor Documentation

◆ BatchLogRecordProcessor() [1/6]

sdk::logs::BatchLogRecordProcessor::BatchLogRecordProcessor ( std::unique_ptr< LogRecordExporter > &&  exporter,
const size_t  max_queue_size = 2048,
const std::chrono::milliseconds  scheduled_delay_millis = std::chrono::milliseconds(5000),
const size_t  max_export_batch_size = 512 
)
explicit

Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs.

Parameters
exporter- The backend exporter to pass the logs to
max_queue_size- The maximum buffer/queue size. After the size is reached, logs are dropped.
scheduled_delay_millis- The time interval between two consecutive exports.
max_export_batch_size- The maximum batch size of every export. It must be smaller or equal to max_queue_size

◆ BatchLogRecordProcessor() [2/6]

sdk::logs::BatchLogRecordProcessor::BatchLogRecordProcessor ( std::unique_ptr< LogRecordExporter > &&  exporter,
const BatchLogRecordProcessorOptions &  options 
)
explicit

Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs.

Parameters
exporterThe backend exporter to pass the logs to
optionsThe batch SpanProcessor configuration options.

◆ BatchLogRecordProcessor() [3/6]

sdk::logs::BatchLogRecordProcessor::BatchLogRecordProcessor ( std::unique_ptr< LogRecordExporter > &&  exporter,
const BatchLogRecordProcessorOptions &  options,
const BatchLogRecordProcessorRuntimeOptions &  runtime_options 
)
explicit

Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs.

Parameters
exporterThe backend exporter to pass the logs to
optionsThe batch SpanProcessor configuration options.
runtime_optionsThe batch SpanProcessor runtime options.

◆ ~BatchLogRecordProcessor() [1/2]

sdk::logs::BatchLogRecordProcessor::~BatchLogRecordProcessor ( )
override

Class destructor which invokes the Shutdown() method.

◆ BatchLogRecordProcessor() [4/6]

sdk::logs::BatchLogRecordProcessor::BatchLogRecordProcessor ( std::unique_ptr< LogRecordExporter > &&  exporter,
const size_t  max_queue_size = 2048,
const std::chrono::milliseconds  scheduled_delay_millis = std::chrono::milliseconds(5000),
const size_t  max_export_batch_size = 512 
)
explicit

Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs.

Parameters
exporter- The backend exporter to pass the logs to
max_queue_size- The maximum buffer/queue size. After the size is reached, logs are dropped.
scheduled_delay_millis- The time interval between two consecutive exports.
max_export_batch_size- The maximum batch size of every export. It must be smaller or equal to max_queue_size

◆ BatchLogRecordProcessor() [5/6]

sdk::logs::BatchLogRecordProcessor::BatchLogRecordProcessor ( std::unique_ptr< LogRecordExporter > &&  exporter,
const BatchLogRecordProcessorOptions &  options 
)
explicit

Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs.

Parameters
exporterThe backend exporter to pass the logs to
optionsThe batch SpanProcessor configuration options.

◆ BatchLogRecordProcessor() [6/6]

sdk::logs::BatchLogRecordProcessor::BatchLogRecordProcessor ( std::unique_ptr< LogRecordExporter > &&  exporter,
const BatchLogRecordProcessorOptions &  options,
const BatchLogRecordProcessorRuntimeOptions &  runtime_options 
)
explicit

Creates a batch log processor by configuring the specified exporter and other parameters as per the official, language-agnostic opentelemetry specs.

Parameters
exporterThe backend exporter to pass the logs to
optionsThe batch SpanProcessor configuration options.
runtime_optionsThe batch SpanProcessor runtime options.

◆ ~BatchLogRecordProcessor() [2/2]

sdk::logs::BatchLogRecordProcessor::~BatchLogRecordProcessor ( )
override

Class destructor which invokes the Shutdown() method.

Member Function Documentation

◆ DoBackgroundWork() [1/2]

void sdk::logs::BatchLogRecordProcessor::DoBackgroundWork ( )
protected

The background routine performed by the worker thread.

◆ DoBackgroundWork() [2/2]

void sdk::logs::BatchLogRecordProcessor::DoBackgroundWork ( )
protected

The background routine performed by the worker thread.

◆ DrainQueue() [1/2]

void sdk::logs::BatchLogRecordProcessor::DrainQueue ( )
protected

Called when Shutdown() is invoked.

Completely drains the queue of all log records and passes them to the exporter.

◆ DrainQueue() [2/2]

void sdk::logs::BatchLogRecordProcessor::DrainQueue ( )
protected

Called when Shutdown() is invoked.

Completely drains the queue of all log records and passes them to the exporter.

◆ Export() [1/2]

virtual void sdk::logs::BatchLogRecordProcessor::Export ( )
protectedvirtual

Exports all logs to the configured exporter.

◆ Export() [2/2]

virtual void sdk::logs::BatchLogRecordProcessor::Export ( )
protectedvirtual

Exports all logs to the configured exporter.

◆ ForceFlush() [1/2]

bool sdk::logs::BatchLogRecordProcessor::ForceFlush ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
overridevirtualnoexcept

Export all log records that have not been exported yet.

NOTE: Timeout functionality not supported yet.

Implements sdk::logs::LogRecordProcessor.

◆ ForceFlush() [2/2]

bool sdk::logs::BatchLogRecordProcessor::ForceFlush ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
overridevirtualnoexcept

Export all log records that have not been exported yet.

NOTE: Timeout functionality not supported yet.

Implements sdk::logs::LogRecordProcessor.

◆ GetWaitAdjustedTime() [1/2]

void sdk::logs::BatchLogRecordProcessor::GetWaitAdjustedTime ( std::chrono::microseconds &  timeout,
std::chrono::time_point< std::chrono::system_clock > &  start_time 
)
protected

◆ GetWaitAdjustedTime() [2/2]

void sdk::logs::BatchLogRecordProcessor::GetWaitAdjustedTime ( std::chrono::microseconds &  timeout,
std::chrono::time_point< std::chrono::system_clock > &  start_time 
)
protected

◆ InternalShutdown() [1/2]

bool sdk::logs::BatchLogRecordProcessor::InternalShutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
protectednoexcept

Shuts down the processor and does any cleanup required.

Completely drains the buffer/queue of all its logs and passes them to the exporter.

◆ InternalShutdown() [2/2]

bool sdk::logs::BatchLogRecordProcessor::InternalShutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
protectednoexcept

Shuts down the processor and does any cleanup required.

Completely drains the buffer/queue of all its logs and passes them to the exporter.

◆ MakeRecordable() [1/2]

std::unique_ptr<Recordable> sdk::logs::BatchLogRecordProcessor::MakeRecordable ( )
overridevirtualnoexcept

Makes a new recordable.

Implements sdk::logs::LogRecordProcessor.

◆ MakeRecordable() [2/2]

std::unique_ptr<Recordable> sdk::logs::BatchLogRecordProcessor::MakeRecordable ( )
overridevirtualnoexcept

Makes a new recordable.

Implements sdk::logs::LogRecordProcessor.

◆ NotifyCompletion() [1/2]

static void sdk::logs::BatchLogRecordProcessor::NotifyCompletion ( uint64_t  notify_force_flush,
const std::unique_ptr< LogRecordExporter > &  exporter,
const std::shared_ptr< SynchronizationData > &  synchronization_data 
)
staticprotected

Notify completion of shutdown and force flush.

This may be called from the any thread at any time

Parameters
notify_force_flushSequence to indicate whether to notify force flush completion.
synchronization_dataSynchronization data to be notified.

◆ NotifyCompletion() [2/2]

static void sdk::logs::BatchLogRecordProcessor::NotifyCompletion ( uint64_t  notify_force_flush,
const std::unique_ptr< LogRecordExporter > &  exporter,
const std::shared_ptr< SynchronizationData > &  synchronization_data 
)
staticprotected

Notify completion of shutdown and force flush.

This may be called from the any thread at any time

Parameters
notify_force_flushSequence to indicate whether to notify force flush completion.
synchronization_dataSynchronization data to be notified.

◆ OnEmit() [1/2]

void sdk::logs::BatchLogRecordProcessor::OnEmit ( std::unique_ptr< Recordable > &&  record)
overridevirtualnoexcept

Called when the Logger's log method creates a log record.

Parameters
recordthe log record

Implements sdk::logs::LogRecordProcessor.

◆ OnEmit() [2/2]

void sdk::logs::BatchLogRecordProcessor::OnEmit ( std::unique_ptr< Recordable > &&  record)
overridevirtualnoexcept

Called when the Logger's log method creates a log record.

Parameters
recordthe log record

Implements sdk::logs::LogRecordProcessor.

◆ Shutdown() [1/2]

bool sdk::logs::BatchLogRecordProcessor::Shutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
overridevirtualnoexcept

Shuts down the processor and does any cleanup required.

Completely drains the buffer/queue of all its logs and passes them to the exporter.

Parameters
timeoutminimum amount of microseconds to wait for shutdown before giving up and returning failure.
Returns
true if the shutdown succeeded, false otherwise

Implements sdk::logs::LogRecordProcessor.

◆ Shutdown() [2/2]

bool sdk::logs::BatchLogRecordProcessor::Shutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
overridevirtualnoexcept

Shuts down the processor and does any cleanup required.

Completely drains the buffer/queue of all its logs and passes them to the exporter.

Parameters
timeoutminimum amount of microseconds to wait for shutdown before giving up and returning failure.
Returns
true if the shutdown succeeded, false otherwise

Implements sdk::logs::LogRecordProcessor.

Field Documentation

◆ buffer_

opentelemetry::sdk::common::CircularBuffer< Recordable > sdk::logs::BatchLogRecordProcessor::buffer_
protected

◆ exporter_

std::unique_ptr< LogRecordExporter > sdk::logs::BatchLogRecordProcessor::exporter_
protected

◆ max_export_batch_size_

const size_t sdk::logs::BatchLogRecordProcessor::max_export_batch_size_
protected

◆ max_queue_size_

const size_t sdk::logs::BatchLogRecordProcessor::max_queue_size_
protected

◆ scheduled_delay_millis_

const std::chrono::milliseconds sdk::logs::BatchLogRecordProcessor::scheduled_delay_millis_
protected

◆ synchronization_data_

std::shared_ptr< SynchronizationData > sdk::logs::BatchLogRecordProcessor::synchronization_data_
protected

◆ worker_thread_

std::thread sdk::logs::BatchLogRecordProcessor::worker_thread_
protected

◆ worker_thread_instrumentation_

std::shared_ptr< sdk::common::ThreadInstrumentation > sdk::logs::BatchLogRecordProcessor::worker_thread_instrumentation_
protected

The documentation for this class was generated from the following file: