Search with TraceQL via the API

Search traces with TraceQL over HTTP and list matching trace IDs. limit caps the number of results

curl -sG "$TEMPO_ADDR/api/search" --data-urlencode 'q={ .http.status_code >= 500 }' --data-urlencode 'limit=20' | jq '.traces[].traceID'

tool
tempo3 commands
tags
tempotraceqlapiobservability

More tempo commands

  • curl -s "$TEMPO_ADDR/api/traces/<id>" | jq '.batches[].scopeSpans[].spans[] | {name, durationNs: (.endTimeUnixNano|tonumber)-(.startTimeUnixNano|tonumber)}'

    Get a trace by ID and calculate the duration of each span. Note: times are in Unix nanoseconds

  • { .service.name = "api" && status = error && duration > 2s }

    Find error spans of a service that take longer than 2s. It combines an attribute, status and duration

all 3 tempo commands