Skip to Content

How do I tie Datadog monitors to the right service?

Tares ties Datadog monitors to a service through a label on the webhook source. Map one field of the monitor payload, such as service, to the primary label your metrics and logs also carry, and the monitor alerts join that service’s timeline. Datadog reaches Tares through the webhook connector and a Datadog webhook setup, because Tares has no connector of its own for Datadog today.

How it works

Tares builds one timeline per entity, and the entity comes from the primary label on each source. Metrics, logs and alerts that carry the same primary label value, for example service set to checkout, merge onto one clock. The AI SRE guide builds this wiring end to end.

For Datadog, the pieces are:

  • A Datadog webhook. You write the payload yourself as JSON in the webhook Payload field, using Datadog variables, so you decide which field names the service.
  • A webhook source in Tares. The webhook connector stores the payload lossless and lets you declare labels that map payload fields into the envelope. Mark one label primary.
  • A matching label name and value. The label name and the value must match what your metrics and logs sources use. If they use service, name your Datadog label service too, and send the same service name.
  • A flat payload. event_type_field and text_template read top-level fields only, so keep the JSON you write in Datadog flat.

The monitor calls the webhook when its message contains @webhook-<name>.

Set it up

  1. Create the webhook source in Tares. Go to Sources → Add source → webhook, or ask a connected agent to create it. Declare a label for the service field and mark it primary:
- name: ci-events connector: webhook config: event_type_field: action text_template: '{action} by {sender}' labels: - { name: pipeline, field: pipeline, primary: true }

This is the shape of a webhook source. For Datadog, set the label name to the label your metrics and logs use, such as service, and set field to the top-level payload field that holds the service name.

  1. Copy the ingest endpoint from the source page. The URL has the form /ingest/<ingest_key>.

  2. Add the webhook in Datadog. Open the Webhooks integration, add a webhook, and set its URL to the Tares ingest URL.

  3. Write the payload. In the Payload field, write a flat JSON object that includes a field carrying the service name, plus any other fields you want, filled from Datadog variables such as $ALERT_ID, $EVENT_MSG and $LINK.

  4. Add the credential if Tares has auth on. In the webhook’s custom headers, written as JSON, add an Authorization Bearer header holding an ingest-scoped API key. On an instance without auth, you need no header.

  5. Point the monitor at the webhook. Put @webhook-<name> in the monitor message.

  6. Check the mapping. Post a sample payload to the ingest URL, for example:

curl -X POST https://<your-tares>/ingest/<ingest_key> \ -H 'content-type: application/json' \ -d '{"service": "checkout", "commit": "9f2c81d", "author": "dana", "message": "raise db pool size"}'

Then open the source page. Recent events shows what arrived, and Fields shows which payload fields arrive and how often, so you can confirm the service field is present on every event and pick a reliable key.

  1. Trigger a real monitor and open the timeline for that service. The alert appears next to its metrics and logs.

What you get

  • Datadog monitor alerts land on the same per-service timeline as your metrics and logs, merged on one clock.
  • A trigger or agent that reads the service timeline sees the alert in context, next to the evidence around it.
  • The full Datadog payload is stored lossless, so fields you did not map to labels are still there to read.
  • A Fields view on the source page that shows how often each payload field arrives, which helps you choose the field that names the service.
  • Datadog keeps owning alerting. Tares ingests what the monitor sends and correlates it.

When something else fits

  • If a monitor payload has no field that names the service, add one in the Datadog Payload field before mapping it, since the label reads a payload field.
  • If your alerts come from Prometheus rules or Alertmanager, the prometheus_alerts and alertmanager connectors read those directly, as the AI SRE guide shows, with no payload to write.

Still stuck? Get help

Last updated on