Closed mps-sepetrov closed 6 years ago
Nice bug! Instead of your proposed solution we should just reject :
as an invalid label value. According to https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels the valid regex for labels is: [a-zA-Z_][a-zA-Z0-9_]*
. So I'd suggest checking each the labels against this regex. The relevant code is here.
@bracki FYI this issue affects label names as well as label values. Prometheus docs say that all Unicode characters are acceptable for values but only a certain set is acceptable for label names.
@mps-sepetrov This patch worked perfectly for me, thanks!
LGTM. Thank you for your contribution.
Expected behaviour
Label values can be any sequence of UTF-8 characters.
Current behaviour
No measures are taken to ensure that the label values can be persisted without affecting the retrieval process.
Steps to reproduce
:
(semicolon).Proposed implementation
Suitable escaping strategy must be used, depending on the storage implementation. JSON-encoding is not enough to escape colons. Base64-encoding the already JSON-encoded values will make the string safe to persist when using APC and in-memory storage.
Unresolved issues