swift-server/swift-prometheus

Add dimension name sanitizer

vojtarylko opened this issue · 1 comments

Feature Request

Add dimension name sanitizer along already existing LabelSanitizer.

Motivation Behind Feature

Dimension names are limited by Prometheus:

may contain ASCII letters, numbers, as well as underscores. They must match the regex [a-zA-Z_][a-zA-Z0-9_]*

names beginning with __ are reserved for internal use.

Note: Dimension values may contain any Unicode characters.
Note: The metric name (sanitized by LabelSanitizer) follows different rules ([a-zA-Z_:][a-zA-Z0-9_:]*).

The reasoning behind this feature is same as in the #29.

ktoso commented

Would you send in a PR for this @vojtarylko ? Thanks!