Back to all updates

Query your traces with SQL

Run read-only SQL over your project's spans and traces from the CLI or the API.

Some questions are easier to answer with a query than by scrolling a trace list: which model is slowest this week, what each day cost, where errors cluster. You can now ask them with read-only SQL over your project's spans and traces.

From the TraceRoot CLI, run traceroot sql schema to see the tables and columns, then write a query:

p95.sql
SELECT model_name, round(quantile(0.95)(duration_ms)) AS p95_ms
FROM spans
WHERE model_name IS NOT NULL
  AND span_start_time >= now() - INTERVAL 7 DAY
GROUP BY model_name
ORDER BY p95_ms DESC

Run it with traceroot sql --file p95.sql, or pass the query inline. Results print as a table. Add --csv --output latency.csv to save them, or send the same query to POST /api/v1/public/sql with your project API key.

Queries are read-only and scoped to the project behind your key. See Read-only SQL for the schema, supported functions and limits.

Trust
SecurityTrust Center PrivacyTermsCookie settings

Essential storage keeps the site working. You can choose whether to allow product analytics.