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

LG-14064: Make IdV event enhancement opt-out #11588

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

lmgeorge
Copy link
Contributor

@lmgeorge lmgeorge commented Dec 3, 2024

Why

  • When Idv::AnalyticsEventEnhancer was first introduced it was opt-in, but this no longer makes sense for our current analytics tracking needs.

  • While a better long-term strategy would be to eliminate the event enhancer, this should be addressed in future work given its complexity.

How

  • Broke up the IGNORED_METHODS constant into 3 buckets: 1) frontend events 2) events solely used in jobs 3) a miscellaneous bucket These contexts may not have access to the proofing session info. For the miscellaneous bucket, additions should be minimal.

  • Added specs to ensure that the list of event methods referenced don't get out of sync with AnalyticsEvents and that there is no overlap between ignored and explicitly opted-in methods.

changelog: Internal, IdV Analytics, Make IdV event enhancement opt-out

🎫 Ticket

Link to the relevant ticket:
LG-14064

📜 Testing Plan

Minimal testing needed as no functionality is changing.

@lmgeorge lmgeorge added status - ready for review ruby Pull requests that update Ruby code area - analytics labels Dec 3, 2024
@lmgeorge lmgeorge requested review from aduth and a team December 3, 2024 23:46
@lmgeorge lmgeorge self-assigned this Dec 3, 2024
*EXCLUDED_FRONTEND_EVENT_METHODS,
*EXCLUDED_JOB_EVENT_METHODS,
*EXCLUDED_MISC_EVENT_METHODS,
].uniq.freeze
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A/N: Using a Set causes some unexpected behaviors when doing collection comparisons as it behaves more like a Hash than an Array. Switched to using uniq since the const is immutable anyway.

@@ -120,7 +99,7 @@ module AnalyticsEventsEnhancer
idv_final
idv_please_call_visited
idv_start_over
].to_set.freeze
].uniq.freeze
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A/N: Using a Set causes some unexpected behaviors when doing collection comparisons as it behaves more like a Hash than an Array. Switched to using uniq since the const is immutable anyway. (This uniq call is superfluous as the list is so short, but keeping it here for consistency in behavior.)

:idv_warning_shown,
].freeze

EXCLUDED_JOB_EVENT_METHODS = [
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way we could just detect that idv_session is not available / present and not attempt to enhance in that case? That way we don't have to maintain a list of events that fire in the worker

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I would love to move to but felt like that might be beyond the scope of the ticket. Open to moving back to draft and rethinking that though!

Copy link
Member

Choose a reason for hiding this comment

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

I really like this idea, but I also agree that it's a deviation from what the story says.

#
# Additionally, +profile_history+, the list of a User's profiles
# (sorted by creaton date, oldest to newest), may be added to events, but this is opt-in only.
# See {AnalyticsEventsEnhancer::METHODS_WITH_PROFILE_HISTORY} for the list of included events.
Copy link
Member

Choose a reason for hiding this comment

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

Yay comments ❤️

Copy link
Member

@n1zyy n1zyy left a comment

Choose a reason for hiding this comment

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

I'm going to approve this because it successfully implements what's asked in the story and is well-written.

I think it would be neat to do what Matt suggested in a comment and look for the presence of an IDV session, but the last day of the sprint is probably a bad time to completely rewrite your PR. 👼 Might be a neat followup later?

Tests appear to have gone off the rails (pun semi-intended) for reasons unrelated to your code.

:idv_warning_shown,
].freeze

EXCLUDED_JOB_EVENT_METHODS = [
Copy link
Member

Choose a reason for hiding this comment

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

I really like this idea, but I also agree that it's a deviation from what the story says.

**Why**

* When Idv::AnalyticsEventEnhancer was first introduced it was opt-in,
  but this no longer makes sense for our current analytics tracking
  needs.

* While a better long-term strategy would be to eliminate the event
  enhancer, this should be addressed in future work given its complexity.

**How**

* Broke up the IGNORED_METHODS constant into 3 buckets:
    1) frontend events
    2) events solely used in jobs
    3) a miscellaneous bucket
  These contexts may not have access to the proofing session info. For
  the miscellaneous bucket, additions should be minimal.

* Added specs to ensure that the list of event methods referenced don't
  get out of sync with AnalyticsEvents and that there is no overlap
  between ignored and explicitly opted-in methods.

changelog: Internal, IdV Analytics, Make IdV event enhancement opt-out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area - analytics ruby Pull requests that update Ruby code status - ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants