| name | datadog-pup |
| description | Use when interacting with Datadog resources using the `pup` CLI, especially for APM traces, metrics, monitors, notebooks, and synthetic tests. |
pup CLI — Datadog Resource Management
Overview
pup is a Datadog API CLI. Use it to query APM traces, metrics, monitors, logs, synthetics, SLOs, dashboards, and more.
Global Flags
-o json|table|yaml — output format (default: json)
-y — auto-approve destructive ops
--agent — enable agent mode (structured output for AI)
--org <name> — named org session for multi-org support (see pup auth login --org)
Prefer --agent flag when parsing output programmatically — it normalizes output for machine consumption.
Multi-Org / Auth
If credentials fail or results look wrong (e.g. only phone-assistant services visible), check which org is active:
pup auth status
pup auth login --org monolith
pup test
Use --org monolith on any command to scope it to the right org.
APM — Traces & Services
⚠️ APM durations are in NANOSECONDS: 1s = 1,000,000,000 ns, 5ms = 5,000,000 ns
Traces (spans)
pup traces search --query 'service:monolith resource_name:"MyController#action"' --from 1h
pup traces search --query 'service:monolith status:error' --from 30m --limit 20
pup traces aggregate --query 'service:monolith' --compute count --group-by resource_name --from 1h
pup traces aggregate \
--query 'service:monolith env:production' \
--compute 'percentile(@duration, 99)' \
--group-by resource_name \
--from 1h
pup traces aggregate \
--query 'resource_name:"AnonymousFunnel::AnonymousResource::AttachMedicalDataController#create"' \
--compute 'avg(@duration)' \
--from 1h
APM Services
pup apm services list --env production --from 1h
pup apm services stats --env production --from 1h
pup apm services operations --env production --service monolith
pup apm services resources --env production --service monolith --operation rack.request
pup apm dependencies list --env production
Metrics
pup metrics query --query 'avg:trace.rack.request.duration{service:monolith}' --from 1h
pup metrics list --filter 'trace.*' --tag-filter 'service:monolith'
pup metrics search --query 'trace.rack.request'
Team Context
You are on the p3c team. Always filter by team before listing resources — Datadog has too many shared resources to browse unfiltered.
Quick Reference
Monitors
pup monitors list --tags "team:p3c"
pup monitors list --tags "team:p3c" --name "payment"
pup monitors search --query "tag:team:p3c status:alert"
pup monitors get <MONITOR_ID>
pup monitors create --file monitor.json
pup monitors update <MONITOR_ID> --file monitor.json
pup monitors delete <MONITOR_ID>
Logs
pup logs list --query "team:p3c service:api status:error"
pup logs search --query "team:p3c @http.status:500"
pup logs aggregate
Synthetics
pup synthetics tests list
pup synthetics tests search --text "p3c"
pup synthetics tests get <TEST_ID>
Notebooks
pup notebooks list
pup notebooks get <NOTEBOOK_ID>
pup notebooks create --file notebook.json
pup notebooks update <NOTEBOOK_ID> --file notebook.json
pup notebooks delete <NOTEBOOK_ID>
SLOs
pup slos list
pup slos get <SLO_ID>
pup slos status <SLO_ID>
pup slos create --file slo.json
pup slos update <SLO_ID> --file slo.json
Other Useful Commands
pup dashboards list
pup incidents list
pup events list
pup downtime list
pup users list
pup test
Workflows
Find then act
Always list or search before mutating — capture the ID first:
pup monitors list --name "checkout latency" -o table
pup monitors get 123456
pup monitors update 123456 --file updated.json
Create/update from file
create and update take a --file with a JSON payload. Get the schema from an existing resource:
pup monitors get 123456 -o json > monitor.json
pup monitors create --file monitor.json
Destructive operations
Use -y to skip confirmation prompts in automation:
pup monitors delete 123456 -y
Common Mistakes
- Listing without a team filter → always scope with
--tags "team:p3c" or --query "tag:team:p3c" first
- Parsing default output in scripts → use
--agent for cleaner structured output
- Running
delete without checking first → always get before delete
- Creating from scratch → export existing with
get -o json, edit, then create
- Wrong
--tags syntax → must be comma-separated: team:p3c,env:prod
Discovery
pup -h
pup <command> -h
pup <command> <sub> -h
pup agent guide
pup agent schema