Skip to content

Commit

Permalink
EZR: Add ZSF logging (#19153)
Browse files Browse the repository at this point in the history
  • Loading branch information
dellerbie authored Oct 31, 2024
1 parent 58aef6c commit 289feb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/sidekiq/hca/ezr_submission_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class EzrSubmissionJob
extend SentryLogging
VALIDATION_ERROR = HCA::SOAPParser::ValidationError
STATSD_KEY_PREFIX = 'api.1010ezr'
DD_ZSF_TAGS = [
'service:healthcare-application',
'function: 10-10EZR async form submission'
].freeze

# 14 retries was decided on because it's the closest to a 24-hour time span based on
# Sidekiq's backoff formula: https://github.com/sidekiq/sidekiq/wiki/Error-Handling#automatic-job-retry
Expand Down Expand Up @@ -56,6 +60,7 @@ def self.send_failure_email(parsed_form)
api_key
)
StatsD.increment("#{STATSD_KEY_PREFIX}.submission_failure_email_sent")
StatsD.increment('silent_failure_avoided_no_confirmation', tags: DD_ZSF_TAGS)
end

def perform(encrypted_form, user_uuid)
Expand Down
3 changes: 3 additions & 0 deletions spec/sidekiq/hca/ezr_submission_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
HealthCareApplication::LOCKBOX.encrypt(form.to_json)
end
let(:ezr_service) { double }
let(:tags) { described_class::DD_ZSF_TAGS }

describe 'when retries are exhausted' do
before do
Expand Down Expand Up @@ -71,6 +72,7 @@
)
expect(VANotify::EmailJob).to receive(:perform_async).with(*template_params)
expect(StatsD).to receive(:increment).with('api.1010ezr.submission_failure_email_sent')
expect(StatsD).to receive(:increment).with('silent_failure_avoided_no_confirmation', tags:)
end

pii_log = PersonalInformationLog.last
Expand All @@ -87,6 +89,7 @@
described_class.within_sidekiq_retries_exhausted_block(msg) do
expect(VANotify::EmailJob).not_to receive(:perform_async)
expect(StatsD).not_to receive(:increment).with('api.1010ezr.submission_failure_email_sent')
expect(StatsD).not_to receive(:increment).with('silent_failure_avoided_no_confirmation', tags:)
end
end
end
Expand Down

0 comments on commit 289feb9

Please sign in to comment.