Comparison operators :: Kloudfuse Docs
Comparison operators
Equal (=)
Selects time series whose label value is exactly equal to the given string. Matchers appear in curly braces after the metric name; every additional matcher narrows the series set the query reads, which is the single biggest lever on query cost.
Syntax
<metric>{<label>=\"<value>\"}
Parameters
| Parameter | Required | Description |
|---|---|---|
<label> |
Required | A label on the metric, such as kube_namespace, app_kubernetes_io_name, or availability_zone. |
<value> |
Required | The exact string to match; case-sensitive. |
Example
Select the goroutine-count gauge for the Kloudfuse query-service only, then sum it into a single series.
sum(go_goroutines{app_kubernetes_io_name=\"query-service\"})
| Value |
|---|
| 64,531 |
Not equal (!=)
Selects time series whose label value is not equal to the given string. Use it to exclude one known series from an otherwise broad selection.
Syntax
<metric>{<label>!=\"<value>\"}
Parameters
| Parameter | Required | Description |
|---|---|---|
<label> |
Required | The label to test. |
<value> |
Required | The string value to exclude. |
Example
Count goroutines across Kloudfuse services excluding the query-service, grouped by service name.
sum by (app_kubernetes_io_name) (
go_goroutines{app_kubernetes_io_instance=\"kfuse\", app_kubernetes_io_name!=\"query-service\"}
)
| app_kubernetes_io_name | Value |
|---|---|
| rum-query-service | 1,302 |
| zapper | 2,567 |
| config-mgmt-service | 725 |
| ingester | 98,322 |
| envoy-gateway | 1,927 |
Regex not match (!~)
Selects time series whose label value does not match an RE2 regular expression. One !~ matcher can exclude several values at once via alternation.
Syntax
<metric>{<label>!~\"<regex>\"}
Parameters
| Parameter | Required | Description |
|---|---|---|
<label> |
Required | The label to test. |
<regex> |
Required | An anchored RE2 expression; fully matching series are excluded. |
Example
Count goroutines for Kloudfuse services that are not one of the query services.
sum by (app_kubernetes_io_name) (
go_goroutines{app_kubernetes_io_instance=\"kfuse\", app_kubernetes_io_name!~\".*query-service\"}
)
| app_kubernetes_io_name | Value |
|---|---|
| envoy-gateway | 1,926 |
| zapper | 2,570 |
| kfuse-grafana | 60,471 |
| trace-transformer | 97,843 |
| hydration-service | 558 |
Regex match (=~)
Selects time series whose label value matches an RE2 regular expression. The expression is fully anchored — it must match the entire label value. Use it to select a family of related series in one matcher.
Syntax
<metric>{<label>=~\"<regex>\"}
Parameters
| Parameter | Required | Description |
|---|---|---|
<label> |
Required | The label to test. |
<regex> |
Required | An RE2 regular expression, anchored at both ends of the value. |
Example
Select goroutine gauges for every Kloudfuse query service — query-service, events-query-service, and rum-query-service all match the expression.
sum by (app_kubernetes_io_name) (
go_goroutines{app_kubernetes_io_name=~\".*query-service\"}
)
| app_kubernetes_io_name | Value |
|---|---|
| rum-query-service | 1,312 |
| logs-query-service | 19,541 |
| query-service | 64,555 |
| trace-query-service | 3,052 |
| events-query-service | 3,017 |