-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Add Sentry OTLP instructions #25996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nevikashah
merged 1 commit into
cloudflare:nevi/tracing
from
getsentry:sentry-otel-docs
Oct 22, 2025
+105
−1
Merged
Add Sentry OTLP instructions #25996
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
src/content/docs/workers/observability/exporting-opentelemetry-data/sentry.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Export to Sentry | ||
| sidebar: | ||
| order: 4 | ||
| --- | ||
|
|
||
| import {WranglerConfig} from "~/components"; | ||
|
|
||
| Sentry is a software monitoring tool that helps developers identify and debug performance issues and errors. From end-to-end distributed tracing to performance monitoring, Sentry provides code-level observability that makes it easy to diagnose issues and learn continuously about your application code health across systems and services. By exporting your Cloudflare Workers application telemetry to Sentry, you can: | ||
| - Query logs and traces in Sentry | ||
| - Create custom alerts and dashboards to monitor your Workers | ||
|
|
||
|  | ||
|
|
||
| This guide will walk you through exporting OpenTelemetry-compliant traces and logs to Sentry from your Cloudflare Worker application | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before you begin, ensure you have: | ||
|
|
||
| - Are signed up for a [Sentry account](https://sentry.io/signup/) (free tier available) | ||
| - A deployed Worker that you want to monitor | ||
|
|
||
| ## Step 1: Create a Sentry project | ||
|
|
||
| If you don't already have a Sentry project to send data to, you'll need to create one to start sending Cloudflare Workers application telemetry to Sentry. | ||
|
|
||
| 1. Log in to your [Sentry account](https://sentry.io/) | ||
| 2. Navigate to the Insights > Projects in the navigation sidebar, which will open a list of your projects. | ||
| 3. Click [**New Project**](https://sentry.io/orgredirect/organizations/:orgslug/insights/projects/new/) | ||
| 4. Fill out the project creation form and click **Create Project** to complete the process. | ||
|
|
||
| ## Step 2: Get your Sentry OTLP endpoints | ||
|
|
||
| Sentry provides separate OTLP endpoints for traces and logs which you can use to send your telemetry data to Sentry. | ||
| - **Traces**: `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces` | ||
| - **Logs**: `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs` | ||
|
|
||
| You can find your OTLP endpoints in the your project settings. | ||
|
|
||
| 1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry. | ||
| 2. Select your project from the list and click on the project name to open the project settings. | ||
| 3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading. | ||
|
|
||
| There you'll find your Sentry project's OTLP logs and OTLP traces endpoints, as well as authentication headers for the endpoints. Make sure to copy the endpoints and authentication headers. | ||
|
|
||
| For more details on how to use Sentry's OTLP endpoints, refer to [Sentry's OTLP documentation](https://docs.sentry.io/concepts/otlp/). | ||
|
|
||
| ## Step 3: Set up destination in the Cloudflare dashboard | ||
|
|
||
| To set up a destination in the Cloudflare dashboard, navigate to your Cloudflare account's [Workers Observability](https://dash.cloudflare.com/?to=/:account/workers-and-pages/observability/pipelines) section. Then click **Add destination** and configure either a traces or logs destination. | ||
|
|
||
| ### Traces Destination | ||
|
|
||
| To configure your traces destination, click **Add destination** and configure the following: | ||
| - **Destination Name**: `sentry-traces` (or any descriptive name) | ||
| - **Destination Type**: Select **Traces** | ||
| - **OTLP Endpoint**: Your Sentry OTLP traces endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces`) | ||
| - **Custom Headers**: Add the Sentry authentication header: | ||
| - Header name: `x-sentry-auth` | ||
| - Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where {SENTRY_PUBLIC_KEY} is your Sentry project's public key | ||
|
|
||
| ### Logs destination | ||
|
|
||
| To configure your logs destination, click **Add destination** and configure the following: | ||
| - **Destination Name**: `sentry-logs` (or any descriptive name) | ||
| - **Destination Type**: Select **Logs** | ||
| - **OTLP Endpoint**: Your Sentry OTLP logs endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs`) | ||
| - **Custom Headers**: Add the Sentry authentication header: | ||
| - Header name: `x-sentry-auth` | ||
| - Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where {SENTRY_PUBLIC_KEY} is your Sentry project's public key | ||
|
|
||
|
|
||
| ## Step 4: Configure your Worker | ||
|
|
||
| With your destinations created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export. | ||
|
|
||
| <WranglerConfig> | ||
|
|
||
| ```json | ||
| { | ||
| "observability": { | ||
| "traces": { | ||
| "enabled": true, | ||
| // Must match the destination name in the dashboard | ||
| "destinations": ["sentry-traces"] | ||
| }, | ||
| "logs": { | ||
| "enabled": true, | ||
| // Must match the destination name in the dashboard | ||
| "destinations": ["sentry-logs"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </WranglerConfig> | ||
|
|
||
| After updating your configuration, deploy your Worker for the changes to take effect. | ||
|
|
||
| :::note | ||
| It may take a few minutes after deployment for data to appear in Sentry. | ||
| ::: | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These docs show a different traces endpoint than is shown in Client Keys (DSN) page in sentry.io project settings. Which one is correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that's a bug on our side! Let me fix that super quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened a PR to fix this in sentry here: getsentry/sentry#101970. It'll be merged soon, the docs here are correct, we just need to fix the sentry settings to show it correctly.