Datadog

From Arvo-AI/aurora · View interactive version

Datadog is an AI agent skill from the GitHub repository Arvo-AI/aurora. Datadog monitoring integration for querying logs, metrics, monitors, events, traces, hosts, and incidents during RCA investigations

How to use this skill

Skill file

Datadog Integration

Overview

Datadog integration for querying observability data during Root Cause Analysis. Datadog is a REMOTE service. Use ONLY the query_datadog API tool. All data is accessed via a single unified tool with resource_type parameter.

Instructions

Tool Usage

query_datadog(resource_type=TYPE, query=QUERY, time_from=START, time_to=END, limit=N, interval=MS, account=LABEL)

Resource Types

  1. 'accounts' -- List the connected Datadog organizations. Takes no query and calls no

Datadog API. See "Multiple Organizations" below.

  1. 'logs' -- Search log entries. query=Datadog log query syntax e.g. "service:web status:error"
  2. 'metrics' -- Query metric timeseries (raw points). query=metric query e.g. "avg:system.cpu.user{*}"
  3. 'metric_stats' -- Percentile summary per series (p50/p95/p99/max/mean). Same metric query

syntax as 'metrics', but returns one compact row per series instead of raw points.

Use this for capacity and right-sizing questions over long windows.

  1. 'monitors' -- List monitors with status. query=name filter (optional)
  2. 'events' -- Platform events. query=source filter (optional)
  3. 'traces' -- APM spans/traces. query=span query e.g. "service:web @http.status_code:500"
  4. 'hosts' -- Infrastructure hosts. query=host filter (optional)
  5. 'incidents' -- Datadog incidents. Lists active/recent incidents (requires Incident Management; may 403 if not enabled).

Multiple Organizations

Several Datadog orgs may be connected. They hold separate data: a service present in more

than one has different logs, metrics and hosts in each.

resource_type='accounts' returns the connected orgs with their labels, sites and org names.

Pass account=<label> on any other resource type to query one; omitting it uses the primary.

Every response carries an account field naming the org that answered.

Labels default to each org's own Datadog name and can be overridden, so assume no particular

naming scheme or count. Match the labels from accounts against the alert's own context (its

environment, region, service or tenant tags). This matters because alerts from every org can

arrive through one pipeline, and querying the wrong one does not error -- it returns that

org's healthy data, which reads as "the service is fine" and derails the investigation. If no

label clearly matches, query the primary and say so rather than guessing.

The `interval` Parameter

interval is the rollup granularity in milliseconds, and applies to 'metrics' and

'metric_stats'. Omit it and a granularity is auto-picked that keeps each series under

~1000 points -- a 30-day window auto-picks 3600000 (1 hour, 720 points). Values are

clamped to 60000..14400000. Datadog caps a series at 1500 points, so a long window

with a fine interval returns less than you asked for; prefer the auto-pick.

Percentiles

Datadog cannot compute a time-percentile. Do not attempt any of these -- every one

is rejected or silently empty:

.rollup() accepts only avg, sum, min, max, count.

needs distribution metrics; kubernetes.cpu.usage.total and kubernetes.memory.usage

are gauges, so it can never apply to them.

arguments 2 and 3 are group tags, not a percentile value and window.

Use resource_type='metric_stats' instead. It fetches the rolled-up points and computes

percentiles server-side, using nearest-rank order statistics -- so every reported p95

is a value that actually occurred and a reviewer can find it in the Datadog UI.

Each row carries points and nulls. Always check them. Datadog emits nulls for gaps,

and a row with p95: null plus a note means no data, which is not the same as *low

usage* -- never treat an empty series as an idle workload.

A row may also carry malformed_response: true (with malformed_series at the top level).

That means Datadog described a series but returned no values for it. It is a broken response,

not an idle workload -- re-run rather than concluding anything from it.

Units -- read the `unit` field before any arithmetic

Every row carries unit. Container CPU and memory are reported in different units, and

mixing them up produces a wrong number that still looks plausible:

x1000 for millicores, before comparing against a 500m-style request. Comparing raw

nanocores against millicores is a ~1,000,000x error.

for display only.

usage/limits ratio built from nanocore usage needs the /1e9; a memory bytes/bytes ratio

does not. A ratio whose two sides disagree on units is silently meaningless.

Ratio and scaling expressions work in a single query -- both of these are accepted:

sum:kubernetes.cpu.usage.total{...} by {kube_deployment} / 1e9
(sum:kubernetes.cpu.usage.total{...} by {kube_deployment} / 1e9) / sum:kubernetes.cpu.limits{...} by {kube_deployment}

Also keep requests and limits distinct: saturation monitors usually measure usage

against limits, while right-sizing changes requests. Requests drive scheduling and cost;

limits drive throttling and OOM-kills. Say which field any number refers to.

Reconciliation vs Sizing

These are two different questions and must not be conflated:

definitions with resource_type='monitors' to get their real query strings and

options.thresholds. Query each metric expression on its own. A monitor formula

(a + b, avg:cpu{*} / avg:mem{*}, comma-separated queries) is not itself a

metrics query. This tells you which workloads run hot. It is not the basis of

any recommended number.

usage distribution over the window. Never derive a sizing number from a monitor threshold.

Datadog Query Syntax

Examples

query_datadog(resource_type='metric_stats', query='sum:kubernetes.memory.usage{env:production} by {kube_deployment}', time_from='-30d')

RCA Investigation Workflow

Step 0 -- Confirm which organization to investigate:

query_datadog(resource_type='accounts')

With one connected, continue without account. With several, match the alert to a label and

pass account=<label> on every subsequent step.

Step 1 -- Search logs for errors around the alert time:

query_datadog(resource_type='logs', query='service:affected-service status:error', time_from='-1h')

Step 2 -- Check traces for failing requests and latency:

query_datadog(resource_type='traces', query='service:affected-service @http.status_code:500', time_from='-1h')

Step 3 -- Query metrics for resource correlation (CPU, memory, error rates):

query_datadog(resource_type='metrics', query='avg:system.cpu.user{host:X}', time_from='-2h')

Step 4 -- List monitors to understand alerting context:

query_datadog(resource_type='monitors')

Step 5 -- Check hosts for infrastructure health:

query_datadog(resource_type='hosts', time_from='-1h')

Step 6 -- Review incidents for related/correlated issues:

query_datadog(resource_type='incidents')

Important Rules

the wrong organization looks identical to a correct one.

series_truncated or series_dropped, narrow the query and re-run before drawing a conclusion.

returns every deployment at once. A 30-day multi-group query is close to the request timeout,

so query one environment at a time.

A comma inside {} is a tag filter. Commas outside {} are separate expressions and are

queried one at a time. Do not send a formula (+, -, *, / between metrics).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.