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

chore: enable sentry performance metrics #10720

Merged
merged 28 commits into from
Sep 10, 2024
Merged

Conversation

brainbicycle
Copy link
Contributor

@brainbicycle brainbicycle commented Sep 5, 2024

This PR resolves PHIRE-1142

Description

This enables support for starting to collect tracing data in sentry by hooking into our react navigation setup following the docs here.

You can see some metrics in our performance dashboard here.

Follow ups:

  • Go over the performance dashboard in mobile practice
  • Look into enabling profiler on core screens
  • Review bootstrap set up, if it is necessary, should we do differently

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

iOS user-facing changes

Android user-facing changes

Dev changes

  • enable navigation performance metrics in sentry - brian

Need help with something? Have a look at our docs, or get in touch with us.

@brainbicycle brainbicycle self-assigned this Sep 5, 2024
@brainbicycle brainbicycle marked this pull request as draft September 5, 2024 21:05
Copy link
Member

@gkartalis gkartalis left a comment

Choose a reason for hiding this comment

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

This looks great!

Thank you for adding it to all NavigationContainer components! 👏👏👏

@@ -163,4 +164,5 @@ const InnerApp = () => (
</Providers>
)

export const App = codePush(codePushOptions)(InnerApp)
const SentryApp = Sentry.wrap(InnerApp)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

possibly we should wrap the Main component rather than whole app 👀 double check. this may need to happen after setup is called

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -38,3 +39,5 @@ export const HomeContainer = () => {

return <HomeQueryRenderer />
}

export const HomeContainer = Sentry.withProfiler(InnerHomeContainer)
Copy link
Contributor Author

@brainbicycle brainbicycle Sep 7, 2024

Choose a reason for hiding this comment

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

not 100% this is doing anything currently, double check, this should give us more react profile style metrics in home screen transactions, but I didn't see much of a difference before and after

src/app/App.tsx Outdated Show resolved Hide resolved
* artwork in the home screen will fire as `screen:home` instead of `screen:artwork`.
* To fix it we find the focused route and update the context name to the correct screen name.
* This should be updated if we change our navigation setup.
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

funkiness do to our nav set up, let me know if the comment makes sense, the good news is most screens fire and get registered as transactions but we need to update the names manually

@@ -17,7 +17,7 @@ if (__DEV__) {
} catch {}
}

require("./src/app/system/errorReporting/sentrySetup").setupSentry({ environment: "bootstrap" })
require("./src/app/system/errorReporting/setupSentry").setupSentry({ environment: "bootstrap" })
Copy link
Contributor Author

@brainbicycle brainbicycle Sep 8, 2024

Choose a reason for hiding this comment

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

I think we should probably remove this, I will do as separate pr to avoid too much in this one. I am guessing the intention was to initialize sentry early to catch errors early in app lifecycle, but I think we pay for it with complexity in our reporting having an extra env, and initializing 2x might be leading to subtler bugs in our reporting.

@brainbicycle brainbicycle marked this pull request as ready for review September 9, 2024 17:55
@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Sep 9, 2024

This PR contains the following changes:

  • Dev changes (enable navigation performance metrics in sentry - brian)

Generated by 🚫 dangerJS against 1f13bf4

@brainbicycle brainbicycle changed the title chore: sentry performance chore: enable sentry performance metrics Sep 9, 2024
} else {
toast.show("Sentry debugging disabled", "middle")
}
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since sentry set up is no longer in a hook because it needs to be earlier in the lifecycle, call it manually on change.

gkartalis
gkartalis previously approved these changes Sep 10, 2024
Copy link
Member

@gkartalis gkartalis left a comment

Choose a reason for hiding this comment

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

I like the idea of the dev toggle to change env, thanks for adding that!

@@ -54,6 +55,14 @@ if (__DEV__) {

setupFlipper()

// Sentry must be setup early in the app lifecycle to hook into navigation
const debugSentry = unsafe_getDevToggle("DTDebugSentry")
Copy link
Member

Choose a reason for hiding this comment

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

👏 gread idea adding a dev toggle

@brainbicycle brainbicycle merged commit 3dcf459 into main Sep 10, 2024
7 checks passed
@brainbicycle brainbicycle deleted the brian/sentry-performance branch September 10, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants