diff --git a/packages/core-mobile/android/app/build.gradle b/packages/core-mobile/android/app/build.gradle index 0ed1560a89..ab725245f0 100644 --- a/packages/core-mobile/android/app/build.gradle +++ b/packages/core-mobile/android/app/build.gradle @@ -158,6 +158,7 @@ dependencies { } else { implementation jscFlavor } + } task deleteDuplicateDependencies(type: Delete) { diff --git a/packages/core-mobile/app/App.tsx b/packages/core-mobile/app/App.tsx index 7fbef9bd24..060f0079d1 100644 --- a/packages/core-mobile/app/App.tsx +++ b/packages/core-mobile/app/App.tsx @@ -8,30 +8,38 @@ import { navigationRef } from 'utils/Navigation' import SentryService from 'services/sentry/SentryService' import DataDogService from 'services/datadog/DataDogService' import Logger from 'utils/Logger' +import { DatadogProvider } from '@datadog/mobile-react-native' +import { getDatadogConfig } from 'services/datadog/DataDogConfig' +import { SessionReplay } from '@datadog/mobile-react-native-session-replay' function App(): JSX.Element { const context = useApplicationContext() const [backgroundStyle] = useState(context.appBackgroundStyle) + SessionReplay.enable() + console.log(getDatadogConfig()) + return ( - - - { - SentryService.routingInstrumentation.registerNavigationContainer( - navigationRef - ) - DataDogService.init(navigationRef).catch(Logger.error) - }}> - - - - + + + + { + SentryService.routingInstrumentation.registerNavigationContainer( + navigationRef + ) + DataDogService.init(navigationRef).catch(Logger.error) + }}> + + + + + ) } diff --git a/packages/core-mobile/app/services/datadog/DataDogConfig.ts b/packages/core-mobile/app/services/datadog/DataDogConfig.ts index 432f08b5c9..2cc8d5c8a1 100644 --- a/packages/core-mobile/app/services/datadog/DataDogConfig.ts +++ b/packages/core-mobile/app/services/datadog/DataDogConfig.ts @@ -1,35 +1,40 @@ import { - DdSdkReactNativeConfiguration, - TrackingConsent + TrackingConsent, + DatadogProviderConfiguration, + SdkVerbosity, + InitializationMode, + BatchSize } from '@datadog/mobile-react-native' -import Config from 'react-native-config' import DeviceInfo from 'react-native-device-info' -let DataDogConfig: DdSdkReactNativeConfiguration | null = null +import { + APPLICATION_ID, + CLIENT_TOKEN, + ENVIRONMENT, + SITE +} from './ddCredentials' -if ( - Config.DD_CLIENT_TOKEN && - Config.ENVIRONMENT && - Config.DD_APPLICATION_ID && - Config.DD_SITE && - process.env.CI -) { - DataDogConfig = new DdSdkReactNativeConfiguration( - Config.DD_CLIENT_TOKEN, - Config.ENVIRONMENT, - Config.DD_APPLICATION_ID, +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +export function getDatadogConfig() { + const DataDogConfig = new DatadogProviderConfiguration( + CLIENT_TOKEN, + ENVIRONMENT, + APPLICATION_ID, true, true, true, - TrackingConsent.GRANTED + TrackingConsent.GRANTED, + true ) - - DataDogConfig.site = Config.DD_SITE DataDogConfig.nativeCrashReportEnabled = true - DataDogConfig.nativeViewTracking = true DataDogConfig.sessionSamplingRate = 100 + DataDogConfig.nativeViewTracking = true DataDogConfig.resourceTracingSamplingRate = 100 + DataDogConfig.site = SITE DataDogConfig.version = DeviceInfo.getBuildNumber() -} + DataDogConfig.verbosity = SdkVerbosity.DEBUG + DataDogConfig.initializationMode = InitializationMode.ASYNC + DataDogConfig.batchSize = BatchSize.SMALL -export default DataDogConfig + return DataDogConfig +} diff --git a/packages/core-mobile/app/services/datadog/ddCredentials.js b/packages/core-mobile/app/services/datadog/ddCredentials.js new file mode 100644 index 0000000000..11aa98bf6c --- /dev/null +++ b/packages/core-mobile/app/services/datadog/ddCredentials.js @@ -0,0 +1,4 @@ +export const APPLICATION_ID = `${process.env.DD_APP_KEY}` +export const CLIENT_TOKEN = `${process.env.DD_API_KEY}` +export const ENVIRONMENT = `production` +export const SITE = `US1` diff --git a/packages/core-mobile/package.json b/packages/core-mobile/package.json index a6b7152d4c..ab35755cef 100644 --- a/packages/core-mobile/package.json +++ b/packages/core-mobile/package.json @@ -39,7 +39,8 @@ "@coinbase/cbpay-js": "2.2.1", "@cubist-labs/cubesigner-sdk": "0.3.29", "@cubist-labs/cubesigner-sdk-ethers-v6": "0.3.29", - "@datadog/mobile-react-native": "2.4.3", + "@datadog/mobile-react-native": "^2.6.1", + "@datadog/mobile-react-native-session-replay": "^2.6.1", "@datadog/mobile-react-navigation": "2.4.3", "@date-fns/utc": "2.1.0", "@ethereumjs/common": "4.4.0", diff --git a/yarn.lock b/yarn.lock index 2405509a03..76fabf03d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -205,7 +205,8 @@ __metadata: "@coinbase/cbpay-js": 2.2.1 "@cubist-labs/cubesigner-sdk": 0.3.29 "@cubist-labs/cubesigner-sdk-ethers-v6": 0.3.29 - "@datadog/mobile-react-native": 2.4.3 + "@datadog/mobile-react-native": ^2.6.1 + "@datadog/mobile-react-native-session-replay": ^2.6.1 "@datadog/mobile-react-navigation": 2.4.3 "@date-fns/utc": 2.1.0 "@dlenroc/testrail": 1.9.1 @@ -4418,13 +4419,25 @@ __metadata: languageName: node linkType: hard -"@datadog/mobile-react-native@npm:2.4.3": - version: 2.4.3 - resolution: "@datadog/mobile-react-native@npm:2.4.3" +"@datadog/mobile-react-native-session-replay@npm:^2.6.1": + version: 2.6.1 + resolution: "@datadog/mobile-react-native-session-replay@npm:2.6.1" + peerDependencies: + react: ">=16.13.1" + react-native: ">=0.63.4 <1.0" + checksum: d3dc37582ef56df3d48fc7a230ef5422e399843986d2ed57c190ccb93cc6c9548b75fdaa5ecf3195b17bed29fe5fc4fd0f803c4e86a73bed471d4930e760474b + languageName: node + linkType: hard + +"@datadog/mobile-react-native@npm:^2.6.1": + version: 2.6.1 + resolution: "@datadog/mobile-react-native@npm:2.6.1" + dependencies: + big-integer: ^1.6.52 peerDependencies: react: ">=16.13.1" react-native: ">=0.63.4 <1.0" - checksum: c1baa070ce4ebc88c6e0e5237704a7cf16df343cf735cbe04494b32b9de9bdacdb93d0c218cad8bc074f29709d54a356b5bdd09573c9343c242f7093698bd100 + checksum: c62383f2191e85cf99820730911282c1d08e3a1a0f6258a3f41dd9ee9828d3ca7b6d504407bcf058ed2065548b99c8ddff4fc63754dc8c26e5cbe43188a5e4d8 languageName: node linkType: hard @@ -13574,7 +13587,7 @@ __metadata: languageName: node linkType: hard -"big-integer@npm:1.6.x": +"big-integer@npm:1.6.x, big-integer@npm:^1.6.52": version: 1.6.52 resolution: "big-integer@npm:1.6.52" checksum: 6e86885787a20fed96521958ae9086960e4e4b5e74d04f3ef7513d4d0ad631a9f3bde2730fc8aaa4b00419fc865f6ec573e5320234531ef37505da7da192c40b @@ -26645,7 +26658,7 @@ react-native-webview@ava-labs/react-native-webview: peerDependencies: react: "*" react-native: "*" - checksum: d396f3dea807077e8789e1d463c87024e1633481d3dff53c0650c82a08d8b7d699db97ceab4e8d2c9de85c3d5378d192c968487254c62edadff77e82a9b8c929 + checksum: 6cff7c4794fb7ae57c535938762daadaacf6140901fd4c2c575275aaeaee6586ee40e190b3a243498b67e2d766ad1c2da737d30aa0f15e29bf6f4e04b8fcec0c languageName: node linkType: hard