Search code examples
monitoringprometheusgrafanaprometheus-alertmanager

Prometheus metric relabel for value


Basically I want to relabel the metric value , path = /api/v2/users/-/hashes/004fc134-93ba-4c48-b0da-e114f2245b77/activate

to

/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

Solution

  • Try the following:

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