aggregate_spans
Aggregate APM spans by any field to compute latency percentiles, error counts, and averages. Get performance statistics without transferring raw span data.
Instructions
Aggregate spans by a field for latency/error statistics (no raw span data transfer).
PERFECT for "what's slow" or "what's erroring" questions without paying the cost of fetching and reading raw spans with search_apm_traces.
Use this when:
"p95 latency by service"
"Error count by endpoint"
"Average duration per operation"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of groups to return (default: 10) | |
| query | Yes | Search query using Datadog APM span search syntax | |
| metric | No | Field to aggregate for non-count aggregations (e.g. "@duration") | |
| to_time | Yes | End time - same accepted formats as from_time | |
| group_by | Yes | Facet to group by (e.g. "service", "resource_name", "@http.status_code") | |
| from_time | Yes | Start time - ISO 8601, relative date math (e.g. "now-1h"), or a millisecond timestamp | |
| aggregation | No | Aggregation function - count, avg, cardinality, median, pc75, pc90, pc95, pc98, pc99, sum, min, max | count |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||