Class: Julewire::Core::Diagnostics::IntegrationHealthStore
- Inherits:
-
Object
- Object
- Julewire::Core::Diagnostics::IntegrationHealthStore
- Defined in:
- lib/julewire/core/diagnostics/integration_health_store.rb
Instance Method Summary collapse
- #health ⇒ Object
-
#initialize ⇒ IntegrationHealthStore
constructor
A new instance of IntegrationHealthStore.
- #record_failure(integration, error, **metadata) ⇒ Object
- #record_success(integration) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ IntegrationHealthStore
Returns a new instance of IntegrationHealthStore.
9 10 11 |
# File 'lib/julewire/core/diagnostics/integration_health_store.rb', line 9 def initialize @entries = Concurrent::Map.new end |
Instance Method Details
#health ⇒ Object
26 27 28 29 30 |
# File 'lib/julewire/core/diagnostics/integration_health_store.rb', line 26 def health @entries.each_pair.with_object({}) do |(name, entry), snapshot| snapshot[name] = entry.snapshot end.freeze end |
#record_failure(integration, error, **metadata) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/julewire/core/diagnostics/integration_health_store.rb', line 13 def record_failure(integration, error, **) name = normalize_name(integration) = { phase: :integration, integration: name }.merge() entry_for(name).record_failure(error, **) nil end |
#record_success(integration) ⇒ Object
20 21 22 23 24 |
# File 'lib/julewire/core/diagnostics/integration_health_store.rb', line 20 def record_success(integration) name = normalize_name(integration) entry_for(name).record_success nil end |
#reset! ⇒ Object
32 33 34 35 |
# File 'lib/julewire/core/diagnostics/integration_health_store.rb', line 32 def reset! @entries.clear nil end |