prometheus/util
Nick Moore 758914e1fb
Fix SanitizeLabelName for certain invalid labels
SanitizeLabelName was not correctly sanitizing label names that:

1. Started with a digit (0-9)
2. Were empty

This commit changes the santization code to catch both of these edge
cases and adds new tests to validate it works correctly in them both. In
the first case, a leading digit will be replaced with an underscore, and
in the latter, the function will return a single underscore.

Signed-off-by: Nick Moore <nicholas.moore@grafana.com>
2023-02-03 08:53:10 +00:00
..
gate Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
httputil refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
jsonutil api: export point marshaling functions (#11323) 2022-09-29 20:16:48 +05:30
logging refactor (util): move from github.com/pkg/errors to 'errors' and 'fmt' (#10877) 2022-06-27 18:16:58 +02:00
osutil Format Go source files using 'gofumpt -w -s -extra' 2021-11-02 19:52:34 +01:00
pool Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
runtime util/runtime: use ByteSliceToString from golang.org/x/sys/unix in Uname (#11070) 2022-07-30 19:35:03 +02:00
stats Changing TotalQueryableSamples from int to int64 (#10549) 2022-04-12 01:22:25 +02:00
strutil Fix SanitizeLabelName for certain invalid labels 2023-02-03 08:53:10 +00:00
teststorage Add a feature flag to control native histogram ingestion (#11253) 2022-09-14 17:38:34 +05:30
testutil refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
treecache refactor (util): move from github.com/pkg/errors to 'errors' and 'fmt' (#10877) 2022-06-27 18:16:58 +02:00