Deprecated

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.

Errors

  • 504 — the query ran past the database statement timeout. Retry with a shorter time range. Other failures still return an empty result.
post/tracing/analytics/query

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /api/tracing/analytics/query
  • Auth
    API key in header Authorization

Query parameters

focus'trace' | 'span'
format'agenta' | 'opentelemetry'
string
OR
integer
string
OR
integer
intervalinteger nullable
ratenumber nullable
filterunknown
specsunknown

Response

Successful Response

countinteger

Number of time buckets returned.

Changes

    • info

      added the non-success response with the status

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status