Class: Foam::Otel::Ingest::LogRecordProcessor
- Inherits:
-
Object
- Object
- Foam::Otel::Ingest::LogRecordProcessor
- Includes:
- DoubleClaim
- Defined in:
- lib/foam/otel/ingest.rb
Instance Method Summary collapse
- #force_flush(timeout: nil) ⇒ Object
-
#initialize(batch, config) ⇒ LogRecordProcessor
constructor
A new instance of LogRecordProcessor.
- #on_emit(log_record, context) ⇒ Object
- #shutdown(timeout: nil) ⇒ Object
Constructor Details
#initialize(batch, config) ⇒ LogRecordProcessor
Returns a new instance of LogRecordProcessor.
473 474 475 476 477 478 479 480 481 |
# File 'lib/foam/otel/ingest.rb', line 473 def initialize(batch, config) @batch = batch @config = config @signal = :logs @claim_mutex = Mutex.new @claim_checked = false @double_claim_warned = false @stood_down = false end |
Instance Method Details
#force_flush(timeout: nil) ⇒ Object
492 493 494 495 496 497 498 |
# File 'lib/foam/otel/ingest.rb', line 492 def force_flush(timeout: nil) return EXPORT_SUCCESS if @stood_down @batch.force_flush(timeout: timeout) rescue StandardError, SystemStackError EXPORT_FAILURE end |
#on_emit(log_record, context) ⇒ Object
483 484 485 486 487 488 489 490 |
# File 'lib/foam/otel/ingest.rb', line 483 def on_emit(log_record, context) return unless admit?(log_record.resource) @batch.on_emit(log_record, context) nil rescue StandardError, SystemStackError nil end |
#shutdown(timeout: nil) ⇒ Object
500 501 502 503 504 505 506 |
# File 'lib/foam/otel/ingest.rb', line 500 def shutdown(timeout: nil) return EXPORT_SUCCESS if @stood_down @batch.shutdown(timeout: timeout) rescue StandardError, SystemStackError EXPORT_FAILURE end |