Class: PCPG::Monitor
- Inherits:
-
ZeroSilentFailures::Monitor
- Object
- Logging::Monitor
- ZeroSilentFailures::Monitor
- PCPG::Monitor
- Defined in:
- lib/pcpg/monitor.rb
Overview
Monitor functions for Rails logging and StatsD
Constant Summary collapse
- CLAIM_STATS_KEY =
statsd key for api
'career-guidance-application'
- SUBMISSION_STATS_KEY =
statsd key for submit career counseling sidekiq
'worker.lighthouse.submit_career_counseling_job'
- BENEFITS_INTAKE_SUBMISSION_STATS_KEY =
statsd key for benefits intake sidekiq
'worker.lighthouse.submit_benefits_intake_claim'
Instance Attribute Summary
Attributes inherited from Logging::Monitor
Instance Method Summary collapse
-
#initialize ⇒ Monitor
constructor
A new instance of Monitor.
- #track_benefits_intake_submission_exhaustion(msg, claim = nil, email = nil) ⇒ Object
- #track_submission_exhaustion(msg, claim = nil, email = nil) ⇒ Object
Methods inherited from ZeroSilentFailures::Monitor
#log_silent_failure, #log_silent_failure_avoided
Methods inherited from Logging::Monitor
Constructor Details
#initialize ⇒ Monitor
Returns a new instance of Monitor.
18 19 20 |
# File 'lib/pcpg/monitor.rb', line 18 def initialize super('career-guidance-application') end |
Instance Method Details
#track_benefits_intake_submission_exhaustion(msg, claim = nil, email = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/pcpg/monitor.rb', line 49 def track_benefits_intake_submission_exhaustion(msg, claim = nil, email = nil) user_account_uuid = msg['args'].length <= 1 ? nil : msg['args'][1] additional_context = { form_id: claim&.form_id, claim_id: msg['args'].first, confirmation_number: claim&.confirmation_number, message: msg } if email log_silent_failure_avoided(additional_context, user_account_uuid, call_location: caller_locations.first) else # log_silent_failure calls the ZSF method which increases a special StatsD metric # and writes to the Rails log for additional ZSF tracking. log_silent_failure(additional_context, user_account_uuid, call_location: caller_locations.first) end StatsD.increment("#{BENEFITS_INTAKE_SUBMISSION_STATS_KEY}.exhausted") Rails.logger.error( 'Lighthouse::SubmitBenefitsIntakeClaim PCPG 28-8832 submission to LH exhausted!', user_uuid: user_account_uuid, **additional_context ) end |
#track_submission_exhaustion(msg, claim = nil, email = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pcpg/monitor.rb', line 22 def track_submission_exhaustion(msg, claim = nil, email = nil) user_account_uuid = msg['args'].length <= 1 ? nil : msg['args'][1] additional_context = { form_id: claim&.form_id, claim_id: msg['args'].first, confirmation_number: claim&.confirmation_number, 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, user_account_uuid, call_location: caller_locations.first) else # log_silent_failure calls the ZSF method which increases a special StatsD metric # and writes to the Rails log for additional ZSF tracking. # if no email is present, log silent failure log_silent_failure(additional_context, user_account_uuid, call_location: caller_locations.first) end StatsD.increment("#{SUBMISSION_STATS_KEY}.exhausted") Rails.logger.error( "Failed all retries on SubmitCareerCounselingJob, last error: #{msg['error_message']}", user_uuid: user_account_uuid, **additional_context ) end |