Skip to content

Commit

Permalink
re-add custom datadog metrics logging
Browse files Browse the repository at this point in the history
  • Loading branch information
danlim715 committed Sep 6, 2024
1 parent 064874f commit 247296a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/sidekiq/lighthouse/create_intent_to_file_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ def perform(in_progress_form_id, veteran_icn, participant_id)
service.create_intent_to_file(itf_type, '')
itf_log_monitor.track_create_itf_success(itf_type, form.created_at.to_s, form.user_account_id)
rescue MissingICNError, MissingParticipantIDError, InvalidITFTypeError, FormNotFoundError => e
itf_log_monitor.track_create_itf_failure(itf_type, form.created_at.to_s, form.user_account_id, e)
if veteran_icn.blank?
itf_log_monitor.track_missing_user_icn(form, e)
elsif participant_id.blank?
itf_log_monitor.track_missing_user_pid(form, e)
elsif form.blank?
itf_log_monitor.track_missing_form(form, e)
elsif itf_type.blank?
itf_log_monitor.track_invalid_itf_type(form, e)
end
rescue => e
itf_log_monitor.track_create_itf_failure(itf_type, form.created_at.to_s, form.user_account_id, e)
raise e
Expand Down
40 changes: 40 additions & 0 deletions lib/lighthouse/benefits_claims/intent_to_file/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,46 @@ def track_create_itf_exhaustion(itf_type, form, error)
}
Rails.logger.error("Lighthouse::CreateIntentToFileJob create #{itf_type} ITF exhausted", context)
end

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.user_account_id
}
Rails.logger.info('V0 InProgressFormsController async ITF user.icn is blank', context)
end

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.user_account_id
}
Rails.logger.info('V0 InProgressFormsController async ITF user.participant_id is blank', context)
end

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

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.user_account_id
}
Rails.logger.info('V0 InProgressFormsController async ITF invalid ITF type', context)
end
end
end
end

0 comments on commit 247296a

Please sign in to comment.