Skip to content
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

Feat: Report as app context what's the current screen during the error #3339

Merged
merged 12 commits into from
Nov 13, 2023

Conversation

lucas-zimerman
Copy link
Collaborator

@lucas-zimerman lucas-zimerman commented Oct 13, 2023

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

This feature adds the current screen name into the app's context.

The tag is being set here

private _onConfirmRoute(context: TransactionContext): void {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
this._currentRoute = context.data?.route?.name;
this._getCurrentHub?.().configureScope(scope => {
if (context.data) {
const contextData = context.data as RouteChangeContextData;
scope.addBreadcrumb({
category: 'navigation',
type: 'navigation',
// We assume that context.name is the name of the route.
message: `Navigation to ${context.name}`,
data: {
from: contextData.previousRoute?.name,
to: contextData.route.name,
},
});
}
scope.setTag('routing.route.name', context.name);
});
}

and later is being checked by the device context to be inserted into native events.

We could later remove this tag but it will become a break change so for the time being we can keep both the tag and the context.

I think the current implementation is OK, the only bother that I have with it is checking the tags for this information, ideally there should have another parameter to retrieve this information. I was thinking of using

      scope.setContext('app', { 'view_names':  [context.name ] });

but that removes the app context instead of updating it.

NOTE: Tests will be added once the main logic form this code is approved.

💡 Motivation and Context

#2994

💚 How did you test it?

https://sentry-sdks.sentry.io/issues/4058613036/events/ae3a1c915f2e4fc993938748da6199d2/?project=5428561

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • All tests passing
  • No breaking changes

🔮 Next steps

Close #2994

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 9352f56

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 411.65 ms 437.25 ms 25.60 ms
Size 17.73 MiB 19.85 MiB 2.12 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e5c9b8b 409.02 ms 426.66 ms 17.64 ms
d0bf494+dirty 375.37 ms 395.14 ms 19.77 ms
575f9da 415.26 ms 422.98 ms 7.72 ms
0db0c72 372.12 ms 386.00 ms 13.88 ms
e73f4ed+dirty 332.96 ms 354.33 ms 21.37 ms
acadc0f+dirty 373.24 ms 381.51 ms 8.27 ms
8900e1a+dirty 430.68 ms 456.13 ms 25.44 ms
3ffcddd 302.92 ms 315.80 ms 12.88 ms
d361d38 354.10 ms 381.69 ms 27.59 ms
f06c879 408.41 ms 424.54 ms 16.13 ms

App size

Revision Plain With Sentry Diff
e5c9b8b 17.73 MiB 19.83 MiB 2.10 MiB
d0bf494+dirty 17.73 MiB 19.75 MiB 2.02 MiB
575f9da 17.73 MiB 19.83 MiB 2.10 MiB
0db0c72 17.73 MiB 19.75 MiB 2.02 MiB
e73f4ed+dirty 17.73 MiB 20.04 MiB 2.31 MiB
acadc0f+dirty 17.73 MiB 19.75 MiB 2.01 MiB
8900e1a+dirty 17.73 MiB 19.75 MiB 2.01 MiB
3ffcddd 17.73 MiB 19.75 MiB 2.02 MiB
d361d38 17.73 MiB 19.81 MiB 2.08 MiB
f06c879 17.73 MiB 19.85 MiB 2.12 MiB

Previous results on branch: feat/app-screen-name

Startup times

Revision Plain With Sentry Diff
b90f3a5 421.14 ms 471.40 ms 50.26 ms
9765bce 360.78 ms 374.96 ms 14.18 ms

App size

Revision Plain With Sentry Diff
b90f3a5 17.73 MiB 19.85 MiB 2.12 MiB
9765bce 17.73 MiB 19.85 MiB 2.12 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1225.78 ms 1238.80 ms 13.02 ms
Size 2.36 MiB 2.88 MiB 528.99 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d0bf494+dirty 1289.40 ms 1298.40 ms 9.00 ms
3853f43+dirty 1221.82 ms 1242.64 ms 20.82 ms
e73f4ed+dirty 1243.27 ms 1244.52 ms 1.25 ms
9c48b2c+dirty 1246.96 ms 1255.73 ms 8.77 ms
27ef4ee+dirty 1293.52 ms 1296.08 ms 2.56 ms
6e8584e+dirty 1274.50 ms 1296.82 ms 22.32 ms
acadc0f+dirty 1264.38 ms 1290.06 ms 25.68 ms
8900e1a+dirty 1210.27 ms 1218.66 ms 8.39 ms
e2b64fe+dirty 1232.22 ms 1255.20 ms 22.98 ms
e5c9b8b+dirty 1258.57 ms 1267.32 ms 8.75 ms

App size

Revision Plain With Sentry Diff
d0bf494+dirty 2.36 MiB 2.83 MiB 481.15 KiB
3853f43+dirty 2.36 MiB 2.85 MiB 499.81 KiB
e73f4ed+dirty 2.36 MiB 2.82 MiB 469.44 KiB
9c48b2c+dirty 2.36 MiB 2.85 MiB 495.77 KiB
27ef4ee+dirty 2.36 MiB 2.85 MiB 500.03 KiB
6e8584e+dirty 2.36 MiB 2.88 MiB 533.17 KiB
acadc0f+dirty 2.36 MiB 2.83 MiB 480.37 KiB
8900e1a+dirty 2.36 MiB 2.83 MiB 479.25 KiB
e2b64fe+dirty 2.36 MiB 2.85 MiB 495.80 KiB
e5c9b8b+dirty 2.36 MiB 2.87 MiB 520.43 KiB

Previous results on branch: feat/app-screen-name

Startup times

Revision Plain With Sentry Diff
b90f3a5+dirty 1256.77 ms 1272.43 ms 15.66 ms
9765bce+dirty 1219.48 ms 1246.42 ms 26.94 ms

App size

Revision Plain With Sentry Diff
b90f3a5+dirty 2.36 MiB 2.88 MiB 530.49 KiB
9765bce+dirty 2.36 MiB 2.88 MiB 530.41 KiB

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 332.43 ms 338.60 ms 6.17 ms
Size 7.15 MiB 8.12 MiB 997.97 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d0bf494+dirty 253.73 ms 308.23 ms 54.49 ms
3853f43+dirty 278.12 ms 338.72 ms 60.60 ms
e73f4ed+dirty 262.98 ms 311.02 ms 48.04 ms
9c48b2c+dirty 270.82 ms 321.12 ms 50.30 ms
27ef4ee+dirty 296.71 ms 351.00 ms 54.29 ms
6e8584e+dirty 383.37 ms 400.84 ms 17.47 ms
acadc0f+dirty 259.04 ms 304.67 ms 45.63 ms
8900e1a+dirty 371.40 ms 377.70 ms 6.31 ms
e2b64fe+dirty 258.82 ms 304.26 ms 45.44 ms
e5c9b8b+dirty 335.40 ms 360.06 ms 24.67 ms

App size

Revision Plain With Sentry Diff
d0bf494+dirty 7.15 MiB 8.04 MiB 910.85 KiB
3853f43+dirty 7.15 MiB 8.08 MiB 959.34 KiB
e73f4ed+dirty 7.15 MiB 8.09 MiB 965.94 KiB
9c48b2c+dirty 7.15 MiB 8.07 MiB 947.16 KiB
27ef4ee+dirty 7.15 MiB 8.08 MiB 959.49 KiB
6e8584e+dirty 7.15 MiB 8.13 MiB 1002.18 KiB
acadc0f+dirty 7.15 MiB 8.03 MiB 903.20 KiB
8900e1a+dirty 7.15 MiB 8.03 MiB 901.79 KiB
e2b64fe+dirty 7.15 MiB 8.07 MiB 947.16 KiB
e5c9b8b+dirty 7.15 MiB 8.10 MiB 980.41 KiB

Previous results on branch: feat/app-screen-name

Startup times

Revision Plain With Sentry Diff
b90f3a5+dirty 352.27 ms 373.54 ms 21.27 ms
9765bce+dirty 328.40 ms 363.96 ms 35.56 ms

App size

Revision Plain With Sentry Diff
b90f3a5+dirty 7.15 MiB 8.12 MiB 997.96 KiB
9765bce+dirty 7.15 MiB 8.12 MiB 997.85 KiB

@lucas-zimerman lucas-zimerman marked this pull request as ready for review October 20, 2023 13:45
Copy link
Contributor

github-actions bot commented Oct 31, 2023

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1269.18 ms 1288.14 ms 18.96 ms
Size 2.92 MiB 3.44 MiB 531.85 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d0bf494+dirty 1266.20 ms 1267.52 ms 1.32 ms
3853f43+dirty 1271.74 ms 1278.04 ms 6.30 ms
e73f4ed+dirty 1282.90 ms 1309.30 ms 26.40 ms
9c48b2c+dirty 1253.39 ms 1256.30 ms 2.91 ms
27ef4ee+dirty 1236.41 ms 1244.90 ms 8.49 ms
6e8584e+dirty 1271.71 ms 1281.26 ms 9.55 ms
acadc0f+dirty 1271.12 ms 1272.28 ms 1.16 ms
8900e1a+dirty 1268.36 ms 1273.04 ms 4.68 ms
e2b64fe+dirty 1285.78 ms 1297.56 ms 11.78 ms
e5c9b8b+dirty 1276.90 ms 1280.92 ms 4.02 ms

App size

Revision Plain With Sentry Diff
d0bf494+dirty 2.92 MiB 3.40 MiB 488.08 KiB
3853f43+dirty 2.92 MiB 3.41 MiB 503.54 KiB
e73f4ed+dirty 2.92 MiB 3.38 MiB 475.71 KiB
9c48b2c+dirty 2.92 MiB 3.41 MiB 499.97 KiB
27ef4ee+dirty 2.92 MiB 3.41 MiB 503.72 KiB
6e8584e+dirty 2.92 MiB 3.44 MiB 536.52 KiB
acadc0f+dirty 2.92 MiB 3.39 MiB 487.34 KiB
8900e1a+dirty 2.92 MiB 3.39 MiB 485.96 KiB
e2b64fe+dirty 2.92 MiB 3.41 MiB 499.97 KiB
e5c9b8b+dirty 2.92 MiB 3.43 MiB 524.50 KiB

Previous results on branch: feat/app-screen-name

Startup times

Revision Plain With Sentry Diff
b90f3a5+dirty 1295.88 ms 1296.48 ms 0.60 ms
9765bce+dirty 1289.73 ms 1297.12 ms 7.39 ms

App size

Revision Plain With Sentry Diff
b90f3a5+dirty 2.92 MiB 3.44 MiB 533.42 KiB
9765bce+dirty 2.92 MiB 3.44 MiB 533.31 KiB

@krystofwoldrich
Copy link
Member

Thanks this looks good. I just have two performance suggestions to avoid creating unnecessary objects.

Co-authored-by: Kryštof Woldřich <[email protected]>
Copy link
Member

@krystofwoldrich krystofwoldrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good.

@krystofwoldrich krystofwoldrich merged commit f795294 into main Nov 13, 2023
50 checks passed
@krystofwoldrich krystofwoldrich deleted the feat/app-screen-name branch November 13, 2023 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report as app context what's the current screen during the error
2 participants