Class: Foam::Otel::RedactingLogRecordExporter
- Inherits:
-
Object
- Object
- Foam::Otel::RedactingLogRecordExporter
- Defined in:
- lib/foam/otel/redacting_exporter.rb
Instance Method Summary collapse
- #export(log_record_data, timeout: nil) ⇒ Object
- #force_flush(timeout: nil) ⇒ Object
-
#initialize(inner, config) ⇒ RedactingLogRecordExporter
constructor
A new instance of RedactingLogRecordExporter.
- #shutdown(timeout: nil) ⇒ Object
Constructor Details
#initialize(inner, config) ⇒ RedactingLogRecordExporter
Returns a new instance of RedactingLogRecordExporter.
69 70 71 72 |
# File 'lib/foam/otel/redacting_exporter.rb', line 69 def initialize(inner, config) @inner = inner @config = config end |
Instance Method Details
#export(log_record_data, timeout: nil) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/foam/otel/redacting_exporter.rb', line 74 def export(log_record_data, timeout: nil) batch = log_record_data.to_a masked = batch.filter_map { |lrd| Redaction.mask_log_record_data(lrd, @config) } dropped = batch.length - masked.length if dropped.positive? Diagnostics.warn("redaction failed for #{dropped} log record(s) — dropped rather than " \ "exported unmasked (rule 14 fail-closed)") @inner.export(masked, timeout: timeout) unless masked.empty? return OpenTelemetry::SDK::Logs::Export::FAILURE end @inner.export(masked, timeout: timeout) rescue StandardError, SystemStackError Diagnostics.warn("log redaction raised past its guards — batch dropped (fail-closed, rule 14/15)") OpenTelemetry::SDK::Logs::Export::FAILURE end |
#force_flush(timeout: nil) ⇒ Object
90 |
# File 'lib/foam/otel/redacting_exporter.rb', line 90 def force_flush(timeout: nil) = @inner.force_flush(timeout: timeout) |
#shutdown(timeout: nil) ⇒ Object
91 |
# File 'lib/foam/otel/redacting_exporter.rb', line 91 def shutdown(timeout: nil) = @inner.shutdown(timeout: timeout) |