[Sentry] Add tags and attributes for easier user grouping - #81052
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@alitoshmatov Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
| if (!value) { | ||
| return; | ||
| } | ||
| sendReportsCountTag(Object.keys(value).length); |
There was a problem hiding this comment.
❌ PERF-11 (docs)
This Onyx connection subscribes to the entire REPORT collection, causing the callback to re-execute whenever ANY report changes in ANY way (e.g., a message is added, status changes, metadata updates). Since the callback only needs the COUNT of reports, this creates unnecessary re-renders and performance overhead.
Suggested fix: Consider implementing a more optimized approach:
- Track report count separately in Onyx (e.g., as a separate key like
REPORT_COUNT) - Or use a selector that only returns the count/keys to minimize data processing
- Or debounce the tag update to avoid excessive Sentry API calls
Example with selector (though this still triggers on any report change):
Onyx.connectWithoutView({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
selector: (reports) => Object.keys(reports ?? {}).length,
callback: (count) => {
if (!count) {
return;
}
sendReportsCountTag(count);
},
});However, the ideal solution would be tracking report count separately to avoid re-computation on every report change.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
There is right in fact that we connect to large dataset.
This altough is not used in any screen component so comment is wrong about rerenders overhead.
Onyx.connectWithoutView does not have selector prop
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b802b826fd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
cc: @adhorodyski @rlinoz this is ready for review |
|
No product considerations |
| * Middleware that copies specific tags from the transaction event to all child spans. | ||
| * This ensures that child spans inherit important context from the parent transaction. | ||
| */ | ||
| const copyTagsToChildSpans: TelemetryBeforeSend = (event) => { |
There was a problem hiding this comment.
I'm ok with this one if it's really the only way of getting the same information from a transaction within the dashboard 👍🏻
adhorodyski
left a comment
There was a problem hiding this comment.
LGTM, discussed this during the onshore.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.11-40 🚀
|
|
It is internal, I can test it. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|
Explanation of Change
This PR introduces new tags attached to Sentry's spans which are:
We do so to enhance further analysis and reporting about how our application behaves for different kinds of user. We segment users by account size
Fixed Issues
$ #80531
PROPOSAL:
Tests
Go to Sentry and verify the new attributes show up
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari