Skip to Content

How can an AI SRE match a jump in OpenTelemetry metric series to the lines in logs from Docker containers?

Tares lets an AI SRE line up a jump in OpenTelemetry metrics with Docker container log lines by giving both sources the same primary service label. The agent reads one window for that service, so it sees when the metric moved and when the log lines changed. You set up an otlp source for the metrics and a docker_logs source for the container, and Tares merges them on one timeline per service.

How it works

Tares correlates by label. Every source that carries the same primary service label lands on one timeline for that service, with metrics and logs on one clock. The AI SRE guide builds its agent from exactly this read.

Two sources feed the timeline here:

  • OpenTelemetry metrics. The OpenTelemetry connector receives OTLP/HTTP logs, traces and metrics. One source ingests every service, and resource attributes such as service.name become labels. The service label reads its value from resourceAttributes.service.name. OTLP events have no bare service field, so a label with field: service gets no value.
  • Docker container logs. The Docker logs connector tails a running container’s logs, one event per line. It has no resource attributes, so you give the source a constant service label.

Mark the service label primary on both sources, and make the constant on the Docker source equal the service.name your app exports. A metric point for api-server and a log line from the api-server container then sit on the same service timeline.

When an agent reads that service, it gets the window as one correlated timeline. It can compare the time the metric series moved with the time the log lines changed, such as a burst of errors or a new message.

Set it up

  1. Install Tares and start it locally. You can also install with pipx install tares or brew install glassflow/tap/tares.

    uv tool install tares tares up
  2. Open the console at http://127.0.0.1:8787, go to Sources → Add source, and create both sources. Or ask a connected agent to create them. The two definitions look like this. Note that the service label is primary on both:

    - name: otel connector: otlp config: labels: - { name: service, field: resourceAttributes.service.name, primary: true } - name: logs connector: docker_logs poll: 5s config: container: tares-demo-api-server # the container name (docker ps) labels: - { name: service, const: api-server, primary: true }
  3. Make sure the value of service.name in your OpenTelemetry resource matches the constant on the Docker source. In this example both are api-server.

  4. Point your exporter at Tares. For OTLP/HTTP the metrics go to /v1/metrics on the daemon:

    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

    If Tares has auth on, the exporter sends a Bearer Authorization header holding an ingest-scoped API key. Without auth you do not need it.

  5. Check both sources. Open each one and look at Recent events: metric points appear for the otlp source and log lines appear on the next poll for the Docker source. If no lines arrive, check that taresd can run docker logs for the container. If the container runs under Compose without a fixed container name, set container to the service name and add compose_file.

  6. Start the MCP endpoint in a second terminal so your agent can read the timeline:

    tares mcp

    Connect your MCP client as the AI SRE guide describes, then ask:

    Use tares: what happened to api-server in the last 15 minutes?

What you get

  • One window per service. The metric points and the container log lines for api-server come back together on one clock, so the agent reads them side by side instead of querying two systems.
  • Timing you can act on. The agent sees when the metric series moved against when the log lines changed, and can tie the jump to specific lines.
  • No per-service setup on the metric side. The otlp source ingests every service. A new service that exports service.name shows up under the service key in Explore.
  • The same read for pull and push. You can ask a connected client on demand, or have a trigger over these sources wake an agent. In both cases the agent works from the same correlated timeline.
  • A timeline that gets smarter. When an agent writes a finding back, the next investigation of that service starts from it.

When something else fits

  • If the logs already come through your OpenTelemetry pipeline, send them to the same otlp source instead of adding a docker_logs source. The service label then covers logs and metrics in one place.
  • If your metrics live in a Prometheus server rather than arriving over OTLP, use the Prometheus connector from the AI SRE guide and keep the same service key.
  • If the container is not on a host where taresd can reach the Docker daemon, the Docker connector cannot tail it, so use another route for those logs.

Still stuck? Get help

Last updated on