Traceway
Platform

Filtering & Search

The query DSL, span filter parameters, and search capabilities.

Traceway provides powerful filtering for both the dashboard and the API. You can filter spans by model, provider, status, time range, cost, token count, and more.

The search bar on the Traces and Spans pages supports a query DSL with key:value syntax. You can type filters directly:

model:gpt-4o status:completed cost:>0.01

Multiple filters are combined with AND logic — a span must match all filters to appear in the results.

Supported query syntax

SyntaxExampleDescription
key:valuemodel:gpt-4oExact match
key:>valuecost:>0.01Greater than
key:<valueduration:<500Less than
key:"quoted value"name:"my span"Exact match with spaces
text searchsummarizeFull-text search across span names, inputs, and outputs

Available filter keys

KeyTypeDescription
modelstringModel name (gpt-4o, claude-3-haiku, etc.)
providerstringProvider name (openai, anthropic, etc.)
statusstringrunning, completed, or failed
kindstringSpan kind (llm_call, custom, fs_read, fs_write)
namestringSubstring match on span name
tracestringFilter to a specific trace ID
costnumberEstimated cost in USD (supports >, <, >=, <=)
tokensnumberTotal tokens (supports >, <, >=, <=)
durationnumberDuration in milliseconds (supports >, <, >=, <=)
sincedateSpans started after this time
untildateSpans started before this time

Date syntax

The since and until keys accept:

  • ISO 8601since:2024-06-15T12:00:00Z
  • Relative timesince:1h (last hour), since:24h (last day), since:7d (last week)

Examples

Find all expensive gpt-4o calls in the last 24 hours:

model:gpt-4o cost:>0.05 since:24h

Find failed spans from Anthropic:

provider:anthropic status:failed

Find slow LLM calls (over 5 seconds):

kind:llm_call duration:>5000

Search for spans mentioning "error" in their input or output:

error

API filter parameters

The GET /api/spans endpoint accepts all filters as query parameters:

curl "https://api.traceway.ai/api/spans?\
model=gpt-4o&\
status=completed&\
cost_min=0.01&\
since=2024-06-15T00:00:00Z&\
sort_by=cost&\
sort_order=desc&\
limit=20" \
  -H "Authorization: Bearer tw_sk_..."

Full parameter reference

ParamTypeDescription
trace_idstringFilter to a specific trace
kindstringFilter by kind type (llm_call, custom, etc.)
modelstringFilter by model name
providerstringFilter by provider
statusstringrunning, completed, or failed
sinceISO 8601Spans started after this time
untilISO 8601Spans started before this time
name_containsstringSubstring match on span name
text_containsstringFull-text search across input and output
input_containsstringSearch within input only
output_containsstringSearch within output only
duration_minnumberMinimum duration in ms
duration_maxnumberMaximum duration in ms
tokens_minnumberMinimum total tokens (input + output)
cost_minnumberMinimum cost in USD
sort_bystringSort field: started_at, duration, tokens, cost, name
sort_orderstringasc or desc (default: desc)
limitnumberMax results (default 50, max 1000)
cursorstringPagination cursor from previous response

Pagination

The API uses cursor-based pagination. Each response includes a cursor field (if there are more results). Pass it as ?cursor=... in the next request to get the next page.

# First page
curl "https://api.traceway.ai/api/spans?limit=50" -H "..."

# Response includes: { "spans": [...], "count": 50, "cursor": "abc123" }

# Next page
curl "https://api.traceway.ai/api/spans?limit=50&cursor=abc123" -H "..."

Trace filters

The GET /api/traces endpoint supports simpler filtering:

ParamTypeDescription
limitnumberMax results (default 50)
cursorstringPagination cursor

Trace-level filtering is less granular than span filtering. To find traces that contain specific spans, filter spans first and then group by trace_id.

Analytics

The Analytics page (/analytics) provides aggregate views of your data:

  • Cost over time — Line chart of total cost per day/hour
  • Latency distribution — Histogram of span durations
  • Model usage — Breakdown of calls by model
  • Token usage — Total tokens consumed over time
  • Error rate — Percentage of failed spans over time

Analytics are computed from the underlying span data using the same filter parameters. You can narrow the analytics view by time range, model, or provider.

# Analytics summary
curl "https://api.traceway.ai/api/analytics/summary" \
  -H "Authorization: Bearer tw_sk_..."

# Detailed analytics with filters
curl -X POST "https://api.traceway.ai/api/analytics" \
  -H "Authorization: Bearer tw_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"since": "2024-06-01T00:00:00Z", "group_by": "day"}'

On this page