Skip to content

Reference

Trace compare

The trace compare endpoints of the HTTP API.

POST /datasources/{uid}/trace-compare

Rank the attribute values that set a set of traces apart from a baseline.

Reads every span of the selected traces and of the baseline traces from a Tempo or ClickHouse datasource and counts, once per trace, each attribute value any of its spans carries: name (the span name), kind (Server, Client, Producer, Consumer, Internal or Unspecified), status (Ok, Error or Unset), resource.<key> and span.<key>. Only scalar values count, as their text; arrays and maps are skipped, and a value is cut to 256 bytes. Each trace contributes its earliest 2,000 spans. differences lists the pairs whose share of selected traces and share of baseline traces differ by at least 0.1, ranked by that gap, then attribute, then value, the first limit of them; truncated says more passed the threshold. A pair carried by every trace of both sets never appears. selected.read and baseline.read count the traces whose spans were read; a trace not found in the range, or not reached before the deadline, is left out and is not an error, and partial is true when any read count is below its requested count. attributes is the number of distinct attribute names seen across both sets. Trace ids are 16 or 32 hex characters in either case, lowercased and de-duplicated by the server; an id in both lists is refused. from and to are the range the traces were found in and take relative expressions such as now-1h, epoch milliseconds or RFC 3339 times. The call runs with the agent tools’ 15 second timeout, is never cached, and counts against the caller’s 8 in-flight query requests. Viewers and above may call it, service-account keys included.

Parameters

Name In Type Description
uid (required) path string

Request body

application/json, required.

Field Type Description
selected (required) array of string The trace ids to explain. At most 50 items.
baseline (required) array of string The trace ids to compare against, such as the other traces the search returned. At most 150 items.
from (required) string
to (required) string
timezone string The browser’s IANA time zone, used to resolve relative times such as now/d.
limit integer The most differences wanted. Between 1 and 100. Default 20.

Responses

Status Description Body
200 The ranked differences and how many traces of each set were read. TraceCompare
400 The request is malformed or fails validation: a list is empty or over its cap, an id is not 16 or 32 hex characters, an id is in both lists, limit is out of range, from or to is not a valid time, or the datasource is not Tempo or ClickHouse (invalid_request). PanelDataError
401 Authentication is missing or invalid. Error
404 The datasource does not exist (not_found). PanelDataError
413 The request body exceeds the size limit. Error
429 The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. Error
500 The server failed to handle the request, including a datasource call that failed without a classified cause. PanelDataError
502 The datasource is unavailable. PanelDataError
504 The datasource did not answer within the 15 second query timeout before any trace was read, or the request did not finish within 20 seconds. PanelDataError

Generated from api/openapi.yaml at c770e5e0. Report a problem.

Reading this as an agent? Every page is in /llms.txt and /llms-full.txt as plain text.

/observeOpen source under Apache-2.0.Grafana is a trademark of Grafana Labs. Elasticsearch and Kibana are trademarks of Elasticsearch B.V. OpenSearch is a trademark of LF Projects, LLC. SlashObserve is not affiliated with or endorsed by any of them.

Search pages and headings.