Example Queries
AI Observability data is stored as traces with gen_ai.* attributes and groundcover enrichment (gc.llm_cost.*). Filter GenAI spans using span_type:gen_ai in any gcQL query.
Run these queries in the Data Explorer, the search bar in AI Observability, or as the basis for dashboard widgets.
Call Volume & Distribution
Total LLM calls by model:
span_type:gen_ai | stats by(gen_ai.request.model) count()Calls by provider:
span_type:gen_ai | stats by(gen_ai.provider.name) count()Operation type breakdown:
span_type:gen_ai | stats by(gen_ai.operation.name) count()Token Usage
Total tokens (input vs output):
span_type:gen_ai | stats sum(gen_ai.usage.input_tokens) as input_tokens, sum(gen_ai.usage.output_tokens) as output_tokensAverage tokens per request by model:
span_type:gen_ai | stats by(gen_ai.request.model) avg(gen_ai.usage.input_tokens) as avg_input, avg(gen_ai.usage.output_tokens) as avg_outputTop services by token consumption:
Cost Analysis
Total cost by model:
Cost by service:
Most expensive individual calls:
Latency & Performance
Average latency by provider:
P99 latency by model:
Latency distribution:
Errors & Issues
Error count by model:
Errors with details:
Agent & Tool Tracking
Calls by agent:
Tool execution frequency:
Cost breakdown by agent and model:
Visualization Best Practices
Call volume trends
Time Series
gen_ai.request.model
Cost breakdown
Pie Chart
gen_ai.provider.name
Top expensive calls
Top List
—
Token usage stats
Stat
-
Model comparison
Table
gen_ai.request.model
Latency percentiles
Time Series
-
Error trends
Time Series (Stacked Bar)
error.type
To build dashboard widgets with these queries, see Creating Dashboards — select Traces mode when adding a chart widget.
Last updated
