Applies to:
- Plan -
- Deployment -
Summary
Goal: Filter project logs to find failed LLM spans and the traces that contain them. Features: Logs, SQL,ANY_SPAN(), FILTER_SPANS(), span_attributes.type, error, built-in LLM span errors view.
Filtering options
Use the built-in view
In the Logs view, open the view selector and select LLM span errors. This built-in view shows span-level results for LLM spans whereerror IS NOT NULL.
Query failed LLM spans directly
To return only the failed LLM spans, useshape => 'spans':
Use a single ANY_SPAN() predicate for traces
Combine both conditions inside oneANY_SPAN() call. This ensures the error and the LLM type match on the same span, not on different spans within the same trace.
ANY_SPAN() clauses when you need failed LLM calls. Separate clauses match traces where any span has an error and any span is an LLM span, even if they are different spans:
Filter spans within trace-shaped results
To return trace-shaped results but include only the failed LLM spans within each trace, useFILTER_SPANS() in the WHERE clause:
Use summary metrics for counts
Usemetrics.llm_errors when you need trace-level reporting or counts. Use the span-level queries above when you need to inspect the failed LLM calls themselves.