How do I line up logs from Vercel projects with OpenTelemetry metric series for one service?
Tares lines up Vercel logs and OpenTelemetry metrics for one service when both sources use the same primary service label. One read of that service then returns the log lines and the metric values merged on one clock.
How it works
Tares correlates events by the primary label of each source. Two sources that share a primary label name and value land on the same timeline.
- The Vercel logs connector is a push source. A Vercel log drain posts to its ingest URL, and each log entry becomes one event. Its key is
project, taken from the payload’sprojectName, elseprojectId.environmentandsourceride along as labels. - The OpenTelemetry connector receives OTLP/HTTP logs, traces and metrics. One source ingests every service, and resource attributes such as
service.namebecome labels. Theservicelabel comes fromservice.name. - To make the two meet, give the Vercel source a primary label named
servicethat reads theprojectfield. Keep the OTLP source’s primary label asservice. - The values must match. The Vercel project name has to equal the
service.nameyour exporter sends, socheckouton both sides is one entity.
With both sources keyed by service, Tares builds one timeline per service. This is the same pattern the AI SRE guide uses for metrics, logs and alerts.
Set it up
-
Make sure your OpenTelemetry exporter sets
service.nameto the same string as the Vercel project name, for examplecheckout. -
Create both sources in Sources → Add source, or with
POST /api/sources, or ask a connected agent to do it. Both useserviceas the primary label:
- name: web-logs
connector: vercel
config:
labels:
- { name: service, field: project, primary: true }
- { name: environment, field: environment }
- { name: source, field: source }
- name: otel
connector: otlp
config:
labels:
- { name: service, field: service, primary: true }- Point your exporter at Tares. Use the HTTP endpoint, or the gRPC one if you installed the
otlp-grpcextra:
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8787 # OTLP/HTTP → /v1/{logs,traces,metrics}
# or gRPC (otlp-grpc extra): OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317-
Copy the Vercel source’s ingest URL from its page. It has the form
https://<host>/ingest/<ingest_key>. Vercel delivers from its cloud, so the URL must be publicly reachable. Use a deployed instance or a tunnel, because a barelocalhostdaemon will not receive drains. -
In Vercel, go to Team Settings → Log Drains → Add Log Drain. Set the endpoint to the ingest URL and the delivery format to JSON. Vercel verifies the endpoint with an
x-vercel-verifyheader, and Tares echoes it back. -
If your Tares instance is secured, both senders use a Bearer Authorization header holding an ingest-scoped API key. Add it as a custom header on the Vercel drain and in the OTLP exporter headers. Without auth on, you need no key.
-
Verify. Recent events on each source shows entries arriving. In Explore, pick your service under the
servicekey and check that log lines and metric points appear together.
What you get
- One timeline for the service, with Vercel log entries and OpenTelemetry metric values side by side on one clock.
- One read per service. In Explore, or from a connected agent that reads that service, you get the logs and the metrics together instead of querying two systems.
- Several Vercel projects through one drain. Each project shows up as its own entity, and each lines up with the OTel service of the same name.
- Traces and OTel logs for the same service on the same timeline, since the OTLP source ingests all three signals under the same
servicelabel. - A base for triggers and agents. Once both sources share
service, you can build triggers over them keyed byservice, as the AI SRE guide shows.
When something else fits
- If your app already exports its logs over OpenTelemetry, a single otlp source carries logs and metrics under one
servicelabel, and you do not need the Vercel drain for that service. - If the Vercel
projectfield is sparse, check Fields on the Vercel source. You can pick a denser field as the key, or slice bysourceorenvironment. - If the project name and the
service.namediffer, align one of them first, because Tares joins on the label value.