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

EZR: Add VANotify callback metadata to email notify job #20093

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dellerbie
Copy link
Contributor

Summary

  • This work is behind a feature toggle (flipper): YES
  • Adds support for VANotify callbacks when sending the failure email to the Veteran

Related issue(s)

Testing done

  • New code is covered by unit tests
  • We will validate the metadata is sent when QA'ing the failure email

What areas of the site does it impact?

Form 10-10 EZR

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

@va-vfs-bot va-vfs-bot temporarily deployed to dellerbie-ezr_zsf_callbacks/main/main January 3, 2025 18:23 Inactive
@dellerbie dellerbie force-pushed the dellerbie-ezr_zsf_callbacks branch from 842ccbe to 3dd387d Compare January 3, 2025 19:49
@va-vfs-bot va-vfs-bot temporarily deployed to dellerbie-ezr_zsf_callbacks/main/main January 3, 2025 19:58 Inactive
@dellerbie dellerbie force-pushed the dellerbie-ezr_zsf_callbacks branch from 3dd387d to ee177cb Compare January 3, 2025 20:16
@dellerbie dellerbie marked this pull request as ready for review January 3, 2025 20:17
@dellerbie dellerbie requested review from a team as code owners January 3, 2025 20:17
@va-vfs-bot va-vfs-bot temporarily deployed to dellerbie-ezr_zsf_callbacks/main/main January 3, 2025 20:34 Inactive
app/sidekiq/hca/ezr_submission_job.rb Outdated Show resolved Hide resolved
api_key
api_key,
{
callback_metadata: { notification_type: 'error', form_number: FORM_ID, statsd_tags: DD_ZSF_TAGS }
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't realize this before, but the statsd_tags value needs to be a hash not an array. The DefaultCallback class currently expects it as a hash since it pulls out the service/function and their values and formats them in the array of strings we expect to pass to statsd metrics. I actually have a PR open to allow for both arrays and hashes in the DefaultCallback class, but at the moment this won't correctly add the tags.

@va-vfs-bot va-vfs-bot temporarily deployed to dellerbie-ezr_zsf_callbacks/main/main January 10, 2025 19:45 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to dellerbie-ezr_zsf_callbacks/main/main January 10, 2025 22:00 Inactive
@dellerbie dellerbie force-pushed the dellerbie-ezr_zsf_callbacks branch from db26149 to 75e866d Compare January 10, 2025 22:27
@va-vfs-bot va-vfs-bot temporarily deployed to dellerbie-ezr_zsf_callbacks/main/main January 10, 2025 22:28 Inactive
'service:healthcare-application',
'function: 10-10EZR async form submission'
].freeze
DD_ZSF_TAGS = {
Copy link
Contributor

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 the DD_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?

Copy link
Contributor

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

Copy link
Contributor Author

@dellerbie dellerbie Jan 14, 2025

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 the DD_ZSF_TAGS are being passed to?

I see that you still have this line in your branch, but maybe you meant to remove it?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Contributor

@coope93 coope93 left a comment

Choose a reason for hiding this comment

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

So one last comment, but after talking with Nathan Wright on the VANotify team, I don't think we want to merge this change in just yet. The default callbacks currently only work for the vets-api service, and I believe this email is in our 1010 health apps service. We discovered that when testing this, and he updated staging to include our service so we could keep moving forward on it. So you should be able to confirm the behavior in staging, but if this is deployed to production the callbacks will not work. So we may want to put this behavior behind it's own toggle or just hold off for a bit 🤷

'service:healthcare-application',
'function: 10-10EZR async form submission'
].freeze
DD_ZSF_TAGS = {
Copy link
Contributor

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

@stevenjcumming
Copy link
Contributor

@dellerbie can you have a teammate review, then I'll review

@dellerbie
Copy link
Contributor Author

So one last comment, but after talking with Nathan Wright on the VANotify team, I don't think we want to merge this change in just yet. The default callbacks currently only work for the vets-api service, and I believe this email is in our 1010 health apps service. We discovered that when testing this, and he updated staging to include our service so we could keep moving forward on it. So you should be able to confirm the behavior in staging, but if this is deployed to production the callbacks will not work. So we may want to put this behavior behind it's own toggle or just hold off for a bit 🤷

Okay I see. It makes sense to hold off since the fix is making its way to production soon. I'll just put this back into draft state for now.

@dellerbie dellerbie marked this pull request as draft January 17, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants