Class: OpenTelemetry::SDK::Logs::Export::InMemoryLogRecordExporter
- Inherits:
-
Object
- Object
- OpenTelemetry::SDK::Logs::Export::InMemoryLogRecordExporter
- Defined in:
- lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb
Overview
refute_nil(log_records) assert_equal(1, log_records.size) assert_equal(log_records.body, 'log') end end
Instance Method Summary collapse
-
#emitted_log_records ⇒ Array<LogRecordData>
Returns a frozen array of the emitted LogRecordDatas, represented by ioio.opentelemetryio.opentelemetry.protoio.opentelemetry.proto.traceio.opentelemetry.proto.trace.v1io.opentelemetry.proto.trace.v1.LogRecord.
-
#export(log_record_datas, timeout: nil) ⇒ Integer
Called to export LogRecordDatas.
-
#force_flush(timeout: nil) ⇒ Integer
Called when LoggerProvider#force_flush is called, if this exporter is registered to a LoggerProvider object.
-
#initialize ⇒ Object
constructor
Returns a new instance of the InMemoryLogRecordExporter.
-
#reset ⇒ Object
Clears the internal collection of emitted LogRecords.
-
#shutdown(timeout: nil) ⇒ Integer
Called when LoggerProvider#shutdown is called, if this exporter is registered to a LoggerProvider object.
Constructor Details
#initialize ⇒ Object
Returns a new instance of the OpenTelemetry::SDK::Logs::Export::InMemoryLogRecordExporter.
36 37 38 39 40 |
# File 'lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb', line 36 def initialize @emitted_log_records = [] @stopped = false @mutex = Mutex.new end |
Instance Method Details
#emitted_log_records ⇒ Array<LogRecordData>
Returns a frozen array of the emitted LogRecordDatas, represented by OpenTelemetry::SDK::Logs::Export::InMemoryLogRecordExporter.ioio.opentelemetryio.opentelemetry.protoio.opentelemetry.proto.traceio.opentelemetry.proto.trace.v1io.opentelemetry.proto.trace.v1.LogRecord.
46 47 48 49 50 |
# File 'lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb', line 46 def emitted_log_records @mutex.synchronize do @emitted_log_records.clone.freeze end end |
#export(log_record_datas, timeout: nil) ⇒ Integer
Called to export LogRecordDatas.
68 69 70 71 72 73 74 75 |
# File 'lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb', line 68 def export(log_record_datas, timeout: nil) @mutex.synchronize do return FAILURE if @stopped @emitted_log_records.concat(log_record_datas.to_a) end SUCCESS end |
#force_flush(timeout: nil) ⇒ Integer
Called when LoggerProvider#force_flush is called, if this exporter is registered to a LoggerProvider object.
83 84 85 |
# File 'lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb', line 83 def force_flush(timeout: nil) SUCCESS end |
#reset ⇒ Object
Clears the internal collection of emitted LogRecords.
Does not reset the state of this exporter if already shutdown.
55 56 57 58 59 |
# File 'lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb', line 55 def reset @mutex.synchronize do @emitted_log_records.clear end end |
#shutdown(timeout: nil) ⇒ Integer
Called when LoggerProvider#shutdown is called, if this exporter is registered to a LoggerProvider object.
93 94 95 96 97 98 99 |
# File 'lib/opentelemetry/sdk/logs/export/in_memory_log_record_exporter.rb', line 93 def shutdown(timeout: nil) @mutex.synchronize do @emitted_log_records.clear @stopped = true end SUCCESS end |