How do I pair alerts from Prometheus with logs from Vercel projects for an AI SRE?
Tares pairs Prometheus alerts with Vercel logs when both sources carry the same primary service label. Each service then has one timeline, so a firing alert sits next to the log lines from the same window. You use the prometheus_alerts connector for the alerts and the vercel connector for the log drain, and an agent or trigger reads the merged timeline.
How it works
- The
prometheus_alertsconnector polls the alerts your Prometheus rules have fired, every 30 seconds by default. Each alert becomes one event with the alert name as its event type, its summary as text, and its labels as Tares labels plus astateoffiring,pendingorresolved. An alert fires once, and aresolvedevent follows when it clears. - The
vercelconnector receives a Vercel log drain at an ingest URL. It makes one event per log entry. By default the key is theprojectlabel, withenvironmentandsourceas further labels. One drain can carry several projects, and each appears as its own entity. - Tares correlates sources that share a primary label. If both sources use a
servicelabel with the same values, metrics, logs and alerts for that service merge on one clock. The AI SRE guide builds its whole setup on this pattern, with every source keyed by the sameservicelabel. - Prometheus keeps owning alerting. Tares ingests what fired, correlates it with the logs, and can wake an agent.
The values must match. The service label on your alerts has to equal the Vercel project name you use as the service label on the log source.
Set it up
- Make the Vercel endpoint reachable. Vercel delivers from its cloud, so the ingest endpoint must be public. Use a deployed instance or a tunnel, because a bare
localhostdaemon does not receive drains. For a local try-out, start Tares first:
tares up- Add the alerts source under Sources → Add source → Prometheus alerts. Enter the Prometheus
urland run Discover. It proposes theseverityandstatelabels. Per-alert labels such asserviceonly exist while an alert is firing, so addservicefrom the Fields tab once alerts have been ingested. The finished source looks like this:
- name: alerts
connector: prometheus_alerts
poll: 30s
config:
url: http://localhost:9090
severities: critical,warning # blank = all
labels:
- { name: service, field: labels.service, primary: true }
- { name: severity, field: labels.severity }
- { name: state, field: state }- Add the logs source under Sources → Add source → vercel. It needs no connector-specific config. Instead of making
projectthe key, name the primary labelserviceand read it from the payload’sprojectfield, so it lines up with the alerts:
- name: web-logs
connector: vercel
config:
labels:
- { name: service, field: project, primary: true }
- { name: environment, field: environment }
- { name: source, field: source }-
Copy the source’s ingest endpoint from its page. It is a stable URL of the form
https://<host>/ingest/<ingest_key>. In Vercel, go to Team Settings → Log Drains → Add Log Drain, set the endpoint to that URL and the delivery format to JSON. Vercel verifies the endpoint with anx-vercel-verifyheader, which Tares echoes back. If your instance runs with auth on, add an ingest-scoped API key to the drain as a custom header,Authorization: Bearerfollowed by the key. -
Check both sources. Recent events shows entries arriving. Fields shows which
servicevalues appear and how dense each field is. The alert values and the Vercel project names must be the same strings. See the Prometheus alerts and Vercel pages for every option. -
Open Explore and pick a service. The alerts and the Vercel log lines appear on one timeline. To let an agent read it, start the MCP endpoint and ask about the service by name:
tares mcpWhat you get
- One timeline per service, with firing and resolved alerts and the Vercel log lines on the same clock, so you see what the logs said when the alert fired.
- An alert that fires once and clears with a
resolvedevent, instead of a copy on every poll. - A trigger that watches both sources keyed by
serviceand fires when an alert event arrives, as in the AI SRE guide. It can wake a Tares agent, your own agent service over a webhook, or a Slack channel. - An agent that reads the correlated timeline for one service, names the likely cause from the log lines, and writes its finding back to that timeline for the next investigation.
- Several Vercel projects through a single drain, each one its own service.
When something else fits
- If Alertmanager routes your alerts, use the
alertmanagerconnector instead of polling Prometheus, and keep the sameservicelabel. - If the Vercel project name is not the right key for your alerts, key both sources by another label, or slice the Vercel logs by
sourceorenvironment.