label_replace()函数理解
label_replace函数,输入:瞬时向量,输出:key: value = 度量指标: 值(要替换的内容:首先 ,针对src_label标签,对该标签值进行regex正则表达式匹配。如果不能匹配的度量指标,则不发生任何改变;否则,如果匹配,则把dst_label标签的标签纸替换为replacement
例子:度量指标样本数据:http_requests_total{code="400",handler="query",instance="120.77.65.193:9090",job="prometheus",method="get"} 9
label_replace函数执行
label_replace(http_requests_total{code="400",handler="query",instance="120.77.65.193:9090",job="prometheus",method="get"}, "instance", "hello,world", "method", "ge.*")
显示结果:
http_requests_total{code="400",handler="query",instance="hello,world",job="prometheus",method="get"} 9
如果我想要把instance="120.77.65.193:9090" 去掉“:9090”取值 "120.77.65.193",是否有方法?
这个不懂了,很久没搞监控了。不好意思,才回
在 2017-10-31 16:45:30,"wkjun" [email protected] 写道:
如果我想要把instance="120.77.65.193:9090" 去掉“:9090”取值 "120.77.65.193",是否有方法?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
如果我想要把instance="120.77.65.193:9090" 去掉“:9090”取值 "120.77.65.193",是否有方法?
label_replace(expression ,"instance","$1","instance","(.):.")
如果我想要把instance="120.77.65.193:9090" 去掉“:9090”取值 "120.77.65.193",是否有方法?
label_replace(exp, "instance","$1","instance","(.星号):(.星号)")
如果我想要把instance="120.77.65.193:9090" 去掉“:9090”取值 "120.77.65.193",是否有方法?
label_replace(exp, "instance","$1","instance","(.星号):(.星号)")
虽然早就忘记了这个提问,不过还是很感谢你的回复,最近在学Django,有机会可能得向你请教