Class: Foam::Otel::GuardedSpanProcessor
- Inherits:
-
Object
- Object
- Foam::Otel::GuardedSpanProcessor
- Defined in:
- lib/foam/otel/pipelines.rb
Overview
A tenant span/log processor supplied via additional_* — wrapped so a throwing tenant instance is skipped with a loud warning and breaks neither the app nor foam's export (rule 18 C / rule 9). Never-throw is foam's guarantee for foam-invoked calls; the wrapper enforces it. The wrapper is ALSO the tenant seam's masking point: on_finish/on_emit hand the tenant the masked view above, never the raw item (credential floor, capture-time clause — tenants only ever see the masked view).
Instance Method Summary collapse
- #force_flush(timeout: nil) ⇒ Object
-
#initialize(inner, config = nil) ⇒ GuardedSpanProcessor
constructor
A new instance of GuardedSpanProcessor.
- #on_finish(span) ⇒ Object
- #on_start(span, context) ⇒ Object
- #shutdown(timeout: nil) ⇒ Object
Constructor Details
#initialize(inner, config = nil) ⇒ GuardedSpanProcessor
Returns a new instance of GuardedSpanProcessor.
230 231 232 233 |
# File 'lib/foam/otel/pipelines.rb', line 230 def initialize(inner, config = nil) @inner = inner @config = config end |
Instance Method Details
#force_flush(timeout: nil) ⇒ Object
250 |
# File 'lib/foam/otel/pipelines.rb', line 250 def force_flush(timeout: nil) = guarded { @inner.force_flush(timeout: timeout) } || OpenTelemetry::SDK::Trace::Export::SUCCESS |
#on_finish(span) ⇒ Object
237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/foam/otel/pipelines.rb', line 237 def on_finish(span) guarded do masked = Foam::Otel::Redaction.mask_span_data(span.to_span_data, @config) if masked.nil? # Fail closed, loudly (rule 15): a span whose masked view cannot be # built is WITHHELD from the tenant, never handed over raw. Foam::Otel::Diagnostics.warn("tenant span view masking failed — span withheld from " \ "additional span processor (fail-closed, rule 14)") else @inner.on_finish(MaskedSpanView.new(span, masked)) end end end |
#on_start(span, context) ⇒ Object
235 |
# File 'lib/foam/otel/pipelines.rb', line 235 def on_start(span, context) = guarded { @inner.on_start(span, context) } |
#shutdown(timeout: nil) ⇒ Object
251 |
# File 'lib/foam/otel/pipelines.rb', line 251 def shutdown(timeout: nil) = guarded { @inner.shutdown(timeout: timeout) } || OpenTelemetry::SDK::Trace::Export::SUCCESS |