diff --git a/app/sidekiq/decision_review/saved_claim_nod_status_updater_job.rb b/app/sidekiq/decision_review/saved_claim_nod_status_updater_job.rb index fda397518b9..a10593528bc 100644 --- a/app/sidekiq/decision_review/saved_claim_nod_status_updater_job.rb +++ b/app/sidekiq/decision_review/saved_claim_nod_status_updater_job.rb @@ -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 diff --git a/app/sidekiq/decision_review/saved_claim_sc_status_updater_job.rb b/app/sidekiq/decision_review/saved_claim_sc_status_updater_job.rb index 8123bfd9fdd..01c97712057 100644 --- a/app/sidekiq/decision_review/saved_claim_sc_status_updater_job.rb +++ b/app/sidekiq/decision_review/saved_claim_sc_status_updater_job.rb @@ -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 diff --git a/spec/sidekiq/decision_review/saved_claim_nod_status_updater_job_spec.rb b/spec/sidekiq/decision_review/saved_claim_nod_status_updater_job_spec.rb index a3d5e099b62..7e576c51c56 100644 --- a/spec/sidekiq/decision_review/saved_claim_nod_status_updater_job_spec.rb +++ b/spec/sidekiq/decision_review/saved_claim_nod_status_updater_job_spec.rb @@ -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: '{}') @@ -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 diff --git a/spec/sidekiq/decision_review/saved_claim_sc_status_updater_job_spec.rb b/spec/sidekiq/decision_review/saved_claim_sc_status_updater_job_spec.rb index ce9a76a1f1f..a0d34d7ab56 100644 --- a/spec/sidekiq/decision_review/saved_claim_sc_status_updater_job_spec.rb +++ b/spec/sidekiq/decision_review/saved_claim_sc_status_updater_job_spec.rb @@ -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: '{}') @@ -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