-
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
EZR: Add VANotify callback metadata to email notify job #20093
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,14 @@ module HCA | |
class EzrSubmissionJob | ||
include Sidekiq::Job | ||
extend SentryLogging | ||
|
||
FORM_ID = '10-10EZR' | ||
VALIDATION_ERROR = HCA::SOAPParser::ValidationError | ||
STATSD_KEY_PREFIX = 'api.1010ezr' | ||
DD_ZSF_TAGS = [ | ||
'service:healthcare-application', | ||
'function: 10-10EZR async form submission' | ||
].freeze | ||
DD_ZSF_TAGS = { | ||
service: 'healthcare-application', | ||
function: '10-10EZR async form submission' | ||
}.freeze | ||
|
||
# retry for 2d 1h 47m 12s | ||
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling | ||
|
@@ -57,10 +59,12 @@ def self.send_failure_email(parsed_form) | |
email, | ||
template_id, | ||
{ 'salutation' => salutation }, | ||
api_key | ||
api_key, | ||
{ | ||
callback_metadata: { notification_type: 'error', form_number: FORM_ID, statsd_tags: DD_ZSF_TAGS } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't realize this before, but the |
||
} | ||
) | ||
StatsD.increment("#{STATSD_KEY_PREFIX}.submission_failure_email_sent") | ||
StatsD.increment('silent_failure_avoided_no_confirmation', tags: DD_ZSF_TAGS) | ||
end | ||
|
||
def perform(encrypted_form, user_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.
So, my only concern with doing it this way is that now the
DD_ZSF_TAGS
can't be passed directly to the statsd increment call since the formatting is different (array vs hash). If we look at the other places we set theDD_ZSF_TAGS
, it will be an array of strings. Does it feel weird to map over this and format it as a hash? This was why I want to update the default behavior to allow for the array, since I think it makes it much cleaner. If we do get that merged in you can revert it back to an array, but honestly in the meantime I'm not sure which way I prefer 🤷 . Thoughts?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 started to do something similar for the EZ, but for now I'm waiting to see if I can get my global change in to the default_callbacks. master...93247-statsd-tags-hash for reference
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 think I'm confused why you need to map the hash back to an array. You mentioned that we can't pass the
DD_ZSF_TAGS
as a hash to the statsd call and I removed the line where we were passing the tags to the call.I thought it was the
VANotify::EmailJob.perform_async(*params)
call that needed the tags to be in hash format, which is where theDD_ZSF_TAGS
are being passed to?I see that you still have this line in your branch, but maybe you meant to remove it?
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 left that line in for when the flipper toggle is turned off to still increment the zsf statsd metric. That was my concern here. If you needed to pass the tags to an increment call the format would be wrong. I'm probably overthinking it though.
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.
Okay I see. This entire method is guarded by the feature flag, so I think even if it is off, this code is unaffected by the hash/array conversions.
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.
@coope93 Any other concerns with this PR?
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.
No, this looks good 👍 . Just an fyi, I merged in this PR to allow for passing the array and not just the hash for the default_callbacks. It's currently turned on in staging but turned off in prod. But once that's turned on it could make sense to switch these back to an array just for consistency with the other places we set
DD_ZSF_TAGS