Filtering on traces
The fields the Traces filter bar accepts, how duration and status filters work, and worked examples for everyday trace filtering.
This page is for anyone who filters spans on the Traces page. It lists the trace fields and task examples you can copy. The language rules are in the filter quick reference.
Fields
The last column gives the column name that SQL uses, where it differs. A field not in the list is an error, and the bar suggests the closest names.
| Field | Type | Takes | SQL column |
|---|---|---|---|
status | word | ok, error (any case) | Same |
protocol | string | value, OR list, * ?, ~ | protocol_type |
source | string | value, OR list, * ?, ~ | Same |
request_type | word | internal, external (any case) | is_external |
role | word | server, client (any case) | kind |
status_code | string | value, OR list, * ?, ~ | return_code |
method | string | value, OR list, * ?, ~ | subtype |
namespace | string | value, OR list, * ?, ~ | Same |
workload | string | value, OR list, * ?, ~ | Same |
container | string | value, OR list, * ?, ~ | container_name |
region | string | value, OR list, * ?, ~ | Same |
app_version | string | value, OR list, * ?, ~ | Same |
resource | string | value, OR list, * ?, ~ | clustered_resource |
server | string | value, OR list, * ?, ~ | Same |
client | string | value, OR list, * ?, ~ | Same |
instance | string | value, OR list, * ?, ~ | pod_name |
server_namespace | string | value, OR list, * ?, ~ | Same |
client_namespace | string | value, OR list, * ?, ~ | Same |
node_name | string | value, OR list, * ?, ~ | Same |
operation_name | string | value, OR list, * ?, ~ | Same |
partner_cluster | string | value, OR list, * ?, ~ | Same |
reason | string | value, OR list, * ?, ~ | issue_reason |
env_type | string | value, OR list, * ?, ~ | Same |
service | string | value, OR list, * ?, ~ | app_service |
app_db | string | value, OR list, * ?, ~ | Same |
trace_id | string | value, OR list, * ?, ~ | Same |
span_id | string | value, OR list, * ?, ~ | Same |
issue_id | string | value, OR list, * ?, ~ | Same |
domain | string | value, OR list, * ?, ~ | cluster |
duration_ms | duration (milliseconds) | number, OR list, comparisons | duration |
Notes on the fields:
serviceis the application service.workload,namespaceanddomain(the cluster) say where it runs.roleisserverfor the receiving side of a call andclientfor the calling side.statusisokorerror.status_codeis the HTTP or RPC code, kept as text, such as200or503.methodis the request method,resourcethe endpoint or operation, andprotocolisHTTP,gRPC,PostgreSQLand so on.
The full list with example values is in Log and trace fields.
Duration, status codes and attributes
duration_ms is the one numeric field. It takes a plain number of milliseconds and the comparisons in the quick reference. The column behind it holds nanoseconds. The filter converts, so never write nanoseconds.
status_code is text, so it refuses >=. Use a wildcard for a class and a list for several codes, as in the examples below. Attributes start with @, as in @http.route:/checkout. See Attributes. On traces, -@key:value also matches spans that lack the key. To require the key, write @key:* -@key:value.
Traces have no message to search, so a word on its own is an error. Write service:checkout, not checkout.
Examples
| Task | Filter | What it matches |
|---|---|---|
| Errors from checkout | service:checkout status:error | Spans of the checkout service that ended in error. |
| Slow payment spans | service:payment duration_ms>250 | payment spans that took more than 250 milliseconds. |
| Server errors | status_code:5* | Spans with a 5xx code. |
| Specific codes | status_code:(500 OR 502 OR 503) | Spans with one of those three codes. |
| Incoming calls only | service:checkout role:server | Spans where checkout received the call. |
| Failed orders | method:POST resource:/api/v1/orders status:error | Failed POST calls to that endpoint. |
| Exclude health checks | service:checkout -resource:/health* | checkout spans except those on paths that start with /health. |
| Slow calls on one route | @http.route:/checkout duration_ms>500 | Spans whose http.route attribute is /checkout and that took over 500 milliseconds. |
| Spans with a route, but not this one | @http.route:* -@http.route:/checkout | Spans that have a http.route attribute with another value. |
| Slow database calls | protocol:PostgreSQL duration_ms>100 | PostgreSQL spans over 100 milliseconds. |
| Several services | service:(checkout OR cart) status:error | Errors from either service. |
| One trace | trace_id:4bf92f3577b34da6a3ce929d0e0e4736 | Every span of that trace. |
See Filtering on each screen for the other screens that take trace filters.
