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

Add analytics event for Twilio errors #1824

Merged
merged 3 commits into from
Nov 30, 2017
Merged

Conversation

monfresh
Copy link
Contributor

@monfresh monfresh commented Nov 30, 2017

Why: So we can see how often these errors occur and if they're
specific to a particular country or area code.

Hi! Before submitting your PR for review, and/or before merging it, please
go through the following checklist:

  • For DB changes, check for missing indexes, check to see if the changes
    affect other apps (such as the dashboard), make sure the DB columns in the
    various environments are properly populated, coordinate with devops, plan
    migrations in separate steps.

  • For route changes, make sure GET requests don't change state or result in
    destructive behavior. GET requests should only result in information being
    read, not written.

  • For encryption changes, make sure it is compatible with data that was
    encrypted with the old code.

  • Do not disable Rubocop or Reek offenses unless you are absolutely sure
    they are false positives. If you're not sure how to fix the offense, please
    ask a teammate.

  • When reading data, write tests for nil values, empty strings,
    and invalid formats.

  • When calling redirect_to in a controller, use _url, not _path.

  • When adding user data to the session, use the user_session helper
    instead of the session helper so the data does not persist beyond the user's
    session.

**Why**: So we can see how often these errors occur and if they're
specific to a particular country or area code.
**Why**: To help troubleshoot errors. It's helpful to know if the user
successfully went to the account page after 2FA if they signed in
directly. Conversely, if they ended up on the account page instead of
going back to the SP, that's helpful to know as well.
@monfresh
Copy link
Contributor Author

I found some more events we want to track, so I figured I'd add them as additional commits in this PR. Let me know if you prefer me to open a separate PR.

**Why**: To get metrics on SP vs IdP initiated logouts, and to get
a more complete picture of user events when troubleshooting.
@@ -5,7 +5,7 @@ def index

result = @logout_form.submit

analytics.track_event(Analytics::OPENID_CONNECT_LOGOUT, result.to_h.except(:redirect_uri))
analytics.track_event(Analytics::LOGOUT_INITIATED, result.to_h.except(:redirect_uri))
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to keep track of whether the logout is OIDC or SAML with an event? I.e. instead of creating a LOGOUT_INITIATED event, creating at SAML_LOGOUT event?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I like that idea, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One event makes it easier to compare OIDC vs SAML. In Kibana, you would query a single event name, and then you can filter on sp_initiated: true vs sp_initiated: false. And then to determine the split between OIDC and SAML, you would further filter on oidc: true vs oidc: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's really just one logout event, but with different properties each time. This is similar to how we track multi-factor authentication. We use a single event, but the method of authentication is captured as an event property, and it can be SMS, Voice, TOTP, or personal key.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, that makes sense 👍

Copy link
Member

@jmhooper jmhooper left a comment

Choose a reason for hiding this comment

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

LGTM

@monfresh monfresh merged commit 3716fe2 into master Nov 30, 2017
@monfresh monfresh deleted the mb-add-twilio-analytics branch November 30, 2017 18:19
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.

3 participants