From 01ae684179462e72e54abb45c89010f5c05704f7 Mon Sep 17 00:00:00 2001 From: IuryAlves Date: Thu, 27 Mar 2025 13:20:00 +0100 Subject: [PATCH] chore: allow dashes and dots in the metric label values The Prometheus Data model allows any unicode characters in label values, as documented [here](https://prometheus.io/docs/concepts/data_model/\#:\~:text\=Label%20values%20may%20contain%20any%20Unicode%20characters.) --- prometheus/sanitize.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/sanitize.go b/prometheus/sanitize.go index 6c3f7f15..f8619242 100644 --- a/prometheus/sanitize.go +++ b/prometheus/sanitize.go @@ -35,7 +35,7 @@ var DefaultSanitizerOpts = tally.SanitizeOptions{ Characters: tally.UnderscoreCharacters, }, ValueCharacters: tally.ValidCharacters{ - Ranges: tally.AlphanumericRange, + Ranges: append(tally.AlphanumericRange, tally.SanitizeRange{rune('-'), rune('.')}), Characters: tally.UnderscoreCharacters, }, ReplacementCharacter: tally.DefaultReplacementCharacter,