Query Spans and Traces from the Terminal
A slow API call rarely tells the whole story. To understand why a request took 3 seconds, you need to see every hop it made: the database query, the downstream RPC, the cache miss that should not have happened. Now you can explore all of that without leaving the terminal. The Dash0 CLI introduces two commands for distributed tracing: spans query to search across spans, and traces get to reconstruct a full trace end-to-end.
Search spans like you search logs
The spans query command brings to spans the same filtering, output formats, and custom columns you already know from logs query:
dash0 -X spans query \
--from now-1h \
--filter "service.name is checkout-service" \
--filter "otel.span.status.code is ERROR"The default table shows timestamp, duration, span name, status, service name, parent ID, trace ID, and span links. Swap in any OTLP attribute as a column to surface the dimensions that matter to your investigation:
dash0 -X spans query \
--column timestamp \
--column duration \
--column "span name" \
--column http.request.methodJSON and CSV outputs are available for scripting and downstream processing.
Reconstruct full traces
Once you have a trace ID — from a span query, a log record, or an alerting rule — traces get fetches every span in the trace and displays them as an indented tree:
dash0 -X traces get 0af7651916cd43dd8448eb211c80319cFollow span links across trace boundaries
Modern architectures do not always fit into a single trace. A message queue consumer might link back to the producer's trace; a batch job might reference the request that triggered it.
The --follow-span-links flag tells the CLI to chase those connections automatically:
dash0 -X traces get 0af7651916cd43dd8448eb211c80319c --follow-span-linksThe CLI walks span links recursively (up to 20 traces), displaying each linked trace under a clear header. You can set a custom lookback period for the linked traces, like --follow-span-links 2h, to control how far back the search reaches.
Get started
export DASH0_API_URL=... # Get the value at https://app.dash0.com/goto/settings/endpoints?endpoint_type=api_http
export DASH0_AUTH_TOKEN=... # Get the value at https://app.dash0.com/goto/settings/auth-tokens
dash0 -X spans query --from now-15mSpan and trace commands are experimental: enable them with -X and tell us how they fit into your workflow.