21 Jul 2026
08:06 PM
- last edited on
03 Aug 2026
08:27 AM
by
MaciejNeumann
I have a React Native app with the following configuration:
dynatrace.config.js:
module.exports = {
react: {
debug: true,
lifecycle: {
/**
* Decide if you want to see Update Cycles as well
*/
includeUpdate: false,
/**
* Filter for Instrumenting Lifecycle of Components / True = Will be instrumented
*/
instrument: (filename) => {
return false;
},
},
input: {
/**
* Allows you to filter the instrumentation for touch events, refresh events and picker events in certain files
* True = Will be instrumented
*/
instrument: (filename) => {
return true;
},
},
},
android: {
// Those configs are copied 1:1
config: `
dynatrace {
configurations {
defaultConfig {
autoStart {
applicationId 'XXXXXXXXXXXXXXXXXXXXX'
beaconUrl 'https://XXXXXXX.bf.dynatrace.com/mbeacon'
}
userOptIn true
agentBehavior.startupLoadBalancing true
agentBehavior.startupWithGrailEnabled true
sessionReplay.enabled false
}
}
}
`,
},
ios: {
// Those configs are copied 1:1
config: `
<key>DTXApplicationID</key>
<string>XXXXXXXXXXXXXXXXXXXXX</string>
<key>DTXBeaconURL</key>
<string>https://XXXXXXX.bf.dynatrace.com/mbeacon</string>
<key>DTXLogLevel</key>
<string>ALL</string>
<key>DTXUserOptIn</key>
<true/>
<key>DTXStartupLoadBalancing</key>
<true/>
<key>DTXStartupWithGrailEnabled</key>
<true/>
`,
},
};
Within the babel.config.js configuration I have:
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['react-native-reanimated/plugin', '@dynatrace/react-native-plugin/instrumentation/BabelPluginDynatrace']
};
In my build.gradle file I have:
buildscript {
ext {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 35
ndkVersion = "28.0.12433566"
kotlinVersion = "2.0.21"
androidXAnnotation = "1.2.0"
androidXBrowser = "1.8.0"
}
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath 'com.google.gms:google-services:4.4.1'
classpath "com.dynatrace.tools.android:gradle-plugin:8.341.1.1004"
}
}
apply plugin: "com.facebook.react.rootproject"
The functions I have defined to use within the app are:
export const dynatraceStart = () => {
const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Performance, true);
Dynatrace.applyUserPrivacyOptions(privacyConfig);
};
export const dynatraceReportString = (actionName: string, actionValue: string) => {
const myAction = Dynatrace.enterManualAction(actionName);
myAction.reportStringValue(actionName, actionValue);
myAction.leaveAction();
};
export const dynatraceAsyncReportString = async (actionName: string, actionValue: string) => {
setTimeout(() => {
const myAction = Dynatrace.enterManualAction(actionName);
myAction.reportStringValue(actionName, actionValue);
myAction.leaveAction();
}, 1500);
};
export const dynatraceReportEvent = (eventName: string) => {
const myAction = Dynatrace.enterManualAction(eventName);
myAction.reportEvent(eventName);
myAction.leaveAction();
};
export const dynatraceReportError = (errorName: string, errorCode: number) => {
const myAction = Dynatrace.enterManualAction(errorName);
myAction.reportError(errorName, errorCode);
myAction.leaveAction();
};
export const dynatraceReportCrash = (crashName: string, reason: string, stacktrace: string) => {
Dynatrace.reportCrash(crashName, reason, stacktrace);
};
export const dynatraceReportCrashwithException = (crashName: string, crash: Error) => {
Dynatrace.reportCrashWithException(crashName, crash);
};
export const withMonitoringDynatrace = (Component: any) => {
Dynatrace.withMonitoring(Component);
};
export const dynatraceIdentifyUser = (user: string) => {
Dynatrace.identifyUser(user);
};
export const dynatraceGeolocation = (latitude: number, longitude: number) => {
Dynatrace.setGPSLocation(latitude, longitude);
};
export const dynatraceEndSession = () => {
Dynatrace.endSession();
};
This configuration correctly reported events to the Dynatrace platform when I had React Native version 0.71. When I updated React Native to 0.78.3 and enabled the new React Native architecture, events stopped reaching the Dynatrace web platform on Android. The Metro console shows that the Dynatrace plugin is responding to user events, BUT those user events are NOT reaching the platform. What could be happening?
Solved! Go to Solution.
04 Aug 2026 07:29 AM
Please reach out to Dynatrace Support for such issues.
07 Aug 2026 09:51 PM
Thank you! I managed to solve it! For some reason in my app, when I tried to apply npx instrumentDynatrace, inside, it didn't apply all the changes inside my android/build.gradle. When I fixed that, the problem disappeared.
Thank you for your time!
Featured Posts