Trace Drains Reference
Trace Drains forward distributed tracing data from your deployments to external endpoints for storage and analysis. To enable Trace Drains, you must provide an endpoint URL to send the traces to. This URL can be a custom endpoint of yours or one provided by a third-party provider like Datadog, New Relic, or other observability services.
Vercel sends traces to endpoint URLs over HTTPS following the OpenTelemetry Protocol (OTLP) specification.
Trace Drains follow the OpenTelemetry traces specification. Vercel automatically adds these specific resource attributes to all traces:
Name | Type | Description | Example |
---|---|---|---|
vercel.projectId | string | Identifier for the Vercel project | "Qmc52npNy86S8VV4Mt8a8dP1LEkRNbgosW3pBCQytkcgf2" |
vercel.deploymentId | string | Identifier for the Vercel deployment | "dpl_2YZzo1cJAjijSf1hwDFK5ayu2Pid" |
Vercel supports the following formats for Trace Drains. You can configure the format when configuring the Drain destination:
Vercel sends traces as JSON objects following the OpenTelemetry specification:
{ "resourceSpans": [{ "resource": { "attributes": [{ "key": "service.name", "value": { "stringValue": "vercel-function" } }] }, "scopeSpans": [{ "scope": { "name": "vercel" }, "spans": [{ "traceId": "7bba9f33312b3dbb8b2c2c62bb7abe2d", "spanId": "086e83747d0e381e", "name": "GET /api/users", "kind": "server", "startTimeUnixNano": "1694723400000000000", "endTimeUnixNano": "1694723400150000000" }] }] }] }
Vercel sends traces in binary protobuf format following the OTLP/HTTP specification. This format is more efficient for high-volume trace data transmission.
When you configure a Trace Drain in the Vercel UI, you can set the sampling rate to control the volume of data sent. This helps manage costs when you have high traffic volumes.
For more information on Trace Drains and how to use them, check out the following resources:
Was this helpful?