Skip to Content
KubeSense

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.

FieldTypeTakesSQL column
statuswordok, error (any case)Same
protocolstringvalue, OR list, * ?, ~protocol_type
sourcestringvalue, OR list, * ?, ~Same
request_typewordinternal, external (any case)is_external
rolewordserver, client (any case)kind
status_codestringvalue, OR list, * ?, ~return_code
methodstringvalue, OR list, * ?, ~subtype
namespacestringvalue, OR list, * ?, ~Same
workloadstringvalue, OR list, * ?, ~Same
containerstringvalue, OR list, * ?, ~container_name
regionstringvalue, OR list, * ?, ~Same
app_versionstringvalue, OR list, * ?, ~Same
resourcestringvalue, OR list, * ?, ~clustered_resource
serverstringvalue, OR list, * ?, ~Same
clientstringvalue, OR list, * ?, ~Same
instancestringvalue, OR list, * ?, ~pod_name
server_namespacestringvalue, OR list, * ?, ~Same
client_namespacestringvalue, OR list, * ?, ~Same
node_namestringvalue, OR list, * ?, ~Same
operation_namestringvalue, OR list, * ?, ~Same
partner_clusterstringvalue, OR list, * ?, ~Same
reasonstringvalue, OR list, * ?, ~issue_reason
env_typestringvalue, OR list, * ?, ~Same
servicestringvalue, OR list, * ?, ~app_service
app_dbstringvalue, OR list, * ?, ~Same
trace_idstringvalue, OR list, * ?, ~Same
span_idstringvalue, OR list, * ?, ~Same
issue_idstringvalue, OR list, * ?, ~Same
domainstringvalue, OR list, * ?, ~cluster
duration_msduration (milliseconds)number, OR list, comparisonsduration

Notes on the fields:

  • service is the application service. workload, namespace and domain (the cluster) say where it runs.
  • role is server for the receiving side of a call and client for the calling side.
  • status is ok or error. status_code is the HTTP or RPC code, kept as text, such as 200 or 503.
  • method is the request method, resource the endpoint or operation, and protocol is HTTP, gRPC, PostgreSQL and 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

Traces filtered with protocol:gRPC -workload:kubesense*: gRPC spans from every workload except those whose name starts with kubesense.

TaskFilterWhat it matches
Errors from checkoutservice:checkout status:errorSpans of the checkout service that ended in error.
Slow payment spansservice:payment duration_ms>250payment spans that took more than 250 milliseconds.
Server errorsstatus_code:5*Spans with a 5xx code.
Specific codesstatus_code:(500 OR 502 OR 503)Spans with one of those three codes.
Incoming calls onlyservice:checkout role:serverSpans where checkout received the call.
Failed ordersmethod:POST resource:/api/v1/orders status:errorFailed POST calls to that endpoint.
Exclude health checksservice:checkout -resource:/health*checkout spans except those on paths that start with /health.
Slow calls on one route@http.route:/checkout duration_ms>500Spans whose http.route attribute is /checkout and that took over 500 milliseconds.
Spans with a route, but not this one@http.route:* -@http.route:/checkoutSpans that have a http.route attribute with another value.
Slow database callsprotocol:PostgreSQL duration_ms>100PostgreSQL spans over 100 milliseconds.
Several servicesservice:(checkout OR cart) status:errorErrors from either service.
One tracetrace_id:4bf92f3577b34da6a3ce929d0e0e4736Every span of that trace.

See Filtering on each screen for the other screens that take trace filters.

On this page