Class: StandardHealth::Notifiers::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/standard_health/notifiers/logger.rb

Overview

Logs health events.

SILENT ON HEALTHY. This is the load-bearing difference from StandardCircuit's logger notifier, and it is not a style preference.

Circuit events are state TRANSITIONS — inherently rare, so logging every one is fine. Health events are POLLS: DigitalOcean hits /health/ready every 10s per instance, plus a liveness probe, plus any synthetic. A line per evaluation is ~8,640 lines/day/instance of "everything is fine", which buries the one line that matters and costs real money in log ingest.

So: nothing on :ok. warn on :degraded, error on :unavailable.

Instance Method Summary collapse

Constructor Details

#initialize(logger = nil) ⇒ Logger

Returns a new instance of Logger.



19
20
21
# File 'lib/standard_health/notifiers/logger.rb', line 19

def initialize(logger = nil)
  @logger = logger
end

Instance Method Details

#call(event_name, payload) ⇒ Object



23
24
25
26
27
28
# File 'lib/standard_health/notifiers/logger.rb', line 23

def call(event_name, payload)
  case event_name
  when "standard_health.ready.evaluated" then log_evaluation(payload)
  when "standard_health.check.timed_out" then log_timeout(payload)
  end
end