Prometheus有时需要将两个度量值通过某个标签关联,相当于sql里面的连表查询如:
度量值1:
tempHealthStatus{env="dev",instance="10.135.160.4",job="lenovo",region="cn-chongqing",tempHealthStatus="Normal",tempIndex="1"}
度量值2:
tempDescr{env="dev",instance="10.135.160.4",job="lenovo",region="cn-chongqing",tempDescr="Ambient Temp",tempIndex="1"}
这两个度量值通过tempIndex做关联,可以通过如下的查询语句实现
0*tempDescr + on(tempIndex) group_left(tempHealthStatus) tempHealthStatus