hmm, in prometheus, is there a way to take a variable containing a value like `host:9121` and get `host:9100` back to use in a metrics query?
I can see label_replace but I don't think that's what I'm wanting?
hmm, in prometheus, is there a way to take a variable containing a value like `host:9121` and get `host:9100` back to use in a metrics query?
I can see label_replace but I don't think that's what I'm wanting?
@thisismissem Depending on what you need label_replace could help. e.g. given 2 metrics:
up{instance="demo-service-0:10000"} = 1
demo_num_cpus{instance="demo-service-1:10001"} = 4
you can do:
label_replace(up{instance="demo-service-0:10000"}, "instance", "$1-1:10001", "instance", "(.*)-0:10000") * on (instance) demo_num_cpus
and get out:
{instance="demo-service-1:10001"} = 4
Example on promlabs demo site: