Class: Foam::Otel::MaskedLogRecordView

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

Overview

The logs twin: on_emit receives the LIVE record, so the view masks attributes and body lazily through the same engine (floor + customer keys), fail-closed — a read that cannot be masked degrades to the mask, never the raw value. Reads happen AFTER foam's earlier processors (export buffer, session stitching) ran, so the tenant misses nothing.

Instance Method Summary collapse

Constructor Details

#initialize(record, config) ⇒ MaskedLogRecordView

Returns a new instance of MaskedLogRecordView.



228
229
230
231
# File 'lib/foam/otel/pipelines.rb', line 228

def initialize(record, config)
  super(record)
  @config = config
end

Instance Method Details

#attributesObject



233
234
235
236
237
238
239
# File 'lib/foam/otel/pipelines.rb', line 233

def attributes
  @attributes ||= begin
    Foam::Otel::Redaction.mask_attributes(__getobj__.attributes, @config)
  rescue StandardError, SystemStackError
    {} # fail closed: never the raw attributes
  end
end

#bodyObject



241
242
243
244
245
246
247
# File 'lib/foam/otel/pipelines.rb', line 241

def body
  @body ||= begin
    Foam::Otel::Redaction.mask_body(__getobj__.body, @config)
  rescue StandardError, SystemStackError
    Foam::Otel::REDACTED # fail closed: never the raw body
  end
end