···10101111import 'view/icons'
12121313-import {withSentry} from 'lib/sentry'
1413import {ThemeProvider} from 'lib/ThemeContext'
1514import {s} from 'lib/styles'
1615import {RootStoreModel, setupState, RootStoreProvider} from './state'
···6261 )
6362})
64636565-export default withSentry(App)
6464+export default App
-7
src/Navigation.tsx
···3434import {router} from './routes'
3535import {usePalette} from 'lib/hooks/usePalette'
3636import {useStores} from './state'
3737-import {getRoutingInstrumentation} from 'lib/sentry'
3837import {bskyTitle} from 'lib/strings/headings'
3938import {JSX} from 'react/jsx-runtime'
4039import {timeout} from 'lib/async/timeout'
···478477 )
479478 console.log(`Time to first paint: ${initMs} ms`)
480479 logModuleInitTrace()
481481-482482- // Register the navigation container with the Sentry instrumentation (only works on native)
483483- if (isNative) {
484484- const routingInstrumentation = getRoutingInstrumentation()
485485- routingInstrumentation.registerNavigationContainer(navigationRef)
486486- }
487480 }}>
488481 {children}
489482 </NavigationContainer>
+2-46
src/lib/sentry.ts
···11-import {isNative, isWeb} from 'platform/detection'
22-import {FC} from 'react'
33-import * as Sentry from 'sentry-expo'
44-55-// Sentry Initialization
66-77-export const getRoutingInstrumentation = () => {
88- return new Sentry.Native.ReactNavigationInstrumentation() // initialize this in `onReady` prop of NavigationContainer
99-}
11+import {init} from 'sentry-expo'
1021111-Sentry.init({
33+init({
124 dsn: 'https://05bc3789bf994b81bd7ce20c86ccd3ae@o4505071687041024.ingest.sentry.io/4505071690514432',
135 enableInExpoDevelopment: false, // if true, Sentry will try to send events/errors in development mode.
146 debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
157 environment: __DEV__ ? 'development' : 'production', // Set the environment
1616- // @ts-ignore exists but not in types, see https://docs.sentry.io/platforms/react-native/configuration/options/#enableAutoPerformanceTracking
1717- enableAutoPerformanceTracking: true, // Enable auto performance tracking
1818- tracesSampleRate: 0.5, // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // TODO: this might be too much in production
1919- _experiments: {
2020- // The sampling rate for profiling is relative to TracesSampleRate.
2121- // In this case, we'll capture profiles for 50% of transactions.
2222- profilesSampleRate: 0.5,
2323- },
2424- integrations: isNative
2525- ? [
2626- new Sentry.Native.ReactNativeTracing({
2727- shouldCreateSpanForRequest: url => {
2828- // Do not create spans for outgoing requests to a `/logs` endpoint as it is too noisy due to expo
2929- return !url.match(/\/logs$/)
3030- },
3131- routingInstrumentation: getRoutingInstrumentation(),
3232- }),
3333- ]
3434- : [], // no integrations for web, yet
358})
3636-3737-// if web, use Browser client, otherwise use Native client
3838-export function getSentryClient() {
3939- if (isWeb) {
4040- return Sentry.Browser
4141- }
4242- return Sentry.Native
4343-}
4444-4545-// wrap root App component with Sentry for automatic touch event tracking and performance monitoring
4646-export function withSentry(Component: FC) {
4747- if (isWeb) {
4848- return Component // .wrap is not required or available for web
4949- }
5050- const sentryClient = getSentryClient()
5151- return sentryClient.wrap(Component)
5252-}