Class: Dependents::Monitor

Inherits:
ZeroSilentFailures::Monitor show all
Defined in:
lib/dependents/monitor.rb

Overview

Monitor functions for Rails logging and StatsD

Constant Summary collapse

CLAIM_STATS_KEY =

statsd key for api

'dependent-change'
BGS_SUBMISSION_STATS_KEY =

statsd key for initial sidekiq

'worker.submit_686c_674_bgs'
PDF_SUBMISSION_STATS_KEY =

stats key for pdf submission

'worker.submit_dependents_pdf'
SUBMISSION_STATS_KEY =

statsd key for backup sidekiq

'worker.submit_686c_674_backup_submission'

Instance Attribute Summary

Attributes inherited from Logging::Monitor

#service

Instance Method Summary collapse

Methods inherited from ZeroSilentFailures::Monitor

#log_silent_failure, #log_silent_failure_avoided

Methods inherited from Logging::Monitor

#parse_caller, #track_request

Constructor Details

#initializeMonitor

Returns a new instance of Monitor.



22
23
24
# File 'lib/dependents/monitor.rb', line 22

def initialize
  super('dependents-application')
end

Instance Method Details

#track_submission_exhaustion(msg, email = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dependents/monitor.rb', line 26

def track_submission_exhaustion(msg, email = nil)
  additional_context = {
    message: msg
  }
  if email
    # if an email address is present it means an email has been sent by vanotify
    # this means the silent failure is avoided.
    log_silent_failure_avoided(additional_context, nil, call_location: caller_locations.first)
  else
    # if no email is present, log silent failure
    log_silent_failure(additional_context, nil, call_location: caller_locations.first)
  end

  StatsD.increment("#{SUBMISSION_STATS_KEY}.exhausted")
  Rails.logger.error(
    "Failed all retries on CentralMail::SubmitCentralForm686cJob, last error: #{msg['error_message']}"
  )
end