Skip to Content

How do I feed incident data into Tares from my own scripts?

Tares takes incident data from any script that can send an HTTP request. You create a webhook source over the HTTP API, POST JSON events to its ingest URL, and read one correlated timeline back. The whole setup exports as a YAML catalog you can keep in git.

How it works

Everything the console and the MCP tools do goes through the HTTP API of the Tares daemon, so your scripts use the same endpoints. The loop has four parts:

  • Create a source. A webhook source accepts arbitrary JSON, one object, a list, or NDJSON. Its config maps payload fields into the Tares envelope with labels, and the label you mark primary is the entity key.
  • Post events. Each source has an ingest URL built from its ingest_key. The full payload is stored lossless. Numeric fields such as latency_ms become typed fields that triggers can aggregate over.
  • Read the timeline. POST /read takes a label selector and a time window and returns time-ordered events from every source that carries that label. You can limit it to some sources with sources, or to one project with project.
  • Keep the catalog. The sources and triggers you build are catalog state, and YAML is its portable form.

For more on the connector itself, see the webhook connector page. The wider picture of how Tares fits incident work is in AI SRE.

Set it up

  1. Start Tares locally with tares up. The API listens at http://127.0.0.1:8787.

  2. Create a webhook source over the API. The response includes the ingest_key.

curl -s -XPOST localhost:8787/api/sources -H 'content-type: application/json' -d '{ "name": "checkout_probe", "connector": "webhook", "config": { "event_type": "probe", "text_template": "latency {latency_ms}ms on {endpoint}", "labels": [{ "name": "service", "field": "service", "primary": true }] } }'

You can also add the same source in the console under Sources, Add source, webhook, using this YAML:

- name: ci-events connector: webhook config: event_type_field: action text_template: '{action} by {sender}' labels: - { name: pipeline, field: pipeline, primary: true }
  1. Post events from your script. Locally you can post to the source by name:
curl -s -XPOST localhost:8787/ingest/checkout_probe -H 'content-type: application/json' \ -d '{"service": "checkout", "endpoint": "/pay", "latency_ms": 1450}'

When producers deliver over the network, post to the stable, unguessable path built from the ingest_key instead, as in /ingest/ followed by the key. On a secured instance (tares up --auth), your script also sends an ingest-scoped API key as an Authorization: Bearer header. Tares needs this header only when auth is on.

  1. Check the label mapping. Post a sample payload to the ingest URL, then open the source page and read Recent events and Fields. Fields shows which payload fields arrive and how often, which helps you pick a reliable key. The test_source tool on a push source takes no payload. It only returns the ingest endpoint, so it does not check the mapping.

  2. Read the correlated timeline for one entity:

curl -s -XPOST localhost:8787/read -H 'content-type: application/json' \ -d '{"selector": {"service": "checkout"}, "window": "15m"}'

To read only some sources, add "sources": ["checkout_probe"] to the body.

  1. Export the catalog as YAML and keep it in git:
curl -s localhost:8787/api/catalog/export > catalog.yaml

To restore it, import it from the console under Catalog or with POST /api/catalog/import. Import supports merge or replace, and Tares validates the whole file before it writes anything. A fresh daemon started with TARES_CATALOG=catalog.yaml tares up rebuilds the whole setup on first boot.

The HTTP API guide walks the same loop with triggers and write-back as well.

What you get

  • A generic inbound path for anything that can send JSON: cron jobs, CI steps, your own services and incident tooling.
  • Lossless storage of every payload, with labels that map the fields you care about into a shared envelope.
  • Typed numeric fields that triggers can aggregate over.
  • One time-ordered timeline for an entity, drawn from every source that carries the label. Logs, metrics and commits arrive interleaved on one clock.
  • A catalog you can export, review in git, share and reload, so a new daemon reproduces your setup.

When something else fits

  • If the data comes from a system Tares already polls, such as Prometheus, Postgres or GitHub, use that connector so Tares pulls the data for you instead of your script pushing it.
  • If your producers speak OpenTelemetry, send it over OTLP rather than hand-built JSON.
  • If you want an agent to set the source up for you, ask a connected agent to create the webhook source. It calls create_source and returns the ingest URL.

Still stuck? Get help

Last updated on