Skip to content

Commit

Permalink
chore: Adding installType to Sentry Tags for easy filtering (#28084)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
InstallType is a recently added flag to help quickly determine whether a
Sentry issue is coming from a natural webstore install, or a developer
environment. We want to be able to filter by this flag in the Sentry UI.

Added the tag, but also simplified some previous logic from when I added
extensionId to make adding extra attributes less tedious in the future.
We can also use this pattern for tags.
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28084?quickstart=1)

## **Related issues**

Fixes: #27667 

## **Manual testing steps**

1. Open App
2. Use developer options to trigger a sentry error
3. Go into Sentry UI and verify that installType is a tag in addition to
being in the extra properties.

## **Screenshots/Recordings**
<img width="320" alt="Screenshot 2024-10-24 at 1 04 59 PM"
src="https://github.com/user-attachments/assets/3ff828a5-c218-4222-9681-9001193380a0">
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.

---------

Co-authored-by: Harika <153644847+hjetpoluru@users.noreply.github.com>
  • Loading branch information
vthomas13 and hjetpoluru authored Nov 1, 2024
1 parent 2de414e commit 59044a4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,17 @@ export function rewriteReport(report) {
if (!report.extra) {
report.extra = {};
}

report.extra.appState = appState;
if (browser.runtime && browser.runtime.id) {
report.extra.extensionId = browser.runtime.id;
if (!report.tags) {
report.tags = {};
}
report.extra.installType = installType;

Object.assign(report.extra, {
appState,
installType,
extensionId: browser.runtime?.id,
});

report.tags.installType = installType;
} catch (err) {
log('Error rewriting report', err);
}
Expand Down

0 comments on commit 59044a4

Please sign in to comment.