Skip to content

Commit 641ecfd

Browse files
committed
feat(drains): Add vercel log drain docs
1 parent a5bd22d commit 641ecfd

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

docs/product/drains/index.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Drains and Forwarders
3+
sidebar_order: 75
4+
description: Learn how to set up trace and log drains and forwarders to send data to Sentry.
5+
---
6+
7+
To send data to Sentry, we recommend using the Sentry SDKs. However we also support forwarding data to Sentry from platforms where you can't use the Sentry SDKs. At the moment we only support forwarding logs and traces data, error events are not supported yet.
8+
9+
## Endpoints
10+
11+
### OpenTelemetry (OTLP)
12+
13+
You can send logs and traces to Sentry via [Sentry's OpenTelemetry (OTLP) endpoint](/concepts/otlp/). This can be used with any OpenTelemetry SDK, or with the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/).
14+
15+
## Drains
16+
17+
### Vercel
18+
19+
You can send your Vercel observability data to Sentry via Vercel [Drains](https://vercel.com/docs/drains). Currently Sentry supports draining logs and traces from Vercel. See the [Vercel Drains](/product/drains/integration/vercel/) documentation for more information.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Vercel Drains
3+
sidebar_order: 75
4+
description: Learn how to set up Vercel drains to send forward logs and traces data to Sentry.
5+
---
6+
7+
<Include name="feature-available-closed-alpha.mdx" />
8+
9+
To set up a Drain in Vercel you'll need to create a new Drain in the Vercel settings. For more information on how to create a Drain, please see the [Vercel documentation](https://vercel.com/docs/drains).
10+
11+
1. From the Vercel dashboard, go to **Team Settings > Drains** and click **Add Drain**.
12+
2. Choose a data type. Currently only Logs and Traces are supported.
13+
14+
- [Logs](#log-drains)
15+
- [Traces](#trace-drains)
16+
17+
## Log Drains
18+
19+
After selecting the Logs data type, you'll need to configure the drain to send data to Sentry.
20+
21+
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.
22+
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.
23+
3. Select which log sources to collect
24+
25+
- **Functions**: Outputs log data from Vercel Functions like API Routes
26+
- **Edge Functions**: Outputs log data from Vercel Functions or Routing Middleware using Edge runtime
27+
- **Static Files**: Collects logs for static assets like HTML and CSS files
28+
- **Rewrites**: Collects log results for external [rewrites](https://vercel.com/docs/project-configuration#rewrites) to a different domain
29+
- **Builds**: Outputs log data from the Build Step
30+
- **Firewall**: Outputs log data from requests denied by [Vercel Firewall](https://vercel.com/docs/vercel-firewall) rules
31+
32+
4. Select which environments to drain from. You can choose to drain from all environments or select specific ones.
33+
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.
34+
35+
```URL
36+
___VERCEL_LOG_DRAIN_URL___
37+
```
38+
39+
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**.
40+
41+
```
42+
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
43+
```
44+
45+
7. To test that the log drain is working, you can send a test log to your drain by clicking the Test button.
46+
47+
## Trace Drains
48+
49+
After selecting the Traces data type, you'll need to configure the drain to send data to Sentry.
50+
51+
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.
52+
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.
53+
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.
54+
55+
```URL
56+
___OTLP_TRACES_URL___
57+
```
58+
59+
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.
60+
61+
```
62+
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
63+
```
64+
65+
5. To test that the trace drain is working, you can send a test trace to your drain by clicking the Test button.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Alert>
2+
3+
This feature is in closed alpha. Please reach out to [[email protected]](mailto:[email protected]) if you have feedback or questions. Features in alpha are still in-progress and may have bugs. We recognize the irony.
4+
5+
</Alert>

src/components/codeContext.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type ProjectCodeKeywords = {
2222
PUBLIC_KEY: string;
2323
SECRET_KEY: string;
2424
UNREAL_URL: string;
25+
VERCEL_LOG_DRAIN_URL: string;
2526
title: string;
2627
};
2728

@@ -90,6 +91,7 @@ export const DEFAULTS: CodeKeywords = {
9091
UNREAL_URL: 'https://o0.ingest.sentry.io/api/0/unreal/examplePublicKey/',
9192
OTLP_TRACES_URL: 'https://o0.ingest.sentry.io/api/0/integration/otlp/v1/traces',
9293
OTLP_LOGS_URL: 'https://o0.ingest.sentry.io/api/0/integration/otlp/v1/logs',
94+
VERCEL_LOG_DRAIN_URL: 'https://o0.ingest.sentry.io/api/0/integration/vercel/logs/',
9395
title: `example-org / example-project`,
9496
},
9597
],
@@ -141,6 +143,10 @@ const formatUnrealEngineURL = ({scheme, host, pathname, publicKey}: Dsn) => {
141143
return `${scheme}${host}/api${pathname}/unreal/${publicKey}/`;
142144
};
143145

146+
const formatVercelLogDrainUrl = ({scheme, host, pathname}: Dsn) => {
147+
return `${scheme}${host}/api${pathname}/integration/vercel/logs/`;
148+
};
149+
144150
const formatOtlpTracesUrl = ({scheme, host, pathname}: Dsn) => {
145151
return `${scheme}${host}/api${pathname}/integration/otlp/v1/traces`;
146152
};
@@ -241,6 +247,7 @@ export async function fetchCodeKeywords(): Promise<CodeKeywords> {
241247
parsedDsn.host ?? `o${project.organizationId}.ingest.sentry.io`,
242248
MINIDUMP_URL: formatMinidumpURL(parsedDsn),
243249
UNREAL_URL: formatUnrealEngineURL(parsedDsn),
250+
VERCEL_LOG_DRAIN_URL: formatVercelLogDrainUrl(parsedDsn),
244251
OTLP_TRACES_URL: formatOtlpTracesUrl(parsedDsn),
245252
OTLP_LOGS_URL: formatOtlpLogsUrl(parsedDsn),
246253
title: `${project.organizationSlug} / ${project.projectSlug}`,

0 commit comments

Comments
 (0)