Class: Foam::Otel::Ingest::LogRecordProcessor

Inherits:
Object
  • Object
show all
Includes:
DoubleClaim
Defined in:
lib/foam/otel/ingest.rb

Instance Method Summary collapse

Constructor Details

#initialize(batch, config) ⇒ LogRecordProcessor

Returns a new instance of LogRecordProcessor.



505
506
507
508
509
510
511
512
513
# File 'lib/foam/otel/ingest.rb', line 505

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



524
525
526
527
528
529
530
# File 'lib/foam/otel/ingest.rb', line 524

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



515
516
517
518
519
520
521
522
# File 'lib/foam/otel/ingest.rb', line 515

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



532
533
534
535
536
537
538
# File 'lib/foam/otel/ingest.rb', line 532

def shutdown(timeout: nil)
  return EXPORT_SUCCESS if @stood_down

  @batch.shutdown(timeout: timeout)
rescue StandardError, SystemStackError
  EXPORT_FAILURE
end