Skip to main content

Datadog Adapter

Send captured errors to Datadog using both RUM and Logs.

Install

yarn add @datadog/browser-rum @datadog/browser-logs

Both packages are required — the adapter wires up RUM and Logs together.

Activate

import { initialize, useAdapter } from 'unified-error-handling';

initialize();

await useAdapter('datadog', {
applicationId: 'your-application-id',
clientToken: 'your-client-token',
site: 'datadoghq.com',
service: 'web-app',
env: 'production',
});

Config

FieldPurpose
applicationIdDatadog RUM application ID.
clientTokenDatadog client token.
siteYour Datadog site (e.g. datadoghq.com, datadoghq.eu).
serviceService name.
envEnvironment label.

The adapter dynamically imports @datadog/browser-rum and @datadog/browser-logs, initializes both, and forwards captured errors to them.

Notes

  • If either package is missing, activation throws Failed to load DataDog SDK… with the original error preserved as cause.
  • Datadog already does its own network monitoring via RUM; you may keep the store's enableNetworkCapture off to avoid double-reporting failed requests.