Module: Foam::Otel::ForkHooks::Patch
- Defined in:
- lib/foam/otel/fork_hooks.rb
Instance Method Summary collapse
Instance Method Details
#_fork ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/foam/otel/fork_hooks.rb', line 31 def _fork pid = super # a real fork failure must propagate — never swallowed # In the CHILD only (super returns 0 to the child). A hook failure # must never break an otherwise-successful fork. if pid.zero? begin Foam::Otel.after_fork! # Let a per-worker init (the README on_worker_boot recipe) be a # REAL re-init in the child: without this, the inherited # @initialized guard returns the PARENT's instance and every # worker reports the parent's service.instance.id (section 0 # resource table / GOTCHAS R1). Workers that never re-init keep # the inherited pipelines (readers restarted above). Foam::Otel.send(:mark_forked!) rescue StandardError nil end end pid end |