Skip to content

Commit f77987f

Browse files
AbhiPrasadphilipphofmann
authored andcommitted
feat(drains): Add vercel log drain docs (#15322)
This PR adds a new product page for drains, and adds a page for vercel log drains as well. Vercel drains are marked as closed alpha for now, but will be promoted to EA this week.
1 parent 23a85fd commit f77987f

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

docs/product/drains/index.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Log and Trace Drains
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)](/concepts/otlp/)
12+
13+
## Drains
14+
15+
- [Vercel](/product/drains/integration/vercel/)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
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).
8+
9+
1. From the Vercel dashboard, go to **Team Settings > Drains** and click **Add Drain**.
10+
2. Choose a data type. Currently only Logs and Traces are supported.
11+
12+
- [Logs](#log-drains)
13+
- [Traces](#trace-drains)
14+
15+
## Log Drains
16+
17+
<Alert>
18+
19+
Vercel Log Drains support is currently 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.
20+
21+
</Alert>
22+
23+
After selecting the Logs data type, you'll need to configure the drain to send data to Sentry.
24+
25+
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.
26+
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.
27+
3. Select which log sources to collect
28+
29+
- **Functions**: Outputs log data from Vercel Functions like API Routes
30+
- **Edge Functions**: Outputs log data from Vercel Functions or Routing Middleware using Edge runtime
31+
- **Static Files**: Collects logs for static assets like HTML and CSS files
32+
- **Rewrites**: Collects log results for external [rewrites](https://vercel.com/docs/project-configuration#rewrites) to a different domain
33+
- **Builds**: Outputs log data from the Build Step
34+
- **Firewall**: Outputs log data from requests denied by [Vercel Firewall](https://vercel.com/docs/vercel-firewall) rules
35+
36+
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.
38+
39+
```URL
40+
___VERCEL_LOG_DRAIN_URL___
41+
```
42+
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**.
44+
45+
```
46+
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
47+
```
48+
49+
7. To test that the log drain is working, you can send a test log to your drain by clicking the Test button.
50+
51+
## Trace Drains
52+
53+
After selecting the Traces data type, you'll need to configure the drain to send data to Sentry.
54+
55+
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.
56+
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.
58+
59+
```URL
60+
___OTLP_TRACES_URL___
61+
```
62+
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.
64+
65+
```
66+
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
67+
```
68+
69+
5. To test that the trace drain is working, you can send a test trace to your drain by clicking the Test button.

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)