Class: Foam::Otel::StampLogRecordProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/foam/otel/stamps.rb

Instance Method Summary collapse

Instance Method Details

#force_flush(timeout: nil) ⇒ Object



75
76
77
# File 'lib/foam/otel/stamps.rb', line 75

def force_flush(timeout: nil)
  OpenTelemetry::SDK::Logs::Export::SUCCESS
end

#on_emit(log_record, context) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/foam/otel/stamps.rb', line 61

def on_emit(log_record, context)
  attributes = log_record.attributes ||= {}
  added = 0
  Stamping.candidates(context).each do |key, value|
    next unless attributes[key].nil?

    attributes[key] = value
    added += 1
  end
  sync_recorded_count(log_record, added)
rescue StandardError
  nil
end

#shutdown(timeout: nil) ⇒ Object



79
80
81
# File 'lib/foam/otel/stamps.rb', line 79

def shutdown(timeout: nil)
  OpenTelemetry::SDK::Logs::Export::SUCCESS
end