Skip to main content
POST
Run custom aggregations over your traces. Same chart engine as Request Analytics — Custom Queries, but each query aggregates at one of two levels:
  • 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 timeSeries or metadata-key breakdowns.
  • Chart shapes beyond bar/line/area are supported: pie, donut, histogram (with histogramField), heatmap (with secondaryGroupByField), treemap/sunburst (with hierarchyFields).

Response shape

Identical to Request Analytics — Custom Queries: each entry in customCharts 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.

Authorizations

X-API-KEY
string
header
required

Body

application/json
customCharts
object[]
required
Required array length: 1 - 10 elements
filter_group
object

Nested filter tree. AND/OR are cross-span; SPAN_AND/SPAN_OR require one and the same span to satisfy every/any branch (span-level fields only).

Response

Custom chart results in the order requested.

success
enum<boolean>
required
Available options:
true
customCharts
CustomAnalyticsResult · object[]
required

Results in the same order as the input customCharts array.