Datadog
Use Datadog monitors and metric queries as release wave checks, post a Datadog event when a release or sync lands, what happens when Datadog is down, and what has only been tested against a fake.
Connect Datadog and two things become possible.
- A release wave's checks can read Datadog: hold the next wave while a chosen monitor is alerting, or while a metric query is over its limit. This sits beside Prometheus; a check says which it reads.
- Wardn posts a deploy marker, a Datadog event, when a release finishes, a sync applies, or a release fails or is rolled back, so a change shows up next to the graph it moved.
Wardn has been built and tested against a fake Datadog (an in-process HTTP server that answers like the documented API). No real Datadog account was available, so the exact responses of the real service, in particular the monitor search and events endpoints, have not been confirmed against it. Try Test connection on a real account before relying on it.
Connect it
You need integration:manage (Owners and Admins) and a server with WARDN_SECRET_MASTER_KEY set, because Wardn keeps both keys in its secret store. Create an API key and an application key in Datadog (Organization settings), then connect from Integrations, Datadog, or with the API:
curl -fsS -X PUT "$WARDN_API_URL/api/v1/deploy-markers/datadog" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"name":"Datadog","site":"us1","apiKey":"…","appKey":"…"}'The site is one of Datadog's regions, chosen from a fixed list, never typed as an address: us1 (datadoghq.com), eu1 (datadoghq.eu), us3, us5 and ap1. Wardn calls https://api.<site> and nothing else, so a key can only ever be sent to Datadog. Federal and AP2 sites are not offered.
Keys are write-only. They go into the secret store as integrations/datadog/<connection id>/api-key and …/app-key. The API and the screens return only where each is kept and whether it is found, such as Wardn · integrations/datadog/6f1c…/api-key and Found, never a value. To change one, send the new one; a key left out keeps the one stored.
Test connection (POST /api/v1/deploy-markers/datadog/test, also available before saving) makes two read-only calls: GET /api/v1/validate for the API key, and a monitor search with the application key to count the monitors it can see (Site US1; both keys are valid; 38 monitors visible.). The test is repeated every two minutes while connected, and the Integrations page says when it fails.
Wave checks
A check's query names Datadog with a prefix:
| Query | Reads |
|---|---|
datadog:monitor:12345 | The monitor's state as a number: OK is 0, Warn is 1, Alert is 2. No data, unknown, skipped and ignored are unknown. |
datadog:query:avg:system.cpu.user{service:payments} (or datadog: and the bare query) | The last point with a value in the last five minutes of one series. No series is unknown; several series is an error, so aggregate (sum, avg, max). |
Pass a check that must be below 1 to hold the wave while the monitor is Warn or Alert, or below 2 to hold it only while it is Alert. The monitor and the query are read with the application key.
It fails closed. A monitor with no data, a missing monitor, a refused key, a Datadog that is down or slow, a connection that is paused or removed, all read as unknown, never a pass, and the wave pauses and says why. Only a number Datadog actually gave can pass a check.
Each connection has its own circuit breaker: five failures in a row stop requests for 30 seconds. A refused key (401, 403) is not an outage and does not open it; it is reported on the check and on the Integrations page. The detail screen counts the deployments whose waves still to run have a Datadog check (Used by).
Deploy markers
Wardn posts one event for each deployment a moment concerns:
| Moment | Posted when | Alert type |
|---|---|---|
| Release finished | A release completes; one event for each deployment that received it | Info |
| Sync applied | A sync, not a release, changes a deployment | Info |
| Release failed or rolled back | A release fails, or a rollback completes | Error |
Each is a switch. Environments limits markers to those environments (a deployment placed on a cluster with no environment is matched by its cluster's name); with none chosen, every environment posts. The event is POST /api/v1/events with the API key in the DD-API-KEY header, and carries:
- a title. For a release that landed it is the template (
{deployment} {release} landed in {environment}by default); the others read{deployment} synced in {environment},{deployment} {release} failed in {environment}and{deployment} rolled back in {environment}; - a text with the deployment, release, seven-character commit and a link back to the release in Wardn (when the server knows its public address);
- tags, from templates:
source:wardn,env:{environment},service:{deployment}andversion:{sha7}by default.{environment},{deployment},{sha7}and{release}are filled in; other braces are refused. A value with a space or a comma is made safe so it cannot split a tag; - an
aggregation_keyof the moment, so an event sent twice because an answer was lost groups with itself.
curl -fsS -X PUT "$WARDN_API_URL/api/v1/deploy-markers/datadog/settings" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"releaseFinished":true,"syncApplied":false,"releaseFailed":true,"environments":["prod"],"tags":["source:wardn","env:{environment}"],"title":"{deployment} {release} landed in {environment}"}'Recent events (GET /api/v1/deploy-markers/datadog/posts, newest first, paged) shows each with what Datadog answered: 202 · event accepted, Retried · 202 on 2nd try, or why it was refused, such as 403 · the key cannot post events.
When Datadog is down
A marker never holds a release. It is written when the release or sync happens, tried at once, and if Datadog does not answer (timeout, 429, 5xx, an open breaker) it is queued and tried again after 30 seconds, a minute, two, five and then every ten minutes, until an hour after the moment, and then dropped; the list says Dropped after an hour. A refusal that waiting cannot fix (401, 403, 400) is not retried and says what Datadog said. Disconnecting stops the queue, and events already posted stay in Datadog.
Pause Datadog on the Integrations page (Integration health) and no events are posted (those waiting are posted if it is resumed within the hour) and wave checks that read Datadog wait. Deploy markers are not audit entries: each is a record of a release that was already audited. Connecting, changing the settings and disconnecting are audited.
What is not done
- The marker list keeps a month of history.
- A Datadog event is posted at least once. A reply lost after Datadog accepted an event can post it twice; the aggregation key groups them.
- Only the API key is used to post, and only the application key to read monitors and metrics. Neither key is read from an external Vault path; both live in Wardn's secret store.
Opsgenie
Open and close Wardn incidents from Opsgenie alerts, say which tags and priorities count, fill on-call groups from Opsgenie schedules, optionally open an alert when Wardn opens an incident, and what happens when Opsgenie is down.
Grafana
Show releases and syncs on Grafana dashboards as annotations, which dashboards they appear on, what happens when Grafana is down, and what has only been tested against a fake.