Class: BenefitsClaims::IntentToFile::Monitor

Inherits:
ZeroSilentFailures::Monitor show all
Defined in:
lib/lighthouse/benefits_claims/intent_to_file/monitor.rb

Constant Summary collapse

STATSD_KEY_PREFIX =
'worker.lighthouse.create_itf_async'

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.



10
11
12
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 10

def initialize
  super('pension-itf')
end

Instance Method Details

#track_create_itf_begun(itf_type, form_start_date, user_account_uuid) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 14

def track_create_itf_begun(itf_type, form_start_date, )
  StatsD.increment("#{STATSD_KEY_PREFIX}.#{itf_type}.begun")
  context = {
    itf_type:,
    form_start_date:,
    user_account_uuid:
  }
  Rails.logger.info("Lighthouse::CreateIntentToFileJob create #{itf_type} ITF begun", context)
end

#track_create_itf_exhaustion(itf_type, form, error) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 45

def track_create_itf_exhaustion(itf_type, form, error)
  context = {
    error:,
    itf_type:,
    form_start_date: form&.created_at&.to_s,
    user_account_uuid: form&.
  }
  log_silent_failure(context, form&., call_location: caller_locations.first)

  StatsD.increment("#{STATSD_KEY_PREFIX}.exhausted")
  Rails.logger.error("Lighthouse::CreateIntentToFileJob create #{itf_type} ITF exhausted", context)
end

#track_create_itf_failure(itf_type, form_start_date, user_account_uuid, e) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 34

def track_create_itf_failure(itf_type, form_start_date, , e)
  StatsD.increment("#{STATSD_KEY_PREFIX}.#{itf_type}.failure")
  context = {
    itf_type:,
    form_start_date:,
    user_account_uuid:,
    errors: e.try(:errors) || e&.message
  }
  Rails.logger.warn("Lighthouse::CreateIntentToFileJob create #{itf_type} ITF failed", context)
end

#track_create_itf_success(itf_type, form_start_date, user_account_uuid) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 24

def track_create_itf_success(itf_type, form_start_date, )
  StatsD.increment("#{STATSD_KEY_PREFIX}.#{itf_type}.success")
  context = {
    itf_type:,
    form_start_date:,
    user_account_uuid:
  }
  Rails.logger.info("Lighthouse::CreateIntentToFileJob create #{itf_type} ITF succeeded", context)
end

#track_invalid_itf_type(form, error) ⇒ Object



88
89
90
91
92
93
94
95
96
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 88

def track_invalid_itf_type(form, error)
  StatsD.increment('itf.type.invalid')
  context = {
    error: error.message,
    in_progress_form_id: form&.id,
    user_account_uuid: form&.
  }
  Rails.logger.info('V0 InProgressFormsController async ITF invalid ITF type', context)
end

#track_missing_form(form, error) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 78

def track_missing_form(form, error)
  StatsD.increment('form.missing')
  context = {
    error: error.message,
    in_progress_form_id: form&.id,
    user_account_uuid: form&.
  }
  Rails.logger.info('V0 InProgressFormsController async ITF form is missing', context)
end

#track_missing_user_icn(form, error) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 58

def track_missing_user_icn(form, error)
  StatsD.increment('user.icn.blank')
  context = {
    error: error.message,
    in_progress_form_id: form&.id,
    user_account_uuid: form&.
  }
  Rails.logger.info('V0 InProgressFormsController async ITF user.icn is blank', context)
end

#track_missing_user_pid(form, error) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/lighthouse/benefits_claims/intent_to_file/monitor.rb', line 68

def track_missing_user_pid(form, error)
  StatsD.increment('user.participant_id.blank')
  context = {
    error: error.message,
    in_progress_form_id: form&.id,
    user_account_uuid: form&.
  }
  Rails.logger.info('V0 InProgressFormsController async ITF user.participant_id is blank', context)
end