Closed NiceGuyIT closed 2 years ago
Thanks for the issue!
This is by design. It makes it simpler to perform regex matching in relabel configs and follows the convention used in other 'list' type labels in Prometheus: https://www.robustperception.io/little-things-matter.
That's interesting. The article talks about using relabel_configs
to change internal labels in __meta_consul_tags
to enhance downstream information and processes. It took me longer than desired to realize relabel_configs
does not work because dnsnames
is a metric, not a config. metric_relabel_configs
can modify the dnsnames
, emails
, ips
and others that might have a comma.
metric_relabel_configs:
- source_labels: [ dnsnames ]
target_label: dnsnames
regex: ",(.+),"
replacement: "$1"
action: replace
I'm going to close this because the metric_relabel_configs
fixes it for me.
This is a minor issue but the result is propagated through to the emails sent by alertmanager. The
dnsnames
has a preceding and trailing comma. Using GitHub as an example, notice how thednsnames
label has a comma at the beginning and end. Those commas show up in alertmanager and the emails sent from alertmanager.curl --silent "localhost:9219/probe?target=github.com:443" | grep 'dnsnames=",'
The source is coming from L450 of metrics.go. The
dnsNames()
,emailAddresses()
andorganizationalUnits()
functions have the same logic. Is there a reasoning behind having the commas? Can they be removed? TheipAddresses()
function has similar logic in that it will have a trailing comma if there is anIPAddresses
in the cert.I understand having commas between multiple entries, but having spurious commas when there is a single entry seems excessive.