label_join label_replace() 支持对某个label的值进行正则匹配,截取出某些值,生成新的label。 label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string) 原始指标: node_disk_info{device="sr0", foo="178.104.163.122:9100", instance="178.104.163.122:9100",...
label_replace的具体参数如下: label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string) 该函数会依次对v中的每一条时间序列进行处理,通过regex匹配src_label的值,并将匹配部分relacement写入到dst_label标签中,如下所示: label_replace(up, "host", "$1", "i...
label_replace(up,"host","$1","instance","(.*):.*") 函数处理后,时间序列将包含一个host标签,host标签的值为Exporter实例的IP地址: up{host="localhost",instance="localhost:8080",job="cadvisor"}1up{host="localhost",instance="localhost:9090",job="prometheus"}1up{host="localhost",instance="loca...
乘法运算符左右两侧的表达式中通过 host_ip 标签来匹配,两边的 host_ip 相等的才会进行运算。 总表达式:label_replace(up{job="apiserver"}, "host_ip", "$1", "instance", "(.):.") * on (host_ip) group_left(node_name) up{job="node-exporter", instance=~"[0-9.]*:9100"} image.png 分...
label_replace 的具体参数如下: label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string) 该函数会依次对 v 中的每一条时间序列进行处理,通过regex匹配 src_label 的值,并将匹配部分relacement写入到 dst_label 标签中。如下所示:...
label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string) 该函数会依次对 v 中的每一条时间序列进行处理,通过 regex 匹配 src_label 的值,并将匹配部分 relacement 写入到 dst_label 标签中。如下所示: ...
label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string) 1. 该函数会依次对 v 中的每一条时间序列进行处理,通过 regex 匹配 src_label 的值,并将匹配部分 relacement 写入到 dst_label 标签中。如下所示: ...
label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string) 1. 该函数会依次对 v 中的每一条时间序列进行处理,通过regex匹配 src_label 的值,并将匹配部分relacement写入到 dst_label 标签中。如下所示: ...
label_replace和label_join是PromQL的预置函数,支持将label的value进行截取和拼接,生成新的label。值得注意的是,它们不改变源label的name及value,仅生成...
4.2 label_replace 4.3 聚合查询 4.4 指标向量匹配 4.4.1 一对一匹配 4.4.2 多对一和一对多PromQL学习 # 一、概述 PromQL 是Prometheus 监控系统内置的一种查询语言,PromQL 允许我们以灵活的方式选择、聚合等其他方式转换和计算时间序列数据,该语言仅用于读取数据。可以说 PromQL 是我们学习 Prometheus 最困难也是最...