Class: Burials::Monitor
- Inherits:
-
ZeroSilentFailures::Monitor
- Object
- Logging::Monitor
- ZeroSilentFailures::Monitor
- Burials::Monitor
- Defined in:
- lib/burials/monitor.rb
Overview
Monitor functions for Rails logging and StatsD
Constant Summary collapse
- CLAIM_STATS_KEY =
statsd key for api
'api.burial_claim'
- SUBMISSION_STATS_KEY =
statsd key for sidekiq
'worker.lighthouse.submit_benefits_intake_claim'
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Attributes inherited from Logging::Monitor
Instance Method Summary collapse
-
#initialize ⇒ Monitor
constructor
A new instance of Monitor.
-
#track_create_attempt(claim, current_user) ⇒ Object
log POST processing started.
-
#track_create_error(in_progress_form, claim, current_user, e = nil) ⇒ Object
log POST processing failure.
-
#track_create_success(in_progress_form, claim, current_user) ⇒ Object
log POST processing success.
-
#track_create_validation_error(in_progress_form, claim, current_user) ⇒ Object
log POST claim save validation error.
-
#track_process_attachment_error(in_progress_form, claim, current_user) ⇒ Object
log process_attachments! error.
-
#track_show404(confirmation_number, current_user, e) ⇒ Object
log GET 404 from controller.
-
#track_show_error(confirmation_number, current_user, e) ⇒ Object
log GET 500 from controller.
-
#track_submission_exhaustion(msg, claim = nil) ⇒ Object
log Sidkiq job exhaustion, complete failure after all retries.
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.
19 20 21 22 23 |
# File 'lib/burials/monitor.rb', line 19 def initialize super('burial-application') @tags = ['form_id:21P-530EZ'] end |
Instance Attribute Details
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
17 18 19 |
# File 'lib/burials/monitor.rb', line 17 def @tags end |
Instance Method Details
#track_create_attempt(claim, current_user) ⇒ Object
log POST processing started
70 71 72 73 74 75 76 77 78 |
# File 'lib/burials/monitor.rb', line 70 def track_create_attempt(claim, current_user) additional_context = { confirmation_number: claim&.confirmation_number, user_account_uuid: current_user&.user_account_uuid, tags: } track_request('info', '21P-530EZ submission to Sidekiq begun', "#{CLAIM_STATS_KEY}.attempt", call_location: caller_locations.first, **additional_context) end |
#track_create_error(in_progress_form, claim, current_user, e = nil) ⇒ Object
log POST processing failure
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/burials/monitor.rb', line 110 def track_create_error(in_progress_form, claim, current_user, e = nil) additional_context = { confirmation_number: claim&.confirmation_number, user_account_uuid: current_user&.user_account_uuid, in_progress_form_id: in_progress_form&.id, errors: claim&.errors&.errors, message: e&., tags: } track_request('error', '21P-530EZ submission to Sidekiq failed', "#{CLAIM_STATS_KEY}.failure", call_location: caller_locations.first, **additional_context) end |
#track_create_success(in_progress_form, claim, current_user) ⇒ Object
log POST processing success
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/burials/monitor.rb', line 131 def track_create_success(in_progress_form, claim, current_user) additional_context = { confirmation_number: claim&.confirmation_number, user_account_uuid: current_user&.user_account_uuid, in_progress_form_id: in_progress_form&.id, errors: claim&.errors&.errors, tags: } track_request('info', '21P-530EZ submission to Sidekiq success', "#{CLAIM_STATS_KEY}.success", call_location: caller_locations.first, **additional_context) end |
#track_create_validation_error(in_progress_form, claim, current_user) ⇒ Object
log POST claim save validation error
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/burials/monitor.rb', line 89 def track_create_validation_error(in_progress_form, claim, current_user) additional_context = { confirmation_number: claim&.confirmation_number, user_account_uuid: current_user&.user_account_uuid, in_progress_form_id: in_progress_form&.id, errors: claim&.errors&.errors, tags: } track_request('error', '21P-530EZ submission validation error', "#{CLAIM_STATS_KEY}.validation_error", call_location: caller_locations.first, **additional_context) end |
#track_process_attachment_error(in_progress_form, claim, current_user) ⇒ Object
log process_attachments! error
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/burials/monitor.rb', line 151 def (in_progress_form, claim, current_user) additional_context = { confirmation_number: claim&.confirmation_number, user_account_uuid: current_user&.user_account_uuid, in_progress_form_id: in_progress_form&.id, errors: claim&.errors&.errors, tags: } track_request('error', '21P-530EZ process attachment error', "#{CLAIM_STATS_KEY}.process_attachment_error", call_location: caller_locations.first, **additional_context) end |
#track_show404(confirmation_number, current_user, e) ⇒ Object
log GET 404 from controller
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/burials/monitor.rb', line 33 def track_show404(confirmation_number, current_user, e) additional_context = { confirmation_number:, user_account_uuid: current_user&.user_account_uuid, message: e&., tags: } track_request('error', '21P-530EZ submission not found', CLAIM_STATS_KEY, call_location: caller_locations.first, **additional_context) end |
#track_show_error(confirmation_number, current_user, e) ⇒ Object
log GET 500 from controller
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/burials/monitor.rb', line 52 def track_show_error(confirmation_number, current_user, e) additional_context = { confirmation_number:, user_account_uuid: current_user&.user_account_uuid, message: e&., tags: } track_request('error', '21P-530EZ fetching submission failed', CLAIM_STATS_KEY, call_location: caller_locations.first, **additional_context) end |
#track_submission_exhaustion(msg, claim = nil) ⇒ Object
log Sidkiq job exhaustion, complete failure after all retries
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/burials/monitor.rb', line 170 def track_submission_exhaustion(msg, claim = nil) user_account_uuid = msg['args'].length <= 1 ? nil : msg['args'][1] additional_context = { confirmation_number: claim&.confirmation_number, user_account_uuid: user_account_uuid, form_id: claim&.form_id, claim_id: msg['args'].first, message: msg, tags: } call_location = caller_locations.first if claim Burials::NotificationEmail.new(claim.id).deliver(:error) log_silent_failure_avoided(additional_context, user_account_uuid, call_location:) else log_silent_failure(additional_context, user_account_uuid, call_location:) end track_request('error', 'Lighthouse::SubmitBenefitsIntakeClaim Burial 21P-530EZ submission to LH exhausted!', "#{SUBMISSION_STATS_KEY}.exhausted", call_location:, **additional_context) end |