Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

93214: Fix error logging for DR SavedClaim status updater jobs #18642

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the conditional is different here where logging is happening upon error status whereas before in the unless condition, it was happening when the status was not ERROR_STATUS. Is this the intent, just want to check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct - we want it to log only if the status changed to ERROR_STATUS but not if it was already 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
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
Loading