Datadog
Connect
Connect Datadog from the terminal. Pass --help for the flags Datadog accepts.
polylane integration connect --type datadogAn API key and an application key for your Datadog site.
Connect your Datadog organization with an API key and an application key.
- Select your Datadog site: US1 (
datadoghq.com), US3, US5, EU (datadoghq.eu), AP1, or US1-FED (ddog-gov.com). Your Datadog URL shows the site:app.datadoghq.comis US1. - In Organization Settings → API Keys, create an API key. Paste it into Polylane.
- In Organization Settings → Application Keys, create an application key with the scopes listed under Application key scopes. Paste it into Polylane. Polylane checks both keys and shows the scopes of the application key.
Polylane encrypts both keys before it stores them, and the agent never sees them.
On connect, Polylane creates a webhook named polylane in Datadog. It adds the @webhook-polylane mention to the message of each monitor and adds the polylane:managed tag to each monitor.
Register Datadog alerts to Polylane alongside your Terraform-managed resources.
Polylane subscribes a monitor with the @webhook-polylane mention in its message and the polylane:managed tag. The hourly sync adds both to every monitor, so a Terraform-managed monitor shows drift until its Terraform config has them too. Add both to each monitor:
resource "datadog_monitor" "high_error_rate" {
name = "High error rate on checkout"
type = "metric alert"
query = "sum(last_5m):sum:trace.http.request.errors{service:checkout}.as_count() > 50"
message = <<-EOT
{{#is_alert}}Error rate on checkout is above threshold.{{/is_alert}}
@webhook-polylane
EOT
tags = concat(var.tags, ["polylane:managed"])
}
The simplest setup lets Polylane manage the webhook, and puts only the mention and the tag in Terraform. If you also manage webhooks in Terraform, import the webhook that Polylane created. Do not create a second one, because Datadog webhook names are unique. Add the resource block first, then import:
resource "datadog_webhook" "polylane" {
name = "polylane"
url = "https://sinks.polylane.com/v1/datadog"
encode_as = "json"
custom_headers = jsonencode({
"x-polylane-telemetry-token" = var.polylane_telemetry_token
})
payload = <<-EOT
{
"alert_id": "$ALERT_ID",
"alert_metric": "$ALERT_METRIC",
"alert_query": "$ALERT_QUERY",
"alert_scope": "$ALERT_SCOPE",
"alert_status": "$ALERT_STATUS",
"alert_title": "$ALERT_TITLE",
"alert_transition": "$ALERT_TRANSITION",
"alert_type": "$ALERT_TYPE",
"date": "$DATE_POSIX",
"event_msg": "$EVENT_MSG",
"event_title": "$EVENT_TITLE",
"event_type": "$EVENT_TYPE",
"hostname": "$HOSTNAME",
"id": "$ID",
"link": "$LINK",
"logs_sample": $LOGS_SAMPLE,
"org_id": "$ORG_ID",
"org_name": "$ORG_NAME",
"priority": "$PRIORITY",
"snapshot": "$SNAPSHOT",
"tags": "$TAGS",
"user": "$USER",
"username": "$USERNAME"
}
EOT
}
Keep the payload a raw JSON body. Datadog replaces $LOGS_SAMPLE with a JSON object, and quotes around it break the body.
terraform import datadog_webhook.polylane polylane
The telemetry token connects alert deliveries to your workspace. Find it in Polylane under Settings → Telemetry tokens (the token named datadog-integration), or create a token on the same page. When you connect the integration again, Polylane creates the webhook again with a different token. Update the token variable of an imported webhook after that.
How it works
Monitors start investigations
Each monitor notification goes to the polylane webhook. A triggered or re-triggered monitor opens an issue in Polylane, and Polylane triages it. More notices from the same monitor go to the same issue. Polylane records a Warn or No Data notice, but that notice does not start triage. A recovery notice goes on the issue timeline, and the agent uses it as evidence. The issue stays open after a recovery notice.
Every hour, Polylane adds the mention and the tag to each monitor that does not have them. A monitor that you create reaches Polylane within one hour. Synthetics monitors use a different Datadog API, so Polylane does not change them and their alerts do not reach Polylane.
On the Alerts tab of the integration page, turn automatic triage on or off for the connection or for each monitor.
Checks
Polylane runs checks on your Datadog data every 30 minutes. Built-in checks watch host CPU, load, disk and network errors, APM latency, throughput and Apdex, RUM page load, log ingest, Error Tracking issues, Postgres, and Redis. Polylane also makes checks from the widgets of your dashboards and from up to ten of your metric and log-count monitors. It samples recent log lines to find errors that it did not see before. It also finds signals: queries that watch one business operation, such as a checkout.
Under Anomaly detection on the integration page, change how often the checks run, or turn them off. Polylane also explores the connection when you connect it and every 12 hours, and opens an issue for each problem that it finds.
Context graph
Every hour, Polylane links the resources that send telemetry to Datadog to a Datadog node in the context graph. These resources include hosts, AWS resources of the AWS accounts that both Datadog and Polylane read, and Kubernetes deployments.
During an investigation
Agents search logs, query metrics, aggregate APM spans, and read monitors, dashboards, SLOs, hosts, events, Datadog incidents, and the service dependency map. Agents can also create monitors, dashboards, and SLOs, mute a monitor, or schedule a downtime. Each change needs safety review and approval before it runs.
Polylane checks both keys every six hours. Under Credentials on the integration page, verify the saved keys or replace them.
Application key scopes
An application key without scopes has the same access as the user that created it, and it works without changes.
If you scope the key, include user_app_keys. Polylane cannot connect without it. Also include these scopes:
logs_read_data,timeseries_query,metrics_read,apm_readmonitors_read,monitors_write,monitors_downtimedashboards_read,slos_read,hosts_read,events_read,incident_readaws_configuration_readcreate_webhooks
Disconnecting
Disconnecting deletes the polylane webhook. It does not remove the @webhook-polylane mention or the polylane:managed tag from your monitors. Remove them from each monitor, and from your Terraform configs. Then revoke the application key and the API key in Datadog.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Polylane removes what Datadog's API lets it remove. The following stays until you remove it yourself:
- @webhook-polylane appended to every monitor message
- polylane:managed tag on every monitor
polylane integration disconnect <id>Tools
12Operations agents can perform in threads.