Skip to content

Commit 9a59020

Browse files
committed
feat: Document OTLP drains for cloudflare and heroku
1 parent fef6ddc commit 9a59020

File tree

5 files changed

+184
-16
lines changed

5 files changed

+184
-16
lines changed

docs/product/drains/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ To send data to Sentry, we recommend using the Sentry SDKs. However we also supp
1313
## Drains
1414

1515
- [Vercel](/product/drains/integration/vercel/)
16+
- [Cloudflare](/product/drains/integration/cloudflare/)
17+
- [Heroku](/product/drains/integration/heroku/)
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: Cloudflare Workers Observability
3+
sidebar_order: 75
4+
description: Learn how to set up Cloudflare Workers Observability to send forward logs and traces data to Sentry.
5+
---
6+
7+
Cloudflare Workers supports [exporting OpenTelemetry (OTEL)-compliant](https://developers.cloudflare.com/workers/observability/exporting-opentelemetry-data/) to send logs and traces to Sentry.
8+
9+
- Logs: Application logs including `console.log()` output and system-generated logs
10+
- Traces: Traces showing request flows through your Worker and connected services
11+
12+
## Prerequisites
13+
14+
Before you begin, ensure you have:
15+
16+
- A deployed Worker that you want to monitor
17+
- A Sentry project you want to send data to
18+
19+
## Step 1: Set up destination in the Cloudflare dashboard
20+
21+
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.
22+
23+
### Logs Destination
24+
25+
To configure your logs destination, click **Add destination** and configure the following:
26+
27+
1. Destination Name: `sentry-logs` (or any descriptive name)
28+
2. Destination Type: Select Logs
29+
3. OTLP Endpoint: Your Sentry OTLP logs endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs`)
30+
31+
```
32+
___OTLP_LOGS_URL___
33+
```
34+
35+
4. Custom Headers: Add the Sentry authentication header:
36+
- Header name: `x-sentry-auth`
37+
- Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where `{SENTRY_PUBLIC_KEY}` is your Sentry project's public key
38+
39+
```
40+
sentry sentry_key=___PUBLIC_KEY___
41+
```
42+
43+
You can find your Sentry OTLP logs endpoint and authentication header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Logs Endpoint** section.
44+
45+
### Traces Destination
46+
47+
To configure your traces destination, click **Add destination** and configure the following:
48+
49+
1. Destination Name: `sentry-traces` (or any descriptive name)
50+
2. Destination Type: Select Traces
51+
3. OTLP Endpoint: Your Sentry OTLP traces endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces`)
52+
53+
```
54+
___OTLP_TRACES_URL___
55+
```
56+
57+
4. Custom Headers: Add the Sentry authentication header:
58+
- Header name: `x-sentry-auth`
59+
- Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where `{SENTRY_PUBLIC_KEY}` is your Sentry project's public key
60+
61+
```
62+
sentry sentry_key=___PUBLIC_KEY___
63+
```
64+
65+
You can find your Sentry OTLP traces endpoint and authentication header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint** section.
66+
67+
## Step 2: Configure your Worker
68+
69+
With your destinations created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export.
70+
71+
```toml {filename:wrangler.toml}
72+
[observability.traces]
73+
enabled = true
74+
# Must match the destination name in the dashboard
75+
destinations = [ "sentry-traces" ]
76+
77+
[observability.logs]
78+
enabled = true
79+
# Must match the destination name in the dashboard
80+
destinations = [ "sentry-logs" ]
81+
```
82+
83+
```jsonc {filename:wrangler.jsonc}
84+
{
85+
"observability": {
86+
"traces": {
87+
"enabled": true,
88+
// Must match the destination name in the dashboard
89+
"destinations": ["sentry-traces"],
90+
},
91+
"logs": {
92+
"enabled": true,
93+
// Must match the destination name in the dashboard
94+
"destinations": ["sentry-logs"],
95+
},
96+
},
97+
}
98+
```
99+
100+
After updating your configuration, deploy your Worker for the changes to take effect.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Heroku Telemetry Drains
3+
sidebar_order: 75
4+
description: Learn how to set up Heroku Telemetry Drains to send forward logs and traces data to Sentry.
5+
---
6+
7+
Heroku Telemetry supports [exporting OpenTelemetry (OTEL)-compliant](https://devcenter.heroku.com/articles/heroku-telemetry) to send logs and traces to Sentry. Sending metrics is not supported yet.
8+
9+
<Alert level="warning">
10+
11+
Heroku telemetry drains are only available to [Fir](https://devcenter.heroku.com/articles/generations#fir)-generation apps and spaces. We are tracking support for Cedar-generation apps and spaces in [this issue](https://github.com/getsentry/sentry/issues/91727).
12+
13+
</Alert>
14+
15+
## Prerequisites
16+
17+
Before you begin, ensure you have:
18+
19+
- A Heroku app that you want to monitor
20+
- A Sentry project you want to send data to
21+
22+
## Adding a Telemetry Drain
23+
24+
To add a telemetry drain to an app or space, use the `heroku telemetry:add` command. For more details, see the [Heroku Telemetry documentation](https://devcenter.heroku.com/articles/working-with-heroku-telemetry-drains#add-a-telemetry-drain).
25+
26+
When using the `heroku telemetry:add` command, you'll need to provide your Sentry project's OTLP endpoint URL and a `x-sentry-auth` header with the public key. This can be found in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**.
27+
28+
```bash
29+
heroku telemetry:add ___OTLP_URL___ --app myapp --signals logs,traces --transport http --headers '{"x-sentry-auth":"sentry sentry_key=___PUBLIC_KEY___"}'
30+
```
31+
32+
To add a telemetry drain to the entire space:
33+
34+
```bash
35+
heroku telemetry:add ___OTLP_URL___ --space myspace --signals logs,traces --headers '{"x-sentry-auth":"sentry sentry_key=___PUBLIC_KEY___"}'
36+
```
37+
38+
You can use the `--signals` flag to specify the signals you want to send to Sentry. Only `logs` and `traces` are supported.
39+
40+
<Alert level="warning">
41+
42+
Sentry only supports the `http` `--transport` flag.
43+
44+
</Alert>

docs/product/drains/integration/vercel.mdx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,26 @@ sidebar_order: 75
44
description: Learn how to set up Vercel drains to send forward logs and traces data to Sentry.
55
---
66

7+
Vercel Drains let you forward traces and logs from applications running on Vercel to Sentry.
8+
9+
## Prerequisites
10+
11+
Before you begin, ensure you have:
12+
13+
- A Vercel project that you want to monitor
14+
- A Sentry project you want to send data to
15+
16+
## Set up a Drain
17+
718
To set up a Drain in Vercel you'll need to create a new Drain in the Vercel settings. For more information on Vercel Drains, please see the [Vercel drain documentation](https://vercel.com/docs/drains).
819

920
1. From the Vercel dashboard, go to **Team Settings > Drains** and click **Add Drain**.
1021
2. Choose a data type. Currently only Logs and Traces are supported.
1122

12-
- [Logs](#log-drains)
13-
- [Traces](#trace-drains)
23+
- [Logs](#log-drains): Runtime, build, and static logs from your deployments (supports custom endpoints and native integrations)
24+
- [Traces](#trace-drains): Distributed tracing data in OpenTelemetry format (supports custom endpoints and native integrations)
1425

15-
## Log Drains
26+
### Log Drains
1627

1728
<Alert>
1829

@@ -34,33 +45,33 @@ After selecting the Logs data type, you'll need to configure the drain to send d
3445
- **Firewall**: Outputs log data from requests denied by [Vercel Firewall](https://vercel.com/docs/vercel-firewall) rules
3546

3647
4. Select which environments to drain from. You can choose to drain from all environments or select specific ones.
37-
5. Under the custom endpoint tab add the Sentry Vercel Log Drain Endpoint in the URL field. You can find the endpoint in your Sentry Project Settings under **Client Keys (DSN)** > **Vercel**. You can select either JSON or NDJSON encoding.
48+
5. Under the custom endpoint tab add the Sentry Vercel Log Drain Endpoint in the URL field. You can find the endpoint in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **Vercel**. You can select either JSON or NDJSON encoding.
3849

39-
```URL
50+
```
4051
___VERCEL_LOG_DRAIN_URL___
4152
```
4253

43-
6. Click the Custom Headers toggle and add the Sentry Authentication Header. You'll also find the header value in your Sentry Project Settings under **Client Keys (DSN)** > **Vercel**.
54+
6. Click the Custom Headers toggle and add the Sentry Authentication Header. You'll also find the header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **Vercel**.
4455

4556
```
4657
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
4758
```
4859

4960
7. To test that the log drain is working, you can send a test log to your drain by clicking the Test button.
5061

51-
## Trace Drains
62+
### Trace Drains
5263

5364
After selecting the Traces data type, you'll need to configure the drain to send data to Sentry.
5465

5566
1. Provide a name for your drain and select which projects should send data to your endpoint. You can choose all projects or select specific ones.
5667
2. Configure the sampling rate to control the volume of data sent to your drain. We recommend sampling 100% of the data to ensure you get all the data you need.
57-
3. Under the custom endpoint tab add the Sentry Vercel Log Drain Endpoint in the URL field. You can find the endpoint in your Sentry Project Settings under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint** section.
68+
3. Under the custom endpoint tab add the Sentry Vercel Log Drain Endpoint in the URL field. You can find the endpoint in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint** section.
5869

59-
```URL
70+
```
6071
___OTLP_TRACES_URL___
6172
```
6273

63-
4. Click the Custom Headers toggle and add the Sentry Authentication Header. You'll also find the header value in your Sentry Project Settings under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint Headers** section.
74+
4. Click the Custom Headers toggle and add the Sentry Authentication Header. You'll also find the header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint Headers** section.
6475

6576
```
6677
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___

src/components/codeContext.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type ProjectCodeKeywords = {
1616
ORG_SLUG: string;
1717
OTLP_LOGS_URL: string;
1818
OTLP_TRACES_URL: string;
19+
OTLP_URL: string;
1920
PROJECT_ID: number;
2021
PROJECT_SLUG: string;
2122
PUBLIC_DSN: string;
@@ -89,6 +90,7 @@ export const DEFAULTS: CodeKeywords = {
8990
MINIDUMP_URL:
9091
'https://o0.ingest.sentry.io/api/0/minidump/?sentry_key=examplePublicKey',
9192
UNREAL_URL: 'https://o0.ingest.sentry.io/api/0/unreal/examplePublicKey/',
93+
OTLP_URL: 'https://o0.ingest.sentry.io/api/0/integration/otlp',
9294
OTLP_TRACES_URL: 'https://o0.ingest.sentry.io/api/0/integration/otlp/v1/traces',
9395
OTLP_LOGS_URL: 'https://o0.ingest.sentry.io/api/0/integration/otlp/v1/logs',
9496
VERCEL_LOG_DRAIN_URL: 'https://o0.ingest.sentry.io/api/0/integration/vercel/logs/',
@@ -143,16 +145,24 @@ const formatUnrealEngineURL = ({scheme, host, pathname, publicKey}: Dsn) => {
143145
return `${scheme}${host}/api${pathname}/unreal/${publicKey}/`;
144146
};
145147

146-
const formatVercelLogDrainUrl = ({scheme, host, pathname}: Dsn) => {
147-
return `${scheme}${host}/api${pathname}/integration/vercel/logs/`;
148+
const formatIntegrationUrl = ({scheme, host, pathname}: Dsn) => {
149+
return `${scheme}${host}/api${pathname}/integration/`;
148150
};
149151

150-
const formatOtlpTracesUrl = ({scheme, host, pathname}: Dsn) => {
151-
return `${scheme}${host}/api${pathname}/integration/otlp/v1/traces`;
152+
const formatOtlpUrl = (dsn: Dsn) => {
153+
return `${formatIntegrationUrl(dsn)}otlp`;
152154
};
153155

154-
const formatOtlpLogsUrl = ({scheme, host, pathname}: Dsn) => {
155-
return `${scheme}${host}/api${pathname}/integration/otlp/v1/logs`;
156+
const formatOtlpTracesUrl = (dsn: Dsn) => {
157+
return `${formatOtlpUrl(dsn)}/v1/traces`;
158+
};
159+
160+
const formatOtlpLogsUrl = (dsn: Dsn) => {
161+
return `${formatOtlpUrl(dsn)}/v1/logs`;
162+
};
163+
164+
const formatVercelLogDrainUrl = (dsn: Dsn) => {
165+
return `${formatIntegrationUrl(dsn)}vercel/logs/`;
156166
};
157167

158168
const formatApiUrl = ({scheme, host}: Dsn) => {
@@ -247,6 +257,7 @@ export async function fetchCodeKeywords(): Promise<CodeKeywords> {
247257
parsedDsn.host ?? `o${project.organizationId}.ingest.sentry.io`,
248258
MINIDUMP_URL: formatMinidumpURL(parsedDsn),
249259
UNREAL_URL: formatUnrealEngineURL(parsedDsn),
260+
OTLP_URL: formatOtlpUrl(parsedDsn),
250261
VERCEL_LOG_DRAIN_URL: formatVercelLogDrainUrl(parsedDsn),
251262
OTLP_TRACES_URL: formatOtlpTracesUrl(parsedDsn),
252263
OTLP_LOGS_URL: formatOtlpLogsUrl(parsedDsn),

0 commit comments

Comments
 (0)