dd-instrument-error-tracking

Installation
SKILL.md

Datadog Browser Error Tracking

Browser Error Tracking groups and triages frontend exceptions collected by the Datadog RUM Browser SDK (@datadog/browser-rum). It shares the same SDK and the same RUM application as Browser RUM and Product Analytics, so there is no separate Error Tracking SDK to install.

How it works

  • The switch is on the RUM application, not in the code. A RUM application processes errors when rum_event_processing_state is ERROR_FOCUSED_MODE or ALL. An application created for Product Analytics only starts at NONE, which drops all RUM and Error Tracking events even when the browser code is wired.
  • RUM comes first. Browser Error Tracking reads what the RUM Browser SDK sends, so an app with no RUM init needs RUM set up first.
  • Sampling uses sessionSampleRate. The RUM Browser SDK captures unhandled errors (window.onerror, unhandledrejection, console.error) automatically for sampled sessions. There is no errorSampleRate option in RumInitConfiguration; adding it breaks TypeScript builds.
  • Frameworks swallow component errors. React error boundaries, Next.js error.tsx, Vue app.config.errorHandler, Angular ErrorHandler, and SvelteKit handleError intercept errors before they reach window.onerror, so those hooks must forward caught errors to Datadog.
  • Credentials. The application ID and client token are public and already in the RUM setup. Switching event processing on through the API needs an API key and an application key, and both are secret.

Set up

Copy these steps into your reply and tick them off as you go.

  1. Inspect. Find the browser app; in a monorepo with several, ask which one. Search source and HTML files, skipping node_modules and build output, for the RUM setup: an init call on the datadogRum import from @datadog/browser-rum, including renamed imports and wrapper modules, or a CDN DD_RUM.init. Record the number of inits, the framework, sessionSampleRate, the site (absent means datadoghq.com), the application ID, any @datadog/browser-rum-* or @datadog/browser-logs packages, and any existing error boundary or framework error handler. When the init reads the application ID or the site from environment variables, read only those lines of the env file, for example grep -E '^VITE_DD_(RUM_APPLICATION_ID|SITE)=' .env.local, because env files often hold secrets.
Installs
37
GitHub Stars
186
First Seen
13 days ago