I have a label crawled by Prometheus that contains hostnames but uses dashes as separators instead of dots. For example domain=www-example-com
.
I'm trying to replace that with a label containing dot-separated values, e.g. turn it into domain=www.example.com
but can't find a way to do that. In other words a character replace ('-' to '.'), regsubst or something like that. Using regex capture groups isn't working since the hostname has a variable number of dashes.
I'm using kube-prometheus' metricRelabelings in the ServiceMonitor that crawls Traefik's metrics.
Is there really no way to do simple string substitution? This GitHub ticket from 2018 claims it isn't possible and wouldn't be added to Prometheus either.
Did I miss anything?