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

Add logging for submit 0781 job exhaustion #19433

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -71,6 +71,13 @@ class SubmitForm0781 < Job
bgjob_errors: bgjob_errors.merge(new_error)
)

if Flipper.enabled?(:disability_compensation_use_api_provider_for_0781_uploads)
submission = Form526Submission.find(form526_submission_id)

provider = api_upload_provider(submission, FORM_ID_0781)
Copy link
Contributor

Choose a reason for hiding this comment

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

Bahhh that's right we don't know which form actually failed here (0781 or 0781a) but since we're logging the same metric regardless and logging the actual error below it doesn't matter, so I think this is totally fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that was my thinking as well. If we need to dig into the error more, we can find the form type on the submission.

provider.log_uploading_job_failure(self, error_class, error_message)
end

StatsD.increment("#{STATSD_KEY_PREFIX}.exhausted")

if Flipper.enabled?(:form526_send_0781_failure_notification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,44 @@
end
end
end

context 'when the API Provider uploads are enabled' do
before do
Flipper.enable(:disability_compensation_use_api_provider_for_0781_uploads)
end

let(:sidekiq_job_exhaustion_errors) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Also a nit, this is more like sidekiq_job_exhaustion_arguments or something like that hmm I don't have a better name but since it has the job id and job args its more like metadata

{
'jid' => form526_job_status.job_id,
'error_class' => 'Broken Job Error',
'error_message' => 'Your Job Broke',
Copy link
Contributor

Choose a reason for hiding this comment

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

lol

'args' => [form526_submission.id]
}
end

context 'for a Lighthouse upload' do
it 'logs the job failure' do
Flipper.enable(:disability_compensation_upload_0781_to_lighthouse)
Copy link
Contributor

Choose a reason for hiding this comment

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

Totally optional style not but I like these in a before block under the context block, as it sets up all the tests for this context and if we add more it will make that easier. Super nitpicky though


subject.within_sidekiq_retries_exhausted_block(sidekiq_job_exhaustion_errors) do
expect_any_instance_of(LighthouseSupplementalDocumentUploadProvider)
.to receive(:log_uploading_job_failure)
.with(EVSS::DisabilityCompensationForm::SubmitForm0781, 'Broken Job Error', 'Your Job Broke')
end
end
end

context 'for an EVSS Upload' do
it 'logs the job failure' do
Flipper.disable(:disability_compensation_upload_0781_to_lighthouse)

subject.within_sidekiq_retries_exhausted_block(sidekiq_job_exhaustion_errors) do
expect_any_instance_of(EVSSSupplementalDocumentUploadProvider).to receive(:log_uploading_job_failure)
.with(EVSS::DisabilityCompensationForm::SubmitForm0781, 'Broken Job Error', 'Your Job Broke')
end
end
end
end
end
end

Expand Down
Loading