Description
I have a React Native application where I'm using Datadog for monitoring, and I'm trying to send RUM (Real User Monitoring) actions during the login process to track successful and failed login attempts. However, the actions are not being sent successfully, and I'm encountering the following issue.
Code
App.js:
import {
DdSdkReactNative,
DdSdkReactNativeConfiguration,
SdkVerbosity,
} from "@datadog/mobile-react-native";
const config = new DdSdkReactNativeConfiguration(
clientToken,
environmentName,
rumApplicationId,
true,
true,
true
);
config.site = "US5";
config.nativeCrashReportEnabled = true;
config.sessionSamplingRate = 80;
config.resourceTracingSamplingRate = 80;
config.firstPartyHosts = ["us5.datadoghq.com"];
config.serviceName = "mobile";
config.verbosity = SdkVerbosity.DEBUG;
DdSdkReactNative.initialize(config);
const App = () => {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<FlipperAsyncStorage />
<PaperProvider>
<NavigationContainer>
<AppStack />
</NavigationContainer>
</PaperProvider>
</GestureHandlerRootView>
);
};
export default App;
Login.js:
import { DdRum, RumActionType } from "@datadog/mobile-react-native";
const handleLogin = async () => {
try {
// code to check valid user
DdRum.addAction(RumActionType.TAP, 'login', {"app": 'mobile', "email": email.value, "status": "success"}, Date.now());
} catch (error) {
DdRum.addAction(RumActionType.TAP, 'login', {"app": 'mobile', "email": email.value, "status": "failure"}, Date.now());
console.log(error);
}
};
Issue
The RUM actions are not being sent successfully, and the terminal logs show the following:
DEBUG DATADOG: Adding RUM Action “RCTView” (TAP)
DEBUG DATADOG: Starting RUM Resource #1706102314622/POST POST: http://192.168.1.112:3001/api/auth/login/mobile
DEBUG DATADOG: Stopping RUM Resource #1706102314622/POST status:401
DEBUG DATADOG: Adding RUM Action “login” (TAP)
Additional Information
- I have already initialized Datadog in the
App.jsfile. - The code for handling login attempts and adding RUM actions is in a separate file (
Login.js). - The actions are not being sent, and the status code 401 suggests a failed login attempt.
Question
What could be causing the failure of RUM actions being sent during the login process, and how can I resolve this issue? Any insights or suggestions would be greatly appreciated.
Screenshot of datadog dashboard
