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

feat: Limit Segment tracked events to only random 1% of users #13534

Merged
merged 18 commits into from
Feb 21, 2025

Conversation

smilingkylan
Copy link
Contributor

@smilingkylan smilingkylan commented Feb 14, 2025

Description

The purpose of this task is to reduce the instances of events being logged to Segment to only 1% of the current volume. The solution is to randomly select 1% of USERS (NOT EVENTS) to be tracked, and ignore the other 99%.

Related issues

Fixes: #4119
Core PR: MetaMask/core#5341

Manual testing steps

To manually test you can opt-in to being tracked via the account creation user flow, then check MixPanel to see if the events were logged or not.

Screenshots/Recordings

Before

n/a 100% of Segment events are currently being tracked

After

To test, I changed the % to 50%, went through the onboarding flow 4x and saw that exactly 2 of the 4 (50%) were logged to Segment / MixPanel

Users:

1a2edf78-0571-4144-8ed7-63e3de6631a3
cf49c571-99e2-4333-819d-46b14fc056a2
5b0d2ba1-9a2b-4933-afc6-2eeb2eba123c
daa3eae4-3e3b-4d08-adda-b5969e5d0685
image

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@smilingkylan smilingkylan added the team-mobile-platform Mobile Platform team label Feb 14, 2025
@smilingkylan smilingkylan changed the title Limit Segment tracked events to only random 1% of users feat: Limit Segment tracked events to only random 1% of users Feb 14, 2025
@smilingkylan smilingkylan added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 14, 2025
Copy link
Contributor

github-actions bot commented Feb 14, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: ef56288
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d0e14dcc-4dbc-4a7d-ad00-0e420dc33fc1

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@smilingkylan smilingkylan marked this pull request as ready for review February 14, 2025 19:04
@smilingkylan smilingkylan requested a review from a team as a code owner February 14, 2025 19:04
smilingkylan added a commit to MetaMask/core that referenced this pull request Feb 14, 2025
## Explanation

The purpose of this PR is to export the `remote-feature-flag-controller`
method `generateDeterministicRandomNumber` for use within the UI. I am
not inserting it as a controller method because we should not need to
instantiate the controller in order to use it.

## References

Issue: MetaMask/MetaMask-planning#4119
Related PR: MetaMask/metamask-mobile#13534

## Changelog

### `@metamask/remote-feature-flag-controller`

- **CHANGED**: Export `generateDeterministicRandomNumber` from
`remote-feature-flag-controller`

## Checklist
@smilingkylan smilingkylan requested a review from a team as a code owner February 18, 2025 16:56
Copy link

socket-security bot commented Feb 18, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/remote-feature-flag-controller@1.5.0 🔁 npm/@metamask/remote-feature-flag-controller@1.3.0 None 0 160 kB metamaskbot

View full report↗︎

@smilingkylan smilingkylan added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 18, 2025
Copy link
Contributor

github-actions bot commented Feb 18, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 1a3afa3
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/54d922c0-7f51-4b5f-9ff6-ee913e579595

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

DDDDDanica
DDDDDanica previously approved these changes Feb 18, 2025
@DDDDDanica
Copy link

The implementation / usage looks good to me !

@smilingkylan smilingkylan added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 19, 2025
@MetaMask MetaMask deleted a comment from github-actions bot Feb 20, 2025
@MetaMask MetaMask deleted a comment from github-actions bot Feb 20, 2025
@smilingkylan smilingkylan added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 21, 2025
Copy link
Contributor

github-actions bot commented Feb 21, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 5c9f224
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1a815e0f-c9ba-416d-ae2e-62cf755e5e0b

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@smilingkylan smilingkylan added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 21, 2025
@smilingkylan smilingkylan added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 21, 2025
Copy link
Contributor

github-actions bot commented Feb 21, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 96cde2d
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/6cc18c43-65a4-40c6-89b6-623a0ef3500f

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@smilingkylan smilingkylan added this pull request to the merge queue Feb 21, 2025
Merged via the queue into main with commit 0067937 Feb 21, 2025
43 checks passed
@smilingkylan smilingkylan deleted the kylan/feat/segment-sampling branch February 21, 2025 22:40
@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2025
@metamaskbot metamaskbot added the release-7.42.0 Issue or pull request that will be included in release 7.42.0 label Feb 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.42.0 Issue or pull request that will be included in release 7.42.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-mobile-platform Mobile Platform team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants