简体   繁体   English

普罗米修斯指标重新标记价值

[英]Prometheus metric relabel for value

Basically I want to relabel the metric value , path = /api/v2/users/-/hashes/004fc134-93ba-4c48-b0da-e114f2245b77/activate基本上我想重新标记度量值,路径 = /api/v2/users/-/hashes/004fc134-93ba-4c48-b0da-e114f2245b77/activate

to

/api/v2/users/externalhashes/ops /api/v2/users/externalhashes/ops

I tried this below but its not working.我在下面试过这个,但它不起作用。 Am i missing something?我错过了什么吗?

  metric_relabel_configs:
  - source_labels: [path]
    regex: (\/api\/v2\/users\/+.\/hashes\/[0-9a-z\-]{1,40}\/\w.*)
    replacement: ‘/api/v2/users/externalhashes/ops’
    target_label: path

请尝试以下操作:

regex: '/api/v2/users/.+/hashes/[0-9a-z\-]{1,40}/\w.*'

Prometheus uses Golang re2 package to parse Regular expressions https://github.com/google/re2/wiki/Syntax Prometheus 使用 Golang re2包解析正则表达式https://github.com/google/re2/wiki/Syntax

Googling quickly for a tester I found this https://regoio.herokuapp.com/快速搜索测试人员我发现了这个https://regoio.herokuapp.com/

Marcelo's answer does the work :+1:马塞洛的回答有效:+1:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM