Skip to content

Commit

Permalink
chore: Add tags to UI Startup sentry transaction (#12286)
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**

Needs testing in QA build to verify tags

Android QA build:
https://app.bitrise.io/build/7d1397e9-b56a-488b-8b23-509d53b2989a?tab=log

Link showing the tags:
https://metamask.sentry.io/performance/trace/67e58676fea44614bac9ad8af72324cd/?dataset=transactions&field=title&field=project&field=user.display&field=timestamp&name=All%20Errors&node=txn-0ae4a10418b8431e88633814e51d032f&project=2651591&query=device%3AMAR-LX1B&queryDataset=transaction-like&sort=-timestamp&source=discover&statsPeriod=90d&timestamp=1731585973&yAxis=count%28%29

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- 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**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.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: Aslau Mario-Daniel <marioaslau@gmail.com>
  • Loading branch information
tommasini and MarioAslau authored Nov 14, 2024
1 parent 42e2c7e commit 4fa0c15
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions app/util/sentry/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { store } from '../../store';
import { Performance } from '../../core/Performance';
import Device from '../device';
import { TraceName } from '../trace';
import { getTraceTags } from './tags';
/**
* This symbol matches all object properties when used in a mask
*/
Expand Down Expand Up @@ -402,15 +403,19 @@ function rewriteReport(report) {
*/
export function excludeEvents(event) {
// This is needed because store starts to initialise before performance observers completes to measure app start time
if (event?.transaction === TraceName.UIStartup && Device.isAndroid()) {
const appLaunchTime = Performance.appLaunchTime;
const formattedAppLaunchTime = (event.start_timestamp = Number(
`${appLaunchTime.toString().slice(0, 10)}.${appLaunchTime
.toString()
.slice(10)}`,
));
if (event.start_timestamp !== formattedAppLaunchTime) {
event.start_timestamp = formattedAppLaunchTime;
if (event?.transaction === TraceName.UIStartup) {
event.tags = getTraceTags(store.getState());

if (Device.isAndroid()) {
const appLaunchTime = Performance.appLaunchTime;
const formattedAppLaunchTime = (event.start_timestamp = Number(
`${appLaunchTime.toString().slice(0, 10)}.${appLaunchTime
.toString()
.slice(10)}`,
));
if (event.start_timestamp !== formattedAppLaunchTime) {
event.start_timestamp = formattedAppLaunchTime;
}
}
}
//Modify or drop event here
Expand Down

0 comments on commit 4fa0c15

Please sign in to comment.