Tracking
Trace Analytics — Custom Queries
POST
Run custom aggregations over your traces. Same chart engine as Request Analytics — Custom Queries, but each query aggregates at one of two levels:
Metric fields (
Group-by fields (
- Trace-level (
trace_*fields) — measure whole traces: durations, cost, tokens, span counts. - Span-level (
span_*fields) — measure the individual spans inside matching traces: e.g. the slowest tools, tool call counts, span duration distributions.
filter_group selects which traces participate (by trace_name, a trace_start range, span conditions, etc.); span-level charts then aggregate across every span of those traces.
Metrics
count, sum, avg, min, max, percentile (with percentile 0–100).
Metric fields (metricField)
Duration values are returned in seconds (converted from milliseconds internally).
Group-by fields (groupByField)
Constraints
- A chart must stay at one level: span-level fields cannot be mixed with trace-level fields in the same chart.
- Span-level charts do not support
timeSeriesor metadata-key breakdowns. - Chart shapes beyond bar/line/area are supported:
pie,donut,histogram(withhistogramField),heatmap(withsecondaryGroupByField),treemap/sunburst(withhierarchyFields).
Response shape
Identical to Request Analytics — Custom Queries: each entry incustomCharts has id, series descriptors ({ key, label, unit }), and data rows. Count series are labeled “Traces” for trace-level charts and “Spans” for span-level charts.
Related
Authorizations
Body
application/json

