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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log event for new device alert job emails sent #10506

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

aduth
Copy link
Member

@aduth aduth commented Apr 25, 2024

馃洜 Summary of changes

Adds logging to the worker job responsible for sending emails in response to expired sign-in attempts.

Why?

馃摐 Testing Plan

Verify tests pass:

  1. rspec spec/services/create_new_device_alert_spec.rb

Verify event logged in local development when job runs:

  1. Run make watch_events in parallel to make run
  2. (Optional) Visit http://localhost:3000 and sign-in before MFA
  3. When job runs (every 5 minutes), observe logged event in terminal process with make watch_events with count of emails which were sent

changelog: Internal, Logging, Log event for new device alert job emails sent
@aduth aduth requested a review from a team April 25, 2024 14:44
Copy link
Contributor

@jmdembe jmdembe left a comment

Choose a reason for hiding this comment

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

馃憤馃従

Copy link
Contributor

@kevinsmaster5 kevinsmaster5 left a comment

Choose a reason for hiding this comment

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

Looks / works good 馃憤

emails_sent
end

private

def analytics
@analytics ||= Analytics.new(user: AnonymousUser.new, request: nil, sp: nil, session: {})
Copy link
Contributor

Choose a reason for hiding this comment

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

this is logging across all users? or for each user?

Copy link
Member Author

Choose a reason for hiding this comment

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

The job runs independently of users (can dispatch emails for multiple users).

This was copied from how it's done in AccountReset::GrantRequestsAndSendEmails:

def analytics
@analytics ||= Analytics.new(
user: AnonymousUser.new,
request: nil,
sp: nil,
session: {},
)
end

@aduth aduth merged commit f7fbf59 into main Apr 25, 2024
2 checks passed
@aduth aduth deleted the aduth-log-event-new-device-emails-sent branch April 25, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants