How do I pair alerts from Prometheus with OpenTelemetry log records for an AI SRE?
Tares pairs Prometheus alerts with OpenTelemetry logs when you give both sources a primary label named service, so one timeline holds the firing alert and the log lines from the same window. The prometheus_alerts source polls the alerts Prometheus has already fired. The otlp source receives your OpenTelemetry logs. An agent or trigger then reads both on the same service timeline.
How it works
Tares correlates by label. Any sources that carry the same service label land on one timeline for that service, with their events merged on one clock. The AI SRE guide builds its incident agent this way, with every source keyed by service.
The two sources fill that label from different places:
- Alerts. The Prometheus alerts connector polls Prometheus’s own alerts endpoint. It emits one event per active alert, with
event_typeset to the alert name andtextset to its summary. The alert’s labels become Tares labels, plus astateoffiring,pendingorresolved. Each alert fires once and emits aresolvedevent when it clears. - Logs. The OTLP connector receives OTLP/HTTP logs, traces and metrics. One source ingests every service. The service name comes from the resource attribute
service.name, so the label reads fromresourceAttributes.service.name. OTLP events have no bareservicefield, so a label withfield: servicegets no value.
Mark the service label primary on both sources. Both then key the same entity, and a firing alert arrives next to the log lines from the same window.
An alert’s dynamic labels, such as namespace and service, exist only while it fires. Discover proposes only severity and state. Add service from the Fields tab once real alerts have been ingested.
Set it up
-
Install and start Tares.
uv tool install tares # or: brew install glassflow/tap/tares tares up -
Add the alerts source under Sources → Add source → Prometheus alerts, or ask a connected agent to create it. Enter your Prometheus
urland run Discover. Then add aservicelabel that readslabels.serviceand mark it primary. This works when your alerting rules put aservicelabel on the alerts they fire.- 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 → otlp. It has no required config. The
servicelabel reads the resource attribute and is primary.- name: otel connector: otlp config: labels: - { name: service, field: resourceAttributes.service.name, primary: true } -
Point your OpenTelemetry exporter or Collector at Tares. For gRPC, install the
otlp-grpcextra first. On a secured instance, the exporter sends an ingest-scoped API key as a Bearer Authorization header. Tares needs this only when auth is on.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 -
Verify. On the alerts source, Recent events shows one event per active alert. On the OTLP source, it shows logs as they arrive, and Explore lists services under the
servicekey. Pick a service in Explore to see its alerts and log lines merged on one clock. -
Wake an agent on the alert. Create a trigger over both sources, keyed by
service, that fires when an alert event arrives, as the AI SRE guide does. Prometheus keeps owning alerting, and Tares ingests what fired and correlates it with the evidence.
What you get
- One timeline per service that merges Prometheus alerts and OpenTelemetry log lines on the same clock.
- An agent that reads the alert and the surrounding logs in a single correlated read, instead of querying each system.
- A trigger that wakes your agent when an alert event arrives, with the correlated timeline for that service.
- Alert lifecycle on the timeline. Each alert appears once, and a
resolvedevent lands when it clears. - No per-service setup on the log side. One OTLP source covers every service your exporters send.
When something else fits
- If Alertmanager already routes your alerts, use the Alertmanager connector, which receives them at a Tares ingest URL instead of polling Prometheus. Keep the same primary
servicelabel. - If your logs come from a container rather than an OpenTelemetry pipeline, the Docker logs connector tails the container, and you key it by the same
servicelabel.