Sentry vs OpenTelemetry: You D... Note

Sentry vs OpenTelemetry: You Don’t Need to Pick One

You can integrate Sentry with an existing OpenTelemetry backend by configuring your OTLP exporter to point to Sentry's endpoint. This process requires minimal changes, avoiding the need to rewrite existing instrumentation. For web applications, adding the Sentry SDK to the frontend is recommended for capturing browser context. This allows for a unified view of traces from user interactions to backend operations. OpenTelemetry supports traces, logs, and metrics, but Sentry currently ingests only traces and logs via OTLP. The key is to separate trace linking from OTLP export. Trace linking ensures a continuous distributed trace across frontend and backend requests. The Sentry frontend SDK handles this by propagating W3C traceparent headers. The decision of where backend OTLP events are sent is separate. You can send them directly to Sentry or through an OpenTelemetry Collector. Direct OTLP export is simplest for single backend projects. Collector forwarding offers centralized processing and routing for multiple services. The demo architecture shows a React frontend with the Sentry SDK, a FastAPI backend using OpenTelemetry, and an OpenTelemetry Collector. The backend retains its OpenTelemetry setup, including manual spans and logs. The Collector then forwards these OTLP events to Sentry. Ensure CORS is configured correctly on the backend to allow trace propagation headers for cross-origin requests.
CdXz5zHNQW_atW5fkJcmM.webp