Class: Foam::Otel::Ingest::MetricReader
- Inherits:
-
OpenTelemetry::SDK::Metrics::Export::PeriodicMetricReader
- Object
- OpenTelemetry::SDK::Metrics::Export::PeriodicMetricReader
- Foam::Otel::Ingest::MetricReader
- Defined in:
- lib/foam/otel/ingest_metric_reader.rb
Instance Method Summary collapse
-
#after_fork ⇒ Object
A stood-down tap must stay down across forks; everything else inherits the upstream fork recovery (exporter reset + restart), driven by foam's own Process._fork hook via the @ingest_taps registry (GOTCHAS R7 — upstream only wires after_fork through SDK.configure, which door 2 never runs).
-
#collect ⇒ Object
Guarded collect (GOTCHAS R6): PeriodicMetricReader#export has NO rescue — a raising collect (or exporter) would kill the reader thread silently and the tap would go dark with no warning.
-
#initialize(exporter:, config:) ⇒ MetricReader
constructor
A new instance of MetricReader.
Constructor Details
#initialize(exporter:, config:) ⇒ MetricReader
Returns a new instance of MetricReader.
19 20 21 22 23 24 25 26 27 |
# File 'lib/foam/otel/ingest_metric_reader.rb', line 19 def initialize(exporter:, config:) @foam_config = config @foam_claim_checked = false @foam_double_claim_warned = false @foam_stood_down = false # super LAST: the superclass constructor starts the ticker thread, # which reads the ivars above via collect. super(exporter: exporter) end |
Instance Method Details
#after_fork ⇒ Object
A stood-down tap must stay down across forks; everything else inherits the upstream fork recovery (exporter reset + restart), driven by foam's own Process._fork hook via the @ingest_taps registry (GOTCHAS R7 — upstream only wires after_fork through SDK.configure, which door 2 never runs).
49 50 51 52 53 |
# File 'lib/foam/otel/ingest_metric_reader.rb', line 49 def after_fork return if @foam_stood_down super end |
#collect ⇒ Object
Guarded collect (GOTCHAS R6): PeriodicMetricReader#export has NO rescue — a raising collect (or exporter) would kill the reader thread silently and the tap would go dark with no warning. Foam's exporter chain already rescues everything to FAILURE; this guard closes the collect half. Also the metrics double-claim gate (fleet ruling 2c / audit R9): checked once, on the first non-empty collection, BEFORE anything reaches the exporter — a stand-down exports zero duplicates ever.
37 38 39 40 41 42 |
# File 'lib/foam/otel/ingest_metric_reader.rb', line 37 def collect batch = super admit_metrics(batch.is_a?(Array) ? batch : []) rescue StandardError, SystemStackError [] end |