Loading

Vercel OpenTelemetry Integration

Version 0.2.0 (View all)
Subscription level
What's this?
Basic
Developed by
What's this?
Elastic
Minimum Kibana version(s) 9.4.0
The Vercel (OpenTelemetry) integration v0.2.0 is in technical preview

To use pre-release integrations, go to the Integrations page in Kibana, scroll down, and toggle on the Display beta integrations option.

Vercel is a cloud platform for deploying and hosting frontend applications on a globally distributed edge network.

This integration explains how to send Vercel logs, audit logs, Web Analytics, Speed Insights, and traces to Elastic using Vercel Drains and the Elastic Cloud managed endpoint. Elastic operates the endpoint, so there is nothing to deploy on your side: no Elastic Agent, no OpenTelemetry Collector, and no agent policy to configure. Follow the setup steps below in your Elastic Cloud project or deployment and in Vercel.

Once data starts flowing, the Vercel OpenTelemetry Assets package provides assets for logs, audit logs, Web Analytics, and Speed Insights. Traces appear in traces-generic.otel-* and can be explored in Discover and in the Services inventory.

This integration has been tested with Vercel Drains delivering Logs, Audit Log, Web Analytics, and Speed Insights to the Vercel path (/inputs/vercel/_default_) of the Elastic Cloud managed endpoint, and with Trace Drains delivering OpenTelemetry traces to the Managed OTLP traces path (/v1/traces).

You need Elasticsearch for storing and searching your data and Kibana for visualizing and managing it. You can use our hosted Elasticsearch Service on Elastic Cloud, which is recommended, or self-manage the Elastic Stack on your own hardware.

Note

The managed endpoint used by this integration is available on Elastic Cloud Serverless and Elastic Cloud Hosted. It is not available for self-managed, ECE, or ECK clusters. Refer to Managed inputs.

Vercel data reaches Elasticsearch through a Vercel drain that posts to an Elastic Cloud managed endpoint.

Do the following steps in order:

  1. Enable the Vercel features you want to collect.
  2. Gather the managed endpoint URL (and the traces URL, if you collect traces) and an API key from Elastic.
  3. Create the drains in Vercel using those values.
  4. Validate that data is arriving in Elastic.
  • Logs and Audit Log: available through Vercel Drains. Log drains require a Pro or Enterprise plan. Audit Log drains require an Enterprise plan.
  • Web Analytics: install and enable the @vercel/analytics SDK in your application so page views and custom events are emitted.
  • Speed Insights: install and enable the @vercel/speed-insights SDK in your application so Web Vitals are collected in the browser.
  • Traces: available through Trace Drains. Trace drains require a Pro or Enterprise plan. Vercel automatically instruments infrastructure spans and outbound HTTP (fetch) spans when a Trace Drain is configured. For framework spans and custom spans, install the @vercel/otel package.

You need an Elastic Cloud Serverless project or an Elastic Cloud Hosted deployment.

Find your Elastic Cloud public endpoint:

  1. Log in to the Elastic Cloud Console.
  2. Open your project or deployment and select Manage.
  3. In Application endpoints, cluster and component IDs, select the Vercel endpoint, then copy the public endpoint value.

The managed endpoint URL for Vercel is that public endpoint plus /inputs/vercel/_default_, which is the path that accepts Vercel drain payloads:

https://<managed-endpoint>/inputs/vercel/_default_
		

For example, if your public endpoint is https://abc123.ingest.us-east-1.aws.elastic.cloud, then the managed endpoint URL for Vercel is:

https://abc123.ingest.us-east-1.aws.elastic.cloud/inputs/vercel/_default_
		

Every project and deployment has its own host, so always build the managed endpoint URL for Vercel from the endpoint shown in your own Elastic Cloud project or deployment. Refer to Find your endpoint for more detail.

Traces use a different path from the other Vercel drains. They are ingested via the Elastic Cloud Managed OTLP Endpoint.

Find the Managed OTLP public endpoint:

  1. Log in to the Elastic Cloud Console.
  2. Open your project or deployment and select Manage.
  3. In Application endpoints, cluster and component IDs, select OpenTelemetry (Serverless) or Managed OTLP (Elastic Cloud Hosted), then copy the public endpoint value.

The traces destination is that public endpoint plus /v1/traces:

https://<managed-endpoint>/v1/traces
		

For example, if your Managed OTLP public endpoint is https://abc123.ingest.us-east-1.aws.elastic.cloud, then the traces URL is:

https://abc123.ingest.us-east-1.aws.elastic.cloud/v1/traces
		

Create an API key by following the Send data to Elastic Cloud quickstart, then copy the encoded value. Vercel sends it in an Authorization header that must use the ApiKey scheme, as described in Authentication.

Alternatively, in your Elastic Cloud Serverless project, go to Add dataApplicationsOpenTelemetry. That wizard shows the endpoint and generates a pre-configured API key for you.

A Vercel drain carries a single data type, so create a separate drain for each of Logs, Audit Log, Web Analytics, Speed Insights, and Traces that you want in Elastic. All drains use the same API key. Logs, Audit Log, Web Analytics, and Speed Insights share the Vercel managed endpoint URL. Traces use the Managed OTLP traces URL instead.

For each of these data types, in Vercel:

  1. Open your team Drains settings and create a drain for that data type.
  2. Choose Custom Endpoint as the destination.
  3. Set the Endpoint URL to the managed endpoint URL for Vercel, for example https://abc123.ingest.us-east-1.aws.elastic.cloud/inputs/vercel/_default_.
  4. Under Custom Headers, add a header named Authorization with the value ApiKey <your-api-key>, for example Authorization: ApiKey abc123.
  5. Save the drain.

For Logs drains, you can also narrow which sources, environments, and sampling rates are forwarded under Additional configuration for logs. Refer to Log Drains reference.

Note

The managed endpoint URL for Vercel is always your Elastic Cloud public endpoint plus /inputs/vercel/_default_. Do not point the drain at a self-hosted collector; the supported path is the Elastic Cloud managed endpoint.

For traces, in Vercel:

  1. Open your team Drains settings and create a drain of type Traces.
  2. Choose Custom Endpoint as the destination.
  3. Set the Endpoint URL to the Managed OTLP traces URL, for example https://abc123.ingest.us-east-1.aws.elastic.cloud/v1/traces.
  4. Choose Protobuf or JSON as the delivery format. Both are sent over OTLP/HTTP.
  5. Under Custom Headers, add a header named Authorization with the value ApiKey <your-api-key>, for example Authorization: ApiKey abc123.
  6. Save the drain.

In Kibana, open Discover and query the data streams listed in Reference, for example logs-vercel.logs.otel-* or traces-generic.otel-*. Vercel delivers drain payloads in batches, so allow a few minutes after saving a drain and generating traffic before the first documents appear.

To see the full request flow for traces, open ApplicationsService inventory in Kibana. Services appear after they send spans in the selected time range. From a service you can open traces, related logs, and service maps. Refer to Services.

Vercel drain payloads are decoded by the Elastic Cloud managed endpoint and written to the data streams below. Each data type has its own payload schema, documented by Vercel, and those fields are what you query in Elastic. For drain configuration on the Vercel side, see Using drains. For managed endpoint behavior, see Managed inputs.

Signal Data stream Fields
Speed Insights metrics-vercel.speedinsights.v1.otel-* Speed Insights Drains reference

Speed Insights carries Web Vitals (LCP, INP, CLS, TTFB) and their related attributes, such as route, device, and country.

Signal Data stream Fields
Logs logs-vercel.logs.otel-* Log Drains reference
Audit logs logs-vercel.auditlog.v1.otel-* Audit Log Drains reference
Web Analytics logs-vercel.analytics.v2.otel-* Analytics Drains reference

The Logs data stream holds every source selected on the drain, so it covers build output and static asset requests alongside function output from the lambda and edge runtimes.

Signal Data stream Fields
Traces traces-generic.otel-* Trace Drains reference

Traces land in the generic OpenTelemetry traces data stream. Use Discover on traces-generic.otel-* to inspect individual spans, and use ApplicationsService inventory for the complete service-level view of those traces.

To see how a payload field is indexed, open the data stream in Discover and inspect a document, or check the data stream mappings in Stack ManagementIndex Management.