-7
__mocks__/sentry-expo.js
-7
__mocks__/sentry-expo.js
+1
-2
src/App.native.tsx
+1
-2
src/App.native.tsx
···
10
10
11
11
import 'view/icons'
12
12
13
-
import {withSentry} from 'lib/sentry'
14
13
import {ThemeProvider} from 'lib/ThemeContext'
15
14
import {s} from 'lib/styles'
16
15
import {RootStoreModel, setupState, RootStoreProvider} from './state'
···
62
61
)
63
62
})
64
63
65
-
export default withSentry(App)
64
+
export default App
+2
-46
src/lib/sentry.ts
+2
-46
src/lib/sentry.ts
···
1
-
import {isNative, isWeb} from 'platform/detection'
2
-
import {FC} from 'react'
3
-
import * as Sentry from 'sentry-expo'
4
-
5
-
// Sentry Initialization
6
-
7
-
export const getRoutingInstrumentation = () => {
8
-
return new Sentry.Native.ReactNavigationInstrumentation() // initialize this in `onReady` prop of NavigationContainer
9
-
}
1
+
import {init} from 'sentry-expo'
10
2
11
-
Sentry.init({
3
+
init({
12
4
dsn: 'https://05bc3789bf994b81bd7ce20c86ccd3ae@o4505071687041024.ingest.sentry.io/4505071690514432',
13
5
enableInExpoDevelopment: false, // if true, Sentry will try to send events/errors in development mode.
14
6
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
15
7
environment: __DEV__ ? 'development' : 'production', // Set the environment
16
-
// @ts-ignore exists but not in types, see https://docs.sentry.io/platforms/react-native/configuration/options/#enableAutoPerformanceTracking
17
-
enableAutoPerformanceTracking: true, // Enable auto performance tracking
18
-
tracesSampleRate: 0.5, // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // TODO: this might be too much in production
19
-
_experiments: {
20
-
// The sampling rate for profiling is relative to TracesSampleRate.
21
-
// In this case, we'll capture profiles for 50% of transactions.
22
-
profilesSampleRate: 0.5,
23
-
},
24
-
integrations: isNative
25
-
? [
26
-
new Sentry.Native.ReactNativeTracing({
27
-
shouldCreateSpanForRequest: url => {
28
-
// Do not create spans for outgoing requests to a `/logs` endpoint as it is too noisy due to expo
29
-
return !url.match(/\/logs$/)
30
-
},
31
-
routingInstrumentation: getRoutingInstrumentation(),
32
-
}),
33
-
]
34
-
: [], // no integrations for web, yet
35
8
})
36
-
37
-
// if web, use Browser client, otherwise use Native client
38
-
export function getSentryClient() {
39
-
if (isWeb) {
40
-
return Sentry.Browser
41
-
}
42
-
return Sentry.Native
43
-
}
44
-
45
-
// wrap root App component with Sentry for automatic touch event tracking and performance monitoring
46
-
export function withSentry(Component: FC) {
47
-
if (isWeb) {
48
-
return Component // .wrap is not required or available for web
49
-
}
50
-
const sentryClient = getSentryClient()
51
-
return sentryClient.wrap(Component)
52
-
}