-
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
98603 Callbacks for ZSF logging - IVC CHAMPVA forms #20015
98603 Callbacks for ZSF logging - IVC CHAMPVA forms #20015
Conversation
champva_vanotify_custom_callback: | ||
actor_type: user | ||
description: Enables the custom callback_klass when sending IVC CHAMPVA failure emails with VA Notify |
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.
Feature flag so we can test in staging.
|
||
if Flipper.enabled?(:champva_vanotify_custom_callback, @current_user) | ||
form_data = form_data.merge( | ||
{ | ||
callback_klass: 'IvcChampva::ZsfEmailNotificationCallback', | ||
callback_metadata: { | ||
statsd_tag: 'veteran-ivc-champva-forms', | ||
additional_context: | ||
} | ||
} | ||
) | ||
end |
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.
Passing this callback class to VA Notify when we send the email allows us to gather the email delivery status, which is then going to the DD silent failures dashboard.
ActiveRecord::Base.transaction do | ||
if IvcChampva::Email.new(form_data).send_email | ||
fetch_forms_by_uuid(form[:form_uuid]).update_all(email_sent: true) # rubocop:disable Rails/SkipsModelValidations | ||
else | ||
additional_context = { form_id: form[:form_number], form_uuid: form[:form_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.
This is now being passed in to the function above rather than created 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.
This is the actual callback class that gets run via VA Notify when an email's status is determined (modified from this example).
The only side effects from this callback are more logging calls.
send_failure_email(form, template_id) | ||
additional_context = { form_id: form[:form_number], form_uuid: form[:form_uuid] } | ||
monitor.log_silent_failure_avoided(additional_context) | ||
monitor.track_missing_status_email_sent(form[:form_number]) | ||
unless Flipper.enabled?(:champva_vanotify_custom_callback, @current_user) | ||
monitor.log_silent_failure_avoided(additional_context) | ||
monitor.track_missing_status_email_sent(form[:form_number]) | ||
end | ||
send_failure_email(form, template_id, additional_context) |
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.
These calls to the monitor have been moved inside our callback class so they have access to the email delivery status. send_failure_email has been updated to pass the callback_klass to VA Notify.
When our flipper is NOT enabled, we default to logging here per existing functionality.
@@ -23,7 +23,7 @@ def initialize(data) | |||
@data = data | |||
end | |||
|
|||
def send_email | |||
def send_email # rubocop:disable Metrics/MethodLength |
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'd like to avoid inline disabling rubocop rules. Is there a way to break this up?
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 was able to streamline how I'm accessing that object (updated in this commit) - please let me know if there's anything else I can modify. Thanks! @LindseySaari
Good morning, @LindseySaari! When you get a chance, could I please have another review of this PR? I updated some testing related issues and fixed the request above. Thank you! |
Summary
This PR adds a custom
callback_class
per this VA Notify documentation. The main change is that calls tomonitor.log_silent_failure_avoided
will now feature a completedemail_confirmed
property so that when they are viewed in this dashboard they are categorized properly.Related issue(s)
Testing done
Screenshots
Note: Optional
What areas of the site does it impact?
(Describe what parts of the site are impacted andifcode touched other areas)
Acceptance criteria
Requested Feedback
(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?