Skip to main content
See HTTP URLs and authentication and the API reference for complete request and response formats. 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. Use the query examples below in the SDK’s oql field or in the request body. API time ranges use RFC 3339 timestamps.

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. Status filters use the success and error spelling; Trace status values maps them to the Telemetry API and Reporting values.

Rules per signal

Examples

Failing traces in the last day
OQL
Traces whose name matches a deployment, by the trace name
OQL
Traces in either of two states
OQL
Error logs with the newest first
OQL
Expensive traces, combining two filters
OQL
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.

Errors

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

Limitations