Class: Julewire::Core::Diagnostics::IntegrationHealthStore

Inherits:
Object
  • Object
show all
Defined in:
lib/julewire/core/diagnostics/integration_health_store.rb

Instance Method Summary collapse

Constructor Details

#initializeIntegrationHealthStore

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

#healthObject



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