-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Metrics adjustments #15313
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
Metrics adjustments #15313
Changes from all commits
ba1becb
31f0ffc
dfba519
1eba37b
648f49f
791dfac
7173829
f6ae2f6
d7202b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,17 @@ export default function setupSentry({ release, getState }) { | |
| environment, | ||
| integrations: [new Dedupe(), new ExtraErrorData()], | ||
| release, | ||
| beforeSend: (report) => rewriteReport(report), | ||
| beforeSend: (report) => { | ||
| if (getState) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried testing this, and there is still a call made to Sentry upon Typically I would suggest delaying the call to But for us that might not work, because I suspect that Assuming that is true, we might be able to effectively stop all communication by passing in a custom transport. The transport option can be used to handle proxies and things like that, so I would expect it to affect absolutely all communication, even the initial call. Apparently Another option would be to restart the process after opt-in, and somehow communicate to this bundle that the user opted in 🤔 Challenging since it would have to run before the controllers. This would certainly be more disruptive than the other option.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to consider this non-blocking for this PR because what you have implemented so far is still an improvement, it's just not a complete solution yet.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I will merge and then create a ticket to address the issues you have raised here. |
||
| const appState = getState(); | ||
| if (!appState?.store?.metamask?.participateInMetaMetrics) { | ||
| return null; | ||
| } | ||
| } else { | ||
| return null; | ||
| } | ||
| return rewriteReport(report); | ||
| }, | ||
| }); | ||
|
|
||
| function rewriteReport(report) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /** | ||
| * Return a "masked" copy of the given object. | ||
| * | ||
| * The returned object includes only the properties present in the mask. The | ||
| * mask is an object that mirrors the structure of the given object, except | ||
| * the only values are `true` or a sub-mask. `true` implies the property | ||
| * should be included, and a sub-mask implies the property should be further | ||
| * masked according to that sub-mask. | ||
| * | ||
| * @param {Object} object - The object to mask | ||
| * @param {Object<Object|boolean>} mask - The mask to apply to the object | ||
| */ | ||
| export function maskObject(object, mask) { | ||
| return Object.keys(object).reduce((state, key) => { | ||
| if (mask[key] === true) { | ||
| state[key] = object[key]; | ||
| } else if (mask[key]) { | ||
| state[key] = maskObject(object[key], mask[key]); | ||
| } | ||
| return state; | ||
| }, {}); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.