1
defined(attribute_name)
defined
returns true if a specified attribute is set on a span or metric.
Supported Pipelines: spans, metric
Applicable Stages: filter, spans_sample, trace_filter
defined is not available for alerts.
Name | Type | Required/Optional | Description |
---|---|---|---|
attribute_name | string | Required | Name of the attribute on span or metric to check if value is set |
The following query will show the counts of all spans grouped by k8s.pod.name including where the group is undefined.
1
2
3
spans count
| delta
| group_by [k8s.pod.name], sum
We can remove the undefined group by using defined in the filter stage, like so:
1
2
3
4
spans count
| delta
| filter defined(k8s.pod.name)
| group_by [k8s.pod.name], sum
Sometimes you might know only the name of the attribute but want to see where it’s used. The query will show matching time series, grouped by service and operation, that have customer_id set:
1
2
3
4
spans count
| delta
| filter defined(customer_id)
| group_by [service, operation], sum
Updated Jun 6, 2023