我在Prometheus中通过consul服务发现的方式抓取了一个target,里有一个metrics在上报时将label写错了,希望通过relabel进行更改
有问题的指标:
zeus_extractor_count
当前查询结果:
{__name__="zeus_extractor_count", job="consul", service_name="AiUserTagSingleQuery"}
希望通过relabel达到的效果
{__name__="zeus_extractor_count", job="consul", service="AiUserTagSingleQuery"}
如上所述,我希望通过relabel功能将该指标内的service_name改成service
Prometheus配置:
- job_name: 'consul'
metrics_path: /metrics
scheme: http
consul_sd_configs:
- server: '127.0.0.1:7888'
datacenter: 'consul'
relabel_configs:
- source_labels: ['__meta_consul_dc']
target_label: 'dc'
- source_labels: ['__meta_consul_service']
target_label: 'app'
- source_labels: ['__meta_consul_address']
target_label: 'host'
- source_labels: ['__meta_consul_node']
target_label: 'hostname'
- source_labels: ['__meta_consul_service_metadata_lane']
target_label: 'lane'
- source_labels: ['service_name']
target_label: 'service'
添加relabel
- source_labels: ['service_name']
target_label: 'service'
在Prometheus和VictoriaMetrics中都进行了尝试,查询结果并未发生改变,请问下我应该怎么配置才能达到预期