Skip to content

label_replace()函数理解 #4

@1046102779

Description

@1046102779

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions