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.
Join the Preview!
Using the Sentry SDK with Error Tracking is in Preview.
Using the Sentry SDK with Error Tracking helps you migrate to Datadog. However, to get the most out of Error Tracking, it is recommended to use the Datadog SDKs. See Frontend Error Tracking and Backend Error Tracking.
Overview
You can use Sentry SDKs to send your events to Datadog, so you can start using Error Tracking on existing applications that are instrumented using Sentry SDKs.
Setting up the Sentry SDK with Datadog requires a minimal code change to point the SDK to a Datadog Data Source Name (DSN).
Events and non-error events (messages) appear in Datadog as logs in the log explorer. Other item types (traces, attachments, sessions, etc.) are not supported.
Supported SDKs
The following Sentry SDKs are verified to work with Error Tracking:
Platform
Tested version
JavaScript
@sentry/node@9.13.0 @sentry/browser@9.13.0
Python
sentry-sdk==2.26.1
Java
io.sentry:sentry:8.6.0
.NET
Sentry 5.5.1
Go
sentry-go v0.32.0
Ruby
sentry-ruby 5.23.0
Setup
Prerequisites
Sentry SDK events are sent into Datadog as logs. You must have Error Tracking for Logs enabled for errors to show up in Error Tracking.
Note: By default, enabling Error Tracking for Logs enables Error Tracking on all of your logs. You can use rules to configure Error Tracking for Logs to only collect errors from the Sentry SDK. To do this, create a rule for logs with scope source:sentry-sdk, and create an exclusion rule for all other logs.
Service configuration
To configure the Sentry SDK to send events into Datadog:
Configure a Datadog Data Source Name (DSN). Follow the in-app instructions to generate your unique DSN.
Set a service tag on all events. This is used to separate errors and is shown in the Datadog UI:
Sentry.initdo|config|config.dsn=https://<TOKEN>@sentry-intake.<DD_SITE>/1'
end
Sentry.set_tags('service': 'my-app')
Upload JavaScript source maps
If your frontend JavaScript source code is minified, you can upload source maps to Datadog to deobfuscate stack traces in Error Tracking. See Upload JavaScript Source Maps.
The version on source maps is matched with the releaseconfigured on the Sentry SDK.
Source code integration
Datadog Source Code Integration allows you to connect your telemetry with your Git repositories. It works with Sentry SDKs by configuring telemetry tags:
To get the most out of Error Tracking, Datadog recommends migrating to the Datadog SDK and/or Agent-based setups. See Backend Error Tracking and Frontend Error Tracking for more information.
The Sentry SDK setup can be used simultaneously with the recommended setup. Errors may be reported twice.
Send events to both Sentry and Datadog
Events can be sent to both Sentry (or any other Sentry-compatible backend) and Datadog. This allows you to start using Datadog while also keeping your current solution. There are a couple of ways to achieve this:
You can configure Sentry SDKs to send events to multiple DSNs at once. On most Sentry SDKs, you can override the default transport to achieve this.
// Change to import from "@sentry/react", "@sentry/nextjs", etc. as needed
import*asSentryfrom"@sentry/browser";import{makeFetchTransport}from"@sentry/browser";// import { makeNodeTransport } from "@sentry/node" for Node.js
import{makeMultiplexedTransport}from"@sentry/core";constsentryDsn='<SENTRY_DSN>';constdatadogDsn='<DATADOG_DSN>';Sentry.init({dsn:sentryDsn,transport:makeMultiplexedTransport(makeFetchTransport,()=>[sentryDsn,datadogDsn]),// ...
});Sentry.setTag('service','my-app');
Sentry Mirror is a proxy that replicates traffic to multiple DSNs. You run in it your own environment, and point your applications to Sentry Mirror’s inbound DSN.