Skip to content

Commit

Permalink
remove changes to beforeSend
Browse files Browse the repository at this point in the history
  • Loading branch information
brad-decker committed Jul 25, 2023
1 parent 3c75a8e commit 9dff5a3
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,22 @@ export default function setupSentry({ release, getState }) {
autoSessionTracking: false,
environment,
integrations: [
/**
* Filtering of events must happen in this FilterEvents custom
* integration instead of in the beforeSend handler because the Dedupe
* integration is unaware of the beforeSend functionality. If an event is
* queued in the sentry context, additional events of the same name will
* be filtered out by Dedupe even if the original event was not sent due
* to the beforeSend method returning null.
*
* @see https://github.com/MetaMask/metamask-extension/pull/15677
*/
new FilterEvents({ getMetaMetricsEnabled }),
new Dedupe(),
new ExtraErrorData(),
],
release,
/**
* As additional insurance over the FilterEvents integration, we check the
* participateInMetaMetrics flag here and return null if the user has
* opted out of metrics. This prevents the payload from being sent. This
* change may result in the FilterEvents integration no longer being
* necessary, but that should be tested and executed in a future PR.
*
* TODO: Potentially remove the FilterEvents integration.
*
* @param {import('@sentry/types').Event} report - A sentry error event
* @returns {import('@sentry/types').Event} the modified report
*/
beforeSend: (report) => {
if (getMetaMetricsEnabled() === false) {
return null;
}
return rewriteReport(report, getState);
},
beforeSend: (report) => rewriteReport(report, getState),
beforeBreadcrumb: beforeBreadcrumb(getState),
});

Expand Down

0 comments on commit 9dff5a3

Please sign in to comment.