Skip to content

Commit

Permalink
93214: Fix error logging for DR SavedClaim status updater jobs (#18642)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfong-adh authored Oct 1, 2024
1 parent 997fa21 commit e262b9c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ def check_attachments_status(nod, uploads_metadata)
status = upload['status']
result = false unless UPLOAD_SUCCESSFUL_STATUS.include? status

upload_id = upload['id']
# Increment StatsD and log only for new errors
unless old_uploads_metadata.dig(upload_id, 'status') == ERROR_STATUS
StatsD.increment("#{STATSD_KEY_PREFIX}_upload.status", tags: ["status:#{status}"])
if status == ERROR_STATUS
upload_id = upload['id']
# Increment StatsD and log only for new errors
next if old_uploads_metadata.dig(upload_id, 'status') == ERROR_STATUS

Rails.logger.info('DecisionReview::SavedClaimNodStatusUpdaterJob evidence status error',
{ guid: nod.guid, lighthouse_upload_id: upload_id, detail: upload['detail'] })
end

StatsD.increment("#{STATSD_KEY_PREFIX}_upload.status", tags: ["status:#{status}"])
end

result
Expand Down
10 changes: 6 additions & 4 deletions app/sidekiq/decision_review/saved_claim_sc_status_updater_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ def check_attachments_status(sc, uploads_metadata)
status = upload['status']
result = false unless UPLOAD_SUCCESSFUL_STATUS.include? status

upload_id = upload['id']
# Increment StatsD and log only for new errors
unless old_uploads_metadata.dig(upload_id, 'status') == ERROR_STATUS
StatsD.increment("#{STATSD_KEY_PREFIX}_upload.status", tags: ["status:#{status}"])
if status == ERROR_STATUS
upload_id = upload['id']
# Increment StatsD and log only for new errors
next if old_uploads_metadata.dig(upload_id, 'status') == ERROR_STATUS

Rails.logger.info('DecisionReview::SavedClaimScStatusUpdaterJob evidence status error',
{ guid: sc.guid, lighthouse_upload_id: upload_id, detail: upload['detail'] })
end
StatsD.increment("#{STATSD_KEY_PREFIX}_upload.status", tags: ["status:#{status}"])
end

result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
let(:upload_id4) { SecureRandom.uuid }

before do
allow(Rails.logger).to receive(:info)

SavedClaim::NoticeOfDisagreement.create(guid: guid1, form: '{}')
SavedClaim::NoticeOfDisagreement.create(guid: guid2, form: '{}')
SavedClaim::NoticeOfDisagreement.create(guid: guid3, form: '{}')
Expand Down Expand Up @@ -177,6 +179,8 @@
expect(StatsD).to have_received(:increment)
.with('worker.decision_review.saved_claim_nod_status_updater_upload.status', tags: ['status:processing'])
.exactly(2).times
expect(Rails.logger).not_to have_received(:info)
.with('DecisionReview::SavedClaimNodStatusUpdaterJob evidence status error', anything)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
let(:upload_id4) { SecureRandom.uuid }

before do
allow(Rails.logger).to receive(:info)
SavedClaim::SupplementalClaim.create(guid: guid1, form: '{}')
SavedClaim::SupplementalClaim.create(guid: guid2, form: '{}')
SavedClaim::SupplementalClaim.create(guid: guid3, form: '{}')
Expand Down Expand Up @@ -177,6 +178,8 @@
expect(StatsD).to have_received(:increment)
.with('worker.decision_review.saved_claim_sc_status_updater_upload.status', tags: ['status:processing'])
.exactly(2).times
expect(Rails.logger).not_to have_received(:info)
.with('DecisionReview::SavedClaimScStatusUpdaterJob evidence status error', anything)
end
end

Expand Down

0 comments on commit e262b9c

Please sign in to comment.