Class: OpenTelemetry::SDK::Logs::Export::LogRecordExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/logs/export/log_record_exporter.rb

Overview

LogRecordExporter describes a duck type. It is not required to subclass this class to provide an implementation of LogRecordExporter, provided the interface is satisfied. LogRecordExporter allows different tracing services to export log record data in their own format.

To export data an exporter MUST be registered to the LoggerProvider using a LogRecordProcessor implementation.

Instance Method Summary collapse

Constructor Details

#initializeLogRecordExporter

Returns a new instance of LogRecordExporter.



19
20
21
# File 'lib/opentelemetry/sdk/logs/export/log_record_exporter.rb', line 19

def initialize
  @stopped = false
end

Instance Method Details

#export(log_record_data, timeout: nil) ⇒ Integer

Called to export LogRecordDatas.

LogRecordData to be exported.

Parameters:

  • log_record_data (Enumerable<LogRecordData>)

    the list of

  • timeout (optional Numeric) (defaults to: nil)

    An optional timeout in seconds.

Returns:

  • (Integer)

    the result of the export.



30
31
32
33
34
# File 'lib/opentelemetry/sdk/logs/export/log_record_exporter.rb', line 30

def export(log_record_data, timeout: nil)
  return SUCCESS unless @stopped

  FAILURE
end

#force_flush(timeout: nil) ⇒ Integer

Called when LoggerProvider#force_flush is called, if this exporter is registered to a LoggerProvider object.

Parameters:

  • timeout (optional Numeric) (defaults to: nil)

    An optional timeout in seconds.

Returns:

  • (Integer)

    SUCCESS if no error occurred, FAILURE if a non-specific failure occurred, TIMEOUT if a timeout occurred.



42
43
44
# File 'lib/opentelemetry/sdk/logs/export/log_record_exporter.rb', line 42

def force_flush(timeout: nil)
  SUCCESS
end

#shutdown(timeout: nil) ⇒ Object

Called when LoggerProvider#shutdown is called, if this exporter is registered to a LoggerProvider object.

Parameters:

  • timeout (optional Numeric) (defaults to: nil)

    An optional timeout in seconds.



50
51
52
53
# File 'lib/opentelemetry/sdk/logs/export/log_record_exporter.rb', line 50

def shutdown(timeout: nil)
  @stopped = true
  SUCCESS
end