Comparison operators :: Kloudfuse Docs
Comparison operators
Equal (=)
Selects spans where an attribute or intrinsic equals the given value. Attribute names take a leading dot (.service_name); scoped forms (resource., span.) restrict where the attribute is looked up. String values are quoted; numbers, durations, and enums like span kind are not.
Syntax
{ .<attribute> = "<value>" }
Parameters
| Parameter | Required | Description |
|---|---|---|
.<attribute> |
Required | The span or resource attribute, or an intrinsic such as name, duration, kind, status. |
<value> |
Required | Quoted string, number, duration (100ms), or enum value. |
Example
Find traces containing spans from the demo-python-service.
{.service_name = "demo-python-service"}
| Root service | Root span | Duration |
|---|---|---|
| demo-python-service | database | 51 ms |
| demo-python-service | database | 50 ms |
| demo-python-service | database | 50 ms |
Not equal (!=)
Selects spans where an attribute or intrinsic is not equal to the given value. Combine with a positive condition to keep the search scoped.
Syntax
{ .<attribute> != "<value>" }
Parameters
| Parameter | Required | Description |
|---|---|---|
.<attribute> |
Required | The attribute or intrinsic to test. |
<value> |
Required | The value to exclude. |
Example
Find demo traces from every service except the Python one.
{.service_name =~ "demo.*" && .service_name != "demo-python-service"}
| Root service | Root span | Duration |
|---|---|---|
| demo-java-service | database | 50 ms |
| demo-java-service | database | 50 ms |
| demo-java-service | database | 50 ms |
Regex not match (!~)
Selects spans where an attribute or intrinsic does not match an RE2 regular expression — exclude several values with one condition.
Syntax
{ .<attribute> !~ "<regex>" }
Parameters
| Parameter | Required | Description |
|---|---|---|
.<attribute> |
Required | The attribute or intrinsic to test. |
<regex> |
Required | Matching spans are excluded. |
Example
Find demo spans whose operation name does not start with data — the user spans match, the database spans do not.
{.service_name =~ "demo.*" && name !~ "data.*"}
| Root service | Root span | Duration |
|---|---|---|
| demo-go-service | database | 50 ms |
| demo-go-service | database | 50 ms |
| demo-go-service | database | 50 ms |
Ordering comparisons (>, >=, <, ⇐)
Compares numeric attributes and duration intrinsics with >, >=, <, and ⇐. Durations take Go-style units (100ms, 2s); the most common use is latency filtering on the duration intrinsic.
Syntax
{ duration > <duration> } (also >=, <, <=)
Parameters
| Parameter | Required | Description |
|---|---|---|
<duration> |
Required | A duration literal such as 40ms or 1s, or a number for numeric attributes. |
Example
Find demo spans that took at least 40 milliseconds — the 50 ms root spans match.
{.service_name =~ "demo.*" && duration >= 40ms}
| Root service | Root span | Duration |
|---|---|---|
| demo-java-service | database | 50 ms |
| demo-java-service | database | 50 ms |
| demo-python-service | database | 50 ms |
Regex match (=~)
Selects spans where an attribute or intrinsic matches an RE2 regular expression — one condition for a whole family of values.
Syntax
{ .<attribute> =~ "<regex>" }
Parameters
| Parameter | Required | Description |
|---|---|---|
.<attribute> |
Required | The attribute or intrinsic to test. |
<regex> |
Required | An RE2 regular expression. |
Example
Match all three demo services with a single expression.
{.service_name =~ "demo-.*-service"}
| Root service | Root span | Duration |
|---|---|---|
| demo-java-service | database | 50 ms |
| demo-python-service | database | 50 ms |
| demo-java-service | database | 50 ms |