What does somestring1_somestring2:metric_name:some_operation mean in prometheus query language

4/22/2021

I am trying to understand default prometheus rules for kubernetes. And then I came across with this expression:

      sum(namespace_cpu:kube_pod_container_resource_requests:sum{})
        /
      sum(kube_node_status_allocatable{resource="cpu"})
        >
      ((count(kube_node_status_allocatable{resource="cpu"}) > 1) - 1) / count(kube_node_status_allocatable{resource="cpu"})

Specifically, i am curious at namespace_cpu:kube_pod_container_resource_requests:sum{}. namespace_cpu does not appear to be an operation or reserved word in promql.

I can't seem to find it either in Prometheus documentation. https://prometheus.io/docs/prometheus/latest/querying/basics/

Any hints?

-- Jerome Ortega
kubernetes
prometheus
prometheus-alertmanager

1 Answer

4/23/2021

Nothing, it's not an operator : is just a legal character in metric names. Some standard rulesets use it for grouping rollup rules together but it's just a naming scheme at most.

-- coderanger
Source: StackOverflow