-
Notifications
You must be signed in to change notification settings - Fork 815
UTF-8 support in metric and label names #1255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Federico Torres <[email protected]>
Signed-off-by: Federico Torres <[email protected]>
Given the ongoing discussion about unit suffixes for OM 2.0 (prometheus/OpenMetrics#286), I think we can take this UTF-8 work as a basis and then add the necessary changes to comply with the final consensus on suffixes. |
Signed-off-by: Federico Torres <[email protected]>
@fstab are you ok with that? |
Update: The |
@fstab Good to know, thanks for the update! |
Hello @fstab, I just wanted to follow-up on your last comment. Seems like OM 2.0 is still under discussion, so do you think now is a good time to reconsider merging this PR? |
We have our |
@fedetorres93 thanks for the PR! let me start with some high level questions before an in-depth review:
|
Adds UTF-8 support for metric and label names.
These changes are based on the work done on the Prometheus common libraries here and here
prometheus-metrics-exposition-formats
module will use the new quoting syntax{"foo"}
iff the metric does not conform to the legacy name format (foo{}
)prometheus-metrics-model
module has a new flag (NameValidationScheme
) that determines if validation is done using the legacy or the UTF-8 scheme. This flag can be set via a property in the properties file.escaping=allow-utf-8
in the Accept header. In cases where UTF-8 is not available, metric providers can be configured to escape names in a few different ways: values (U__
UTF value escaping for perfect round-tripping), underscores (all invalid chars become_
), dots (dots become_dot_
,_
becomes__
, all other values become___
). Escaping can either be a global default (PrometheusNaming.nameEscapingScheme
) or can also be specified in Accept header with theescaping=
term, which can beallow-utf-8
(for UTF-8-compatible),underscores
,dots
, orvalues
.This should still be a noop for existing configurations because scrapers will not be passing the escaping key in the Accept header. Existing functionality is maintained.
prometheus-metrics-exporter-pushgateway
module will escape UTF-8 grouping keys in the URL path used when pushing metrics (see Add UTF-8 support in metric and label names pushgateway#689)Work towards prometheus/prometheus#13095