Open kesavarao-EB opened 1 week ago
But can see a warning on simulator. screeenshot attached.
**Possible unhandled promise rejection, Type error cannot read property "initialize" of null while calling await DdSdk.initialize()**
Not sure because of that RUM Data is not sent ![Uploading Screenshot 2024-06-29 at 7.55.15 PM.png…]()
Hello @kesavarao-EB!
I see that you are initialising the SDK multiple times. That is not the intended usage.
The DatadogProvider
already takes care of the initialization and you do not have to call the initialize method manually.
Alternatively you can remove the initialization and provider logic from the React Native side, and only keep the native initialization.
The side in which you choose to initialize the SDK is the one that you want auto-instrumentation to be activated on.
Please take a look at our documentation for Monitoring Hybrid React Native Applications.
In particular:
You can share the same instance of the core SDK between native and React Native without having to initialize the SDK on both sides separately. This allows you to initialize the native SDK on either the native side or on the React Native side (by calling DdSdkReactNative.initialize) and have it initialized for both sides, with events appearing in the same RUM session. React Native uses the default core instance. This means that you can use manual instrumentation on both sides, but auto-instrumentation is only activated for the side that the SDK was initialized.
Hi @marco-saia-datadog
In our system, DataDog RUM is already defined in iOS repo and it will working. We have react-native screens in seperate repo. But Native is using react native screens from react-native repo.
In this usecase, Please let us know if you want us to intiliaze with "fake_value" in the react-native repo ?
@marco-saia-datadog After adding only DataDogProvider in the index.js
return (
<DatadogProvider
configuration={getDatadogConfig(TrackingConsent.GRANTED)}
>
<View style={styles.background}>
<VirtualizedList
data={data}
renderItem={renderItem}
/>
</View>
</DatadogProvider>
);
getDatadogConfig function:
export function getDatadogConfig(trackingConsent: TrackingConsent) {
const config = new DatadogProviderConfiguration(
'CLIENT_TOKEN',
'ENVIRONMENT',
'APPLICATION_ID',
true,
true,
true,
trackingConsent
);
config.nativeCrashReportEnabled = true;
config.sessionSamplingRate = 100;
config.serviceName = 'manuakl Nightlife Service';
config.verbosity = SdkVerbosity.DEBUG;
return config;
}
Even added DdRum.startView("===Custom view renderItem ====")
In simulator logs, i can see the
DEBUG DATADOG: Starting RUM Resource #
DEBUG DATADOG: Stopping RUM Resource
DEBUG DATADOG: Starting RUM View “-=====Custom view renderItem ========” #Manual Key
DEBUG DATADOG: Starting RUM View “-=====Custom view renderItem ========” #Manual Key
In Simulator i can see the warning message. Not sure if this is causing the issue of not sending the data
Can i get any support here ?
Describe the bug
We have native apps (iOS and android) and DataDog RUM already been instrumented and working fine. We recently developed some screens using react native (FYI, React native code resides in a separate repo).
[ios app with RN] -Native APP is the main and some of pages are based out react-native.
GOAL - Instrument DataDog RUM for react native screens or project.
We followed this DOC and also example repo (ios-with-rn)
ISSUE - [in iOS] RUM data of react native screens are NOT sent to Datadog for iOS. Could not find under Digital Experience -> RUM -> Performance summary .
NOTE - Same code working in "ANDROID", we can see the custom view name being displayed in Datadog RUM under Android application.
below is my DataDogRUM initialisation code in both iOS and react-native repo
Ios :
In AppDelegate.swift, `.run { _ in
In react-native app repo :
index.tsx
}`
`
Reproduction steps
Initialize RUM as above
Open project in Xcode
Run the app in simulator
Navigate to native screens and react native screens
Go to Datadog RUM dashboard and looks for view names of react native screens.
SDK logs
======Datadog initialized============ [DATADOG SDK] 🐶 → 18:54:06.753 NTP time synchronization completed. 🔥 Datadog SDK usage error: The 'main' instance of SDK is already initialized.
DATADOG: Starting RUM Resource #1719669770474/GET GET: https://codepush.appcenter.ms/v0.1/public/codepush/update_check?deployment_key=PL&app_version=9.82.0&package_hash=b6fa7ea2f54828629&label=v250&client_unique_id=2E3B58C5-BC0B-****-8CDD-00000000000000 DATADOG: Stopping RUM Resource #1719669770474/GET status:200
Not Getting
Batch *** [4345 bytes] (RUM Request) sent successfully.
Which we are seeing for Android
Expected behavior
No response
Affected SDK versions
"@datadog/mobile-react-native": "^2.3.5", "@datadog/mobile-react-native-navigation": "^2.3.5", "@datadog/mobile-react-navigation": "^2.3.5", dd-sdk-ios : 2.5.0
Latest working SDK version
mobile-react-navigation": "^2.3.5", dd-sdk-ios : 2.5.0
Did you confirm if the latest SDK version fixes the bug?
Yes
Integration Methods
NPM
React Native Version
0.73.4
Package.json Contents
No response
iOS Setup
No response
Android Setup
No response
Device Information
No response
Other relevant information
No response