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: add MetaMetrics custom flush vars and log #8787

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

NicolasMassart
Copy link
Contributor

Description

  • add optional custom flush vars and log in MetaMetrics Segment client config
  • update example .js.env

Note

No unit test change as it only affect the log and it's dev feature.
The behaviour of metrics is unchanged.
If you feel tests should be added, please suggest how.

Related issues

Fixes #8772

Manual testing steps

  1. With dev environment configured to use Segment (configure SEGMENT_WRITE_KEY and SEGMENT_PROXY_URL, see contrib doc)
  2. Set env vars in .js.env:
export SEGMENT_FLUSH_INTERVAL=2
export SEGMENT_FLUSH_EVENT_LIMIT=4
  1. run app in as a local dev build
  2. check logs for:
LOG  [MetaMask DEBUG]: MetaMetrics client configured with: {
  "writeKey": "...",
  "proxy": "...",
  "debug": true,
  "anonymousId": "...",
  "flushInterval": "2",
  "flushAt": "4"
}
  1. Navigate in the app to settings and notice the following two lines in the logs, very close to each other as interval is 2s:
INFO  TRACK event saved {"event": "Navigation Drawer", "properties": {"action": "Navigation Drawer", "name": "Settings"}, "type": "track"}
...
INFO  Sent 1 events 

Screenshots/Recordings

Before

NA

After

NA

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

update example env
@NicolasMassart NicolasMassart added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-mobile-platform needs-smoke-e2e labels Feb 29, 2024
@NicolasMassart NicolasMassart self-assigned this Feb 29, 2024
@NicolasMassart NicolasMassart requested a review from a team as a code owner February 29, 2024 18:32
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.

Copy link

sonarcloud bot commented Feb 29, 2024

@gauthierpetetin gauthierpetetin added type-bug Something isn't working Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing and removed type-bug Something isn't working labels Feb 29, 2024
@seaona
Copy link
Contributor

seaona commented Mar 1, 2024

This works perfect @NicolasMassart 🔥 It will be very helpful. Thank you so much!!
I've approved it since the change is small and code make sense to me, feel free to merge or ask for another dev review if it's still needed.

metrics-flushat-1.mp4

@seaona
Copy link
Contributor

seaona commented Mar 1, 2024

why is this marked as Sev-1 though? 🤔

@NicolasMassart NicolasMassart removed the Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing label Mar 1, 2024
@NicolasMassart NicolasMassart merged commit 330f415 into main Mar 1, 2024
51 checks passed
@NicolasMassart NicolasMassart deleted the feat/8772_configurable_segment_flush branch March 1, 2024 14:04
@github-actions github-actions bot locked and limited conversation to collaborators Mar 1, 2024
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 1, 2024
@metamaskbot metamaskbot added the release-7.18.0 Issue or pull request that will be included in release 7.18.0 label Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-smoke-e2e release-7.18.0 Issue or pull request that will be included in release 7.18.0 team-mobile-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

feat: configurable Segment flush limit
4 participants