Alert sources
Point Datadog, Grafana, Sentry, CloudWatch and others straight at treason.app. No translation layer.
Most monitoring tools can POST JSON to a URL when something breaks. You do not need a bridge, a Lambda or an Opsgenie shim: each tool posts its own payload to treason.app, and we read it. Resolved notifications close the alert; repeats of a firing alert de-duplicate.
#How it works
- Create an integration of kind
inboundand name the tool (source). In the dashboard: Integrations → Add → pick the tool. - You get a URL with the key in it:
https://api.treason.app/inbound/<source>?key=<key>- Paste it into the tool. The tool's own setup page, below, says where.
The key can be sent however the tool is able to: in the query string (key, token or auth_token), as Authorization: Bearer <key>, as HTTP Basic auth with the key as the password, or as X-Treason-Key. Keys in query strings are removed from our logs. A key only works on the source it was made for.
curl -X POST "$TREASON_API_URL/v1/integrations" \
-H "Authorization: Bearer $TREASON_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "Prod Datadog", "kind": "inbound", "source": "datadog", "teamId": "'$TEAM_ID'"}'const { integration, key } = await treason.integrations.createSource({
name: "Prod Datadog", source: "datadog", teamId,
});
// post to `${baseUrl}/inbound/datadog?key=${key}`treason integration create "Prod Datadog" --source datadog --team <team-id>#What every source does the same way
| The tool says | We do |
|---|---|
| A problem started | Open an alert and page the team's policy |
| The same problem again | De-duplicate into the open alert (dedupCount goes up) |
| The problem cleared | Close that alert |
| It is not an incident (a test ping, an unsupported state) | Answer 200 and do nothing, so the tool does not retry |
| The payload is not what that tool sends | Answer 422 with the reason, so a setup mistake is obvious |
Priority comes from the tool's own severity. You can change what a severity means per integration with config.priorityMap, for example { "warning": "P4" } to make Alertmanager warnings push-only. Without a severity the alert is P3, or config.defaultPriority.
#Check a payload before you point a tool at us
POST /v1/inbound/preview reads a sample the way an integration would and says what it would do, creating nothing.
curl -X POST "$TREASON_API_URL/v1/inbound/preview" \
-H "Authorization: Bearer $TREASON_API_KEY" -H "Content-Type: application/json" \
-d '{"source": "datadog", "payload": {"title": "Disk low", "alert_transition": "Triggered", "alert_type": "error"}}'#Prometheus Alertmanager
receivers:
- name: treason
webhook_configs:
- url: "https://api.treason.app/inbound/alertmanager?key=<key>"
send_resolved: trueEach alert in a group becomes its own alert, identified by Alertmanager's fingerprint. severity: critical is P1, error and high P2, warning P3, info P4. Set a priority: P2 label on a rule to override. send_resolved: true is what lets us close alerts.
#Grafana
Add a Webhook contact point with https://api.treason.app/inbound/grafana?key=<key>, and route your alert rules to it. Grafana-managed (unified) alerting and the legacy alerting webhook are both understood. The alert links (dashboard, panel, silence) are added to the description.
#Datadog
Datadog sends whatever JSON you write, built from its template variables, so use this payload in Integrations → Webhooks:
{
"alert_id": "$ALERT_ID",
"alert_cycle_key": "$ALERT_CYCLE_KEY",
"alert_scope": "$ALERT_SCOPE",
"alert_transition": "$ALERT_TRANSITION",
"alert_type": "$ALERT_TYPE",
"alert_priority": "$ALERT_PRIORITY",
"title": "$EVENT_TITLE",
"message": "$TEXT_ONLY_MSG",
"tags": "$TAGS",
"link": "$LINK",
"hostname": "$HOSTNAME"
}The webhook's URL is https://api.treason.app/inbound/datadog?key=<key>; mention it as @webhook-<name> in a monitor. Recovered closes the alert. $ALERT_CYCLE_KEY ties a trigger to its recovery, so keep it in the payload. The monitor's P1–P5 priority is used when set; otherwise error is P2, warning P3, info P4.
#Sentry
In Settings → Developer Settings, create an internal integration, set its webhook URL to https://api.treason.app/inbound/sentry?key=<key>, and enable the Alert Rule Action and, if you want them, the Issue webhook.
- Issue alerts page once per issue. Later events of the same issue de-duplicate. The event's
levelsets the priority (fatalP1,errorP2,warningP3). - Metric alerts page on
criticalorwarningand close onresolved. - Issue webhooks:
createdpages,resolvedcloses; other actions (assigned, archived) are ignored.
#Amazon CloudWatch
CloudWatch reaches us through SNS:
- Create an SNS topic, and an HTTPS subscription to
https://api.treason.app/inbound/cloudwatch?key=<key>. We confirm the subscription for you (we only visitsns.<region>.amazonaws.comaddresses). - Use the topic as the alarm's ALARM and OK actions.
ALARM opens an alert, OK closes it. INSUFFICIENT_DATA is ignored unless you set config.insufficientData to "trigger". Start an alarm's description with [P1] to set its priority. EventBridge alarm state changes work the same way.
#Google Cloud Monitoring
Create a Webhook notification channel with the URL https://api.treason.app/inbound/gcp?auth_token=<key> (a token in the URL is Google's own option for webhooks) and attach it to an alerting policy. An incident opening pages; it closing closes the alert. The policy's severity (Critical, Error, Warning) sets the priority.
#Azure Monitor
In an action group, add a Webhook action with https://api.treason.app/inbound/azure?key=<key> and turn on Enable the common alert schema. Fired pages and Resolved closes. Sev0 is P1 down to Sev4 as P5.
#Anything else: the generic mapper
For a tool we have no source for, describe its JSON once. Each field is a path ($.alert.title), a template ({{ $.name }} is {{ $.status }}), or literal text.
{
"name": "Uptime checks",
"kind": "inbound",
"source": "generic",
"config": {
"mapping": {
"each": "$.checks",
"message": "{{ $.name }} is {{ $.status }} ({{ $.url }})",
"alias": "$.id",
"priority": "$.severity",
"priorityMap": { "major": "P1", "minor": "P4" },
"resolveWhen": { "path": "$.status", "values": ["up", "recovered"] },
"tags": "$.labels",
"description": "{{ $.error }}",
"details": { "region": "$.region" }
}
}
}| Field | Meaning |
|---|---|
message | Required. What the page says. |
alias | Same alias, same alert. Defaults to a digest of the message. |
each | A path to an array with one alert per element; other paths are then read from each element. Leave it out when the body is one alert. |
priority, priorityMap | What to read, and how its values map to P1–P5. Plain P1–P5 and severity words work without a map. |
resolveWhen | The alert closes when this path's value is one of values (case-insensitive). |
tags, description, entity, details | Optional extras. |
Paths support keys, array indexes and quoted keys: $.a.b[0], $["odd key"]. They cannot run code. A mapping with a bad path is rejected when you save it, naming the field, and preview shows what a sample would do.