How does Grafana Tempo store traces, and what is TraceQL?
IntermediateConceptTracing & OpenTelemetry
Answer
Tempo writes traces into blocks in object storage using an Apache Parquet columnar format. There is no expensive per-tag index; the distributor hashes by trace ID, ingesters build blocks, the compactor merges them, and queriers scan columns in parallel. Lookup by trace ID is cheap; search scans only the columns needed.
TraceQL queries spans by their properties and structure:
{ resource.service.name = "checkout" && span.http.response.status_code >= 500 }
{ duration > 2s && span.db.system = "postgresql" }
{ resource.service.name = "frontend" } >> { resource.service.name = "payments" && status = error }
{ resource.service.name = "api" } | rate() by (span.http.route)
>> means "descendant of". The last line is a TraceQL metrics query, which computes rates from spans on the fly.
More on Tracing & OpenTelemetry
What is distributed tracing, and what are a trace, a span and a span context?BeginnerWhat fields does an OpenTelemetry span carry?BeginnerWhat are span kinds and why do they matter?IntermediateWhat does the W3C `traceparent` header look like?IntermediateWhat is baggage, and how is it different from span attributes?IntermediateWhat is OpenTelemetry and what are its main parts?Beginner