Skip to main content
Use Cases
  • Running the same selection from the API, the CLI, and AI Studio.
  • Combining several conditions in one expression instead of building a filters array.
  • Handing a saved investigation to a teammate as a single line of text.

Overview

OQL is a pipeline language for selecting Traces and Logs. A query names the signal, then adds stages separated by |:
fetch comes first and is required. filter may repeat, and every filter is combined with and. A repeated sort or limit stage takes the last value. OQL compiles onto the same planner and field registry as the structured filters array, so a field or an operator that works there works in OQL too. There is no aggregation stage: calculated rows and time series come from the Telemetry API.

Quick start

Run a trace query over a time window. The API takes RFC 3339 timestamps only.
Rows arrive under search.data. The CLI examples below need the Orq CLI installed and authenticated. It accepts relative windows such as 24h or 7d and bare dates, and normalizes them to RFC 3339 before sending, so it needs no timestamps of its own.

Stages

Filter expressions

Two forms parse to the same filter. The symbol form covers equality and ordering: The word form covers the operators that need their own syntax: Lists take parentheses or square brackets and are comma separated. Values may be quoted with " or ', which lets a value contain spaces; a quote inside a value needs the other quote character. Which operators a field accepts depends on its type, not on the parser. A valid expression on the wrong field type is still rejected:
The type-to-operator table is in Filter grammar; the accepted fields and their operators come from GET /v3/traces/fields for traces and GET /v3/logs/fields for logs.

Rules per signal

Examples

Failing traces in the last day
Traces whose name matches a deployment, by the trace name
Traces in either of two states
Error logs with the newest first
Expensive traces, combining two filters
Error logs from the SDK, with the client from the Quick start
OQL written in AI Studio reaches the same endpoint, so the rules above still apply. The query bar in Traces and Logs switches between a builder and OQL, and the Insights report form accepts the same dialect for filter stages only: sort and limit are rejected there. Field suggestions come from the workspace field registry.
Trace query bar with the Builder and OQL tabs, OQL selected, and the editor holding a fetch traces query that filters on two status values and limits the result to 100 rows.

The Traces query bar in OQL mode, with a query that selects traces in either the error or success state.

Errors

A malformed query is rejected before the planner runs, so a bad request never returns partial rows.

Limitations