Class: Foam::Otel::Instance
- Inherits:
-
Object
- Object
- Foam::Otel::Instance
- Defined in:
- lib/foam/otel/instance.rb
Overview
The handle init() returns. Providers are process-global; this mostly carries the resolved config and orchestrates shutdown/flush. An inert init (enabled: false, or a claimed-all process) owns no providers.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#providers ⇒ Object
Returns the value of attribute providers.
Instance Method Summary collapse
-
#flush ⇒ Object
Flush foam's buffered pipelines (delegates to the module-level flush, which knows every foam-owned flushable).
-
#initialize(config) ⇒ Instance
constructor
A new instance of Instance.
- #name ⇒ Object
- #shutdown ⇒ Object
Constructor Details
#initialize(config) ⇒ Instance
Returns a new instance of Instance.
12 13 14 15 |
# File 'lib/foam/otel/instance.rb', line 12 def initialize(config) @config = config @providers = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/foam/otel/instance.rb', line 9 def config @config end |
#providers ⇒ Object
Returns the value of attribute providers.
10 11 12 |
# File 'lib/foam/otel/instance.rb', line 10 def providers @providers end |
Instance Method Details
#flush ⇒ Object
Flush foam's buffered pipelines (delegates to the module-level flush, which knows every foam-owned flushable). Never raises.
21 22 23 |
# File 'lib/foam/otel/instance.rb', line 21 def flush Foam::Otel.flush end |
#name ⇒ Object
17 |
# File 'lib/foam/otel/instance.rb', line 17 def name = @config.name |
#shutdown ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/foam/otel/instance.rb', line 25 def shutdown if @providers.empty? Foam::Otel.flush return end @providers.each do |provider| begin provider.shutdown rescue StandardError, SystemStackError # SystemStackError is not a StandardError; a poisoned payload deep # in a pipeline must never escape through the at_exit hook into # the customer's process teardown (rule 9). nil end Foam::Otel.send(:forget_provider, provider) end @providers = [] end |