I have the following issue:
Trigger
An uncaught exception is being thrown and datadog logs SDK sends request to log the incident.
Expected outcome
One request is sent/incident and the incident is logged only once in Datadog UI.
Actual outcome
Datadog logs SDK sends many requests/incident (between 1k-2.5k) and the incident is logged many times in Datadog UI.
Additional Information
When disabling the Datadog RUM SDK, then the Datadog logs SDK behaves as expected. However, I want to run them both, so this is not an option at the moment.
I am using version 3.1.3
for both @datadog/browser-logs
and @datadog/browser-rum
packages.
Here's a screenshot to illustrate the issue:
Many requests being sent for one uncaught exception example
This is the code I am using to initialise both logs and RUM SDKs:
import { datadogLogs } from '@datadog/browser-logs';
import { datadogRum } from '@datadog/browser-rum';
if (process.env.NODE_ENV === 'production' && process.env.DATADOG_CLIENT_TOKEN) {
const environment = getEnvironment();
const config = {
site: 'datadoghq.eu',
clientToken: process.env.DATADOG_CLIENT_TOKEN,
service: typeof DATADOG_SERVICE !== 'undefined' ? DATADOG_SERVICE : undefined,
env: environment ? `${environment}` : undefined,
proxyHost: process.env.PROXY_HOST
};
datadogLogs.init(config);
if (process.env.DATADOG_APPLICATION_ID) {
datadogRum.init({
...config,
trackInteractions: true,
applicationId: process.env.DATADOG_APPLICATION_ID
});
datadogRum.setUser({
name: service.getName(),
email: service.getEmail()
});
}
}
I had the same issue, Upgrading both Datadog Rum and logging to 3.6.13 fixed this for me:
"@datadog/browser-logs": "^3.6.13",
"@datadog/browser-rum": "^3.6.13",