Skip to content

Commit 7336a37

Browse files
authored
add sentry instructions (#25996)
1 parent 7a50a48 commit 7336a37

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed
241 KB
Loading

src/content/docs/workers/observability/exporting-opentelemetry-data/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Below are common OTLP endpoint formats for popular observability providers. Refe
2828
| [**Grafana Cloud**](/workers/observability/exporting-opentelemetry-data/grafana-cloud/) | `https://otlp-gateway-{region}.grafana.net/otlp/v1/traces`| `https://otlp-gateway-{region}.grafana.net/otlp/v1/logs`[^1] |
2929
| [**Axiom**](/workers/observability/exporting-opentelemetry-data/axiom/) | `https://api.axiom.co/v1/traces` | `https://api.axiom.co/v1/logs` |
3030
| **Datadog** | Not yet available. Pending release from Datadog | Not yet available. Pending release from Datadog |
31-
| **Sentry** | Not yet available. Pending release from Sentry | Not yet available. Pending release from Sentry |
31+
| [**Sentry**](/workers/observability/exporting-opentelemetry-data/sentry/) | `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces` | `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs` |
3232

3333
:::note[Authentication]
3434
Most providers require authentication headers. Refer to your provider's documentation for specific authentication requirements.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
pcx_content_type: how-to
3+
title: Export to Sentry
4+
sidebar:
5+
order: 4
6+
---
7+
8+
import {WranglerConfig} from "~/components";
9+
10+
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:
11+
- Query logs and traces in Sentry
12+
- Create custom alerts and dashboards to monitor your Workers
13+
14+
![Sentry trace view with timing information displayed on a timeline](~/assets/images/workers-observability/sentry-example.png)
15+
16+
This guide will walk you through exporting OpenTelemetry-compliant traces and logs to Sentry from your Cloudflare Worker application
17+
18+
## Prerequisites
19+
20+
Before you begin, ensure you have:
21+
22+
- Are signed up for a [Sentry account](https://sentry.io/signup/) (free tier available)
23+
- A deployed Worker that you want to monitor
24+
25+
## Step 1: Create a Sentry project
26+
27+
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.
28+
29+
1. Log in to your [Sentry account](https://sentry.io/)
30+
2. Navigate to the Insights > Projects in the navigation sidebar, which will open a list of your projects.
31+
3. Click [**New Project**](https://sentry.io/orgredirect/organizations/:orgslug/insights/projects/new/)
32+
4. Fill out the project creation form and click **Create Project** to complete the process.
33+
34+
## Step 2: Get your Sentry OTLP endpoints
35+
36+
Sentry provides separate OTLP endpoints for traces and logs which you can use to send your telemetry data to Sentry.
37+
- **Traces**: `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces`
38+
- **Logs**: `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs`
39+
40+
You can find your OTLP endpoints in the your project settings.
41+
42+
1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry.
43+
2. Select your project from the list and click on the project name to open the project settings.
44+
3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading.
45+
46+
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.
47+
48+
For more details on how to use Sentry's OTLP endpoints, refer to [Sentry's OTLP documentation](https://docs.sentry.io/concepts/otlp/).
49+
50+
## Step 3: Set up destination in the Cloudflare dashboard
51+
52+
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.
53+
54+
### Traces Destination
55+
56+
To configure your traces destination, click **Add destination** and configure the following:
57+
- **Destination Name**: `sentry-traces` (or any descriptive name)
58+
- **Destination Type**: Select **Traces**
59+
- **OTLP Endpoint**: Your Sentry OTLP traces endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces`)
60+
- **Custom Headers**: Add the Sentry authentication header:
61+
- Header name: `x-sentry-auth`
62+
- Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where {SENTRY_PUBLIC_KEY} is your Sentry project's public key
63+
64+
### Logs destination
65+
66+
To configure your logs destination, click **Add destination** and configure the following:
67+
- **Destination Name**: `sentry-logs` (or any descriptive name)
68+
- **Destination Type**: Select **Logs**
69+
- **OTLP Endpoint**: Your Sentry OTLP logs endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs`)
70+
- **Custom Headers**: Add the Sentry authentication header:
71+
- Header name: `x-sentry-auth`
72+
- Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where {SENTRY_PUBLIC_KEY} is your Sentry project's public key
73+
74+
75+
## Step 4: Configure your Worker
76+
77+
With your destinations created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export.
78+
79+
<WranglerConfig>
80+
81+
```json
82+
{
83+
"observability": {
84+
"traces": {
85+
"enabled": true,
86+
// Must match the destination name in the dashboard
87+
"destinations": ["sentry-traces"]
88+
},
89+
"logs": {
90+
"enabled": true,
91+
// Must match the destination name in the dashboard
92+
"destinations": ["sentry-logs"]
93+
}
94+
}
95+
}
96+
```
97+
98+
</WranglerConfig>
99+
100+
After updating your configuration, deploy your Worker for the changes to take effect.
101+
102+
:::note
103+
It may take a few minutes after deployment for data to appear in Sentry.
104+
:::

0 commit comments

Comments
 (0)