Class: ZeroSilentFailures::Monitor
- Inherits:
-
Logging::Monitor
- Object
- Logging::Monitor
- ZeroSilentFailures::Monitor
- Defined in:
- lib/zero_silent_failures/monitor.rb
Overview
global monitoring functions for ZSF - statsd and logging
Direct Known Subclasses
BenefitsClaims::IntentToFile::Monitor, Burials::Monitor, Dependents::Monitor, PCPG::Monitor, VRE::Monitor
Instance Attribute Summary
Attributes inherited from Logging::Monitor
Instance Method Summary collapse
-
#log_silent_failure(additional_context, user_account_uuid = nil, call_location: nil) ⇒ Object
record metrics and log for a silent failure.
-
#log_silent_failure_avoided(additional_context, user_account_uuid = nil, call_location: nil, email_confirmed: false) ⇒ Object
record metrics and log for a silent failure, avoided - an email was sent.
Methods inherited from Logging::Monitor
#initialize, #parse_caller, #track_request
Constructor Details
This class inherits a constructor from Logging::Monitor
Instance Method Details
#log_silent_failure(additional_context, user_account_uuid = nil, call_location: nil) ⇒ Object
record metrics and log for a silent failure
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zero_silent_failures/monitor.rb', line 15 def log_silent_failure(additional_context, user_account_uuid = nil, call_location: nil) function, file, line = parse_caller(call_location || caller_locations.first) metric = 'silent_failure' = 'Silent failure!' payload = { statsd: metric, service:, function:, file:, line:, user_account_uuid:, additional_context: } StatsD.increment(metric, tags: ["service:#{service}", "function:#{function}"]) Rails.logger.error(, payload) end |
#log_silent_failure_avoided(additional_context, user_account_uuid = nil, call_location: nil, email_confirmed: false) ⇒ Object
record metrics and log for a silent failure, avoided - an email was sent
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/zero_silent_failures/monitor.rb', line 40 def log_silent_failure_avoided(additional_context, user_account_uuid = nil, call_location: nil, email_confirmed: false) function, file, line = parse_caller(call_location || caller_locations.first) metric = 'silent_failure_avoided' = 'Silent failure avoided' unless email_confirmed metric = "#{metric}_no_confirmation" = "#{} (no confirmation)" end payload = { statsd: metric, service:, function:, file:, line:, user_account_uuid:, additional_context: } StatsD.increment(metric, tags: ["service:#{service}", "function:#{function}"]) Rails.logger.error(, payload) end |