Datadog
Receive Datadog monitor notifications in Plural
A Datadog webhook delivers monitor notifications from the Datadog Webhooks integration into Plural. Each request is one alert. Datadog's default webhook payload does not carry a status Plural can read, so you give the webhook a custom payload that does.
An alert does not start a job by itself. A job starts only when a webhook trigger on a workbench matches the alert, and only when the alert starts firing: the first firing notification for an alert, or a firing notification for an alert that had resolved. Repeat notifications for an alert that is still firing do not start another job, and an alert starts at most one job per workbench per hour.
What Plural reads from the payload
Use a payload like this one. Every value is a Datadog template variable:
{
"id": "$ALERT_CYCLE_KEY",
"title": "$EVENT_TITLE",
"body": "$TEXT_ONLY_MSG",
"status": "$ALERT_TYPE",
"alert_type": "$ALERT_TYPE",
"priority": "$ALERT_PRIORITY",
"link": "$LINK",
"project": "$TAGS[plrl_project]",
"cluster": "$TAGS[plrl_cluster]"
}ididentifies the alert, so a later notification with the sameidupdates it.$ALERT_CYCLE_KEYstays the same from the time a monitor triggers until it recovers, so the recovery resolves the same alert. Keep it quoted: anidthat is not a string is dropped.statussets the state, falling back toalert_transition. Plural matches these lowercase values exactly:firing,triggered,trigger,alert,alerting,warning,error, andcriticalare firing. Everything else is resolved, including a missing status.prioritysets the severity:P1is critical,P2high,P3medium,P4andP5low. Without a priority,alert_typesets it:errorandcriticalare critical,warningis medium, andinfois low.titlebecomes the alert title, defaulting to "Datadog Alert".titleandbodytogether become the alert summary. Without abody, Plural usestext_titleormessage.link(orurl) is the link back to Datadog.metais stored as annotations.tags, as a JSON list ofkey:valuestrings, is stored as tags.
$ALERT_TYPE is error, warning, success, or info, so it gives both a status and a severity Plural understands. Do not use $ALERT_TRANSITION for status. Its values are capitalized (Triggered, Recovered), and Plural reads them as resolved.
Associate alerts with Plural resources
Plural keeps an alert only when it belongs to a Plural project, cluster, or service, or when a workbench trigger matches it. Otherwise the request is acknowledged and ignored. Plural looks in these places, in order:
- Project:
meta.project, thenproject, then aplrl_project,project, orplural_projecttag. - Cluster (by handle):
meta.cluster, thencluster, then aplrl_cluster,cluster, orplural_clustertag. - Service:
meta.serviceorserviceas<cluster-handle>/<service-name>, or aplrl_service,service, orplural_servicetag holding the service name when the cluster is also known.