UQL: contains

Summary

1
contains(attribute_name, substring)

contains returns true if the specified attribute has a string value that includes the provided case-insensitive substring. It will always return false for non-string attributes.


Supported Pipelines: spans, metric, logs

Applicable Stages: filter, spans_sample, trace_filter

contains cannot be used on tokenized attributes in log messages.

Arguments

Name Type Required/Optional Description
attribute_name string Required Name of the attribute in whose value to search
substring string Required String to search for in the attribute value

Examples

Filter query results

The following query will show the counts of all spans grouped by service.

1
2
3
spans count
| delta
| group_by ["service"], sum

You can use contains to filter results to those with a subset of attribute values, e.g. a specific API version by searching for the substring “/api/v3”.

1
2
3
4
spans count
| delta
| filter contains(operation, "/api/v3")
| group_by ["service"], sum

See also

UQL reference

UQL cheat sheet

Updated Sep 21, 2023