Skip to main content
Version: v2.0

Fetch Analytics

POST 

/tracing/analytics/query

deprecated

This endpoint has been deprecated and may be replaced or removed in future versions of the API.

Aggregate span metrics into time buckets.

Runs filtering and windowing identical to POST /tracing/spans/query, then bucketizes the matched spans by time and computes one or more metric summaries per bucket. Use this to build charts of latency, cost, token usage, or custom numeric and categorical attributes.

Request body​

  • filtering — same shape as the query endpoint, scoped to the spans that contribute to the analytics.
  • windowing — oldest/newest for the time range (matched against each span's start_time), interval for bucket width (in minutes), and an optional rate to sample a share of the traces. Figures describe the sample only. When interval is set, buckets with no spans are returned empty.
  • formatting.focus — trace (default) summarizes root spans only, which carry the cumulative metrics of their trace. span summarizes every span.
  • specs — a list of MetricSpec entries describing which attributes to summarize and how. Each spec declares a type (numeric/continuous, numeric/discrete, binary, categorical/single, categorical/multiple, string, json, or * for auto) and a dotted path into the span (for example attributes.ag.metrics.costs.cumulative.total).

Response​

Buckets are returned in chronological order. Each bucket carries a metrics dict keyed by spec path. See Tracing — the ag.* namespace for the cumulative/incremental metric layout on each span.

Request​

Responses​

Successful Response