RUM Error Tracking
Incident Management is now generally available! Incident Management is now generally available!

RUM Error Tracking

What is Error Tracking?

Datadog collects a lot of errors. It’s critical to the health of your system to monitor these errors, but there can be so many individual error events that it’s hard to identify which ones matter the most and should be fixed first.

Error Tracking makes it easier to monitor these errors by:

  • Grouping similar errors into issues to reduce the noise and help identify the most important ones.
  • Following issues over time to know when they first started, if they are still ongoing, and how often they are occurring.
  • Getting all the context needed in one place to facilitate troubleshooting the issue.

Getting started

Error Tracking processes errors collected from the browser by the RUM SDK: whenever a source or custom error containing a stack trace is collected, Error Tracking processes and groups it under an issue (group of similar errors).

To quickly get started with error tracking:

  1. Download the latest version of the RUM Browser SDK.
  2. Configure the version, the env and the service when initializing your SDK.

Upload mapping files

The source code of some applications is obfuscated or minified when deployed to production for performance optimization and security concerns. The consequence is that stack traces of errors fired from those applications are also obfuscated, making the troubleshooting process much more difficult.

Javascript source maps

Source maps are mapping files generated when minifying Javascript source code. The Datadog CLI can be used to upload those mapping files from your build directory: it scans the build directory and its subdirectories to automatically upload the source maps with their related minified files. Upload your source maps directly from your CI pipeline:

  1. Add @datadog/datadog-ci to your package.json file (make sure to use the latest version).
  2. Create a new and dedicated Datadog API key and export it as an environment variable named DATADOG_API_KEY.
  3. Run the following command:
datadog-ci sourcemaps upload /path/to/dist \
	--service=my-service \
	--release-version=v35.2395005 \
	--minified-path-prefix=https://hostname.com/static/js
  1. Add @datadog/datadog-ci to your package.json file (make sure to use the latest version).
  2. Create a new and dedicated Datadog API key and export it as an environment variable named DATADOG_API_KEY.
  3. Configure the CLI to upload files to the EU region by exporting two additonal environment variables: export DATADOG_SITE="datadoghq.eu" and export DATADOG_API_HOST="api.datadoghq.eu".
  4. Run the following command:
datadog-ci sourcemaps upload /path/to/dist \
	--service=my-service \
	--release-version=v35.2395005 \
	--minified-path-prefix=https://hostname.com/static/js

For Error Tracking to properly work with your source maps, you must configure your Javascript bundler so that:

  • Source maps directly include the related source code. Make sure the sourcesContent attribute is not empty before uploading them.
  • The size of each source map augmented with the size of the related minified file does not exceed our limit of 50mb. This sum can be reduced by configuring your bundler to split the source code into multiple smaller chunks (see how to do this with WebpackJS).

Further Reading