-
4种查询类型
-
=
等于 -
!=
不等于 -
=~
正则匹配 -
!~
正则非匹配
-
-
4种可以自由组合
-
标签的key要明确给出
-
__name__
也是个标签,可以匹配metrics -
promql中查询没数据,大多是标签匹配的问题
1. =
等于
-
查询举例: go_gc_duration_seconds{quantile="0.75"}
2. !=
不等于
-
查询举例: prometheus_http_requests_total{code!="200"} 除了200以外的都有
3.=~
正则匹配
-
查询: prometheus_http_requests_total{handler=~"/api.*"}
4.!~
正则非匹配
-
查询: prometheus_http_requests_total{code!~".*00"}
5.__name__
也是个标签,可以匹配metrics(指标)
-
查询 {name=~"go.",quantile=~".0."} 等价于 go_gc_duration_seconds{quantile=~".0.*"}