What is the meaning of =~
operator in prometheus metrics?
What is the exact difference between =
and =~
operator?
For example,
process_cpu_seconds_total{instance="test"}
process_cpu_seconds_total{instance=~"test"}
The results are different.
=~
: Select labels that regex-match the provided string.
For example, this selects all
http_requests_total
time series forstaging
,testing
, anddevelopment
environments and HTTP methods other thanGET
.http_requests_total{environment=~"staging|testing|development",method!="GET"}
Taken from the Prometheus.io docs.