Module: Foam::Otel::ForkHooks
- Defined in:
- lib/foam/otel/fork_hooks.rb
Overview
Fork survival (BASE_PACKAGE_SPEC rule 37 / GOTCHAS R1). In cluster-mode servers (Puma/Unicorn preload) the SDK boots in the master and forks workers. The trace and log BatchProcessors self-heal on their first span/log via the SDK's own reset_on_fork; the PeriodicMetricReader does NOT — its export thread starts in the constructor and only restarts via an explicit after_fork, which the SDK wires ONLY through SDK.configure (ForkHooks). Foam bypasses SDK.configure, so it installs its own Process._fork hook to restart foam's metric readers in the child.
Prepended ONCE per process (idempotent) — never per init.
Defined Under Namespace
Modules: Patch
Class Method Summary collapse
Class Method Details
.install! ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/foam/otel/fork_hooks.rb', line 19 def install! return if @installed return unless Process.respond_to?(:_fork) Process.singleton_class.prepend(Patch) @installed = true end |
.installed? ⇒ Boolean
27 |
# File 'lib/foam/otel/fork_hooks.rb', line 27 def installed? = @installed |