Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel,
n'hésitez pas à nous contacter.
Overview
Error Tracking intelligently groups similar errors into issues with a default strategy. By using custom fingerprinting, you can gain full control over the grouping decision and customize the grouping behavior for your Real User Monitoring (RUM) errors.
Provide an error.fingerprint
attribute that Error Tracking can use to group RUM errors into issues. While the value of the error.fingerprint
attribute does not have any particular format or requirement, the content must be a string.
If error.fingerprint
is provided, the grouping behavior follows these rules:
- Custom grouping takes precedence over the default strategy.
- Custom grouping can be applied only to a subset of your RUM errors and can coexist with the default strategy.
- The content of
error.fingerprint
is used as-is without any modification. - RUM errors from the same service and with the same
error.fingerprint
attribute are grouped into the same issue. - RUM errors with different
service
attributes are grouped into different issues.
Setup for browser errors
In order to use custom grouping, you need the Datadog Browser SDK v4.42.0 or later, a browser RUM error, and an additional string attribute.
If you aren’t already collecting Browser RUM events with Datadog, see the Browser Monitoring setup documentation.
Example
If you’re already collecting browser errors, it’s possible to add the attribute by either:
- Adding a
dd_fingerprint
attribute to the error object:
import { datadogRum } from '@datadog/browser-rum';
// Send a custom error with context
const error = new Error('Something went wrong');
error.dd_fingerprint = 'my-custom-grouping-fingerprint'
datadogRum.addError(error);
- Or, using the
beforeSend
callback with an error.fingerprint
attribute:
DD_RUM.init({
...
beforeSend: () => {
if (event.type === 'error') {
event.error.fingerprint = 'my-custom-grouping-fingerprint'
}
},
})
In both cases, my-custom-grouping-material
is used to group the Browser RUM errors into a single issue in Error Tracking.
Further Reading
Documentation, liens et articles supplémentaires utiles: