-
Notifications
You must be signed in to change notification settings - Fork 66
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
API-27098: Improved Error Handling and Observability of Duplicate UUID Response from Central Mail (Appeals and Benefits Intake) #12906
API-27098: Improved Error Handling and Observability of Duplicate UUID Response from Central Mail (Appeals and Benefits Intake) #12906
Conversation
@@ -30,6 +30,8 @@ class PdfSubmitJob | |||
# 503 Database Offline || SOLR Service Offline || Intake API is undergoing maintenance | |||
RETRYABLE_EMMS_RESP_STATUS_CODES = [401, 429, 500, 503].freeze | |||
|
|||
STATSD_DUPLICATE_UUID_KEY = 'api.appeals.document_upload.duplicate_uuid' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The STATSD_UPLOAD_FAIL_KEY
for Appeals is set to api.appeals.document_upload.fail
, so I was trying to keep things consistent here.
elsif response.status == 400 && response.body.match?(DUPLICATE_UUID_REGEX) | ||
StatsD.increment(STATSD_DUPLICATE_UUID_KEY) | ||
Rails.logger.warn("#{appeal.class.to_s.gsub('::', ' ')}: Duplicate UUID submitted to Central Mail", | ||
'uuid' => appeal.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I tried to keep to the logging pattern started in log_upload_error
(in the same class).
@@ -13,6 +13,8 @@ class UploadProcessor | |||
include Sidekiq::Worker | |||
include VBADocuments::UploadValidations | |||
|
|||
STATSD_DUPLICATE_UUID_KEY = 'api.vba.document_upload.duplicate_uuid' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The STATSD_UPLOAD_FAIL_KEY
for Benefits Intake is set to api.vba.document_upload.fail
, so I was trying to keep things consistent here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -258,6 +258,36 @@ | |||
end | |||
end | |||
|
|||
context 'with a duplicate UUID response from Central Mail' do | |||
before do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm legit intimidated by your rspec-fu
Summary
Some recent observations after changing our error handling slightly in the Appeals API have led us to the understanding that a status code of
400
with a response body containing "Document already uploaded with uuid," when returned from the Central Mail/upload
endpoint, indicates that there was an earlier submission (with that same UUID) that was successful, and so the submission record itself can be marked as successful.This new understanding has led to the changes in this PR, which counts "duplicate UUID" responses as always successful in both the Appeals API and Benefits Intake API and adds a StatsD counter and Rails logs for the "duplicate UUID" scenario so that we can more easily monitor how often it occurs. The StatsD counter will be added to the Team Banana Peels Datadog dashboard.
Related issue(s)
API-27098
Testing done
The
AppealsApi::PdfSubmitJob
andVBADocuments::UploadProcessor
are well-covered by existing unit tests. I have also added unit tests specifically for the "duplicate UUID" scenario for both classes.Screenshots
None
What areas of the site does it impact?
This PR impacts the Appeals API and the Benefits Intake API, both of which my team own.
Acceptance criteria
Requested Feedback
No specific feedback requested on this PR.