UTF-8 support in metric and label names#1255
Conversation
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
|
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 <federico.torres@grafana.com>
@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:
|
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
|
@zeitlinger Thanks for the feedback. I made the statics in About adding a setting in |
I can't find that |
zeitlinger
left a comment
There was a problem hiding this comment.
great - I think I get it now 😄
prometheus-metrics-config/src/main/java/io/prometheus/metrics/config/NamingProperties.java
Outdated
Show resolved
Hide resolved
...heus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java
Outdated
Show resolved
Hide resolved
...er-pushgateway/src/test/java/io/prometheus/metrics/exporter/pushgateway/PushGatewayTest.java
Outdated
Show resolved
Hide resolved
...porter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java
Outdated
Show resolved
Hide resolved
...s-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/NameType.java
Outdated
Show resolved
Hide resolved
...heus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java
Outdated
Show resolved
Hide resolved
...heus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java
Outdated
Show resolved
Hide resolved
...-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
Outdated
Show resolved
Hide resolved
...-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
Outdated
Show resolved
Hide resolved
...-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
Outdated
Show resolved
Hide resolved
|
for formatting, checkstyle issues see CONTRIBUTING.md |
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Federico Torres <federico.torres@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
# Conflicts: # prometheus-metrics-config/src/main/java/io/prometheus/metrics/config/ExporterPushgatewayProperties.java # prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java # prometheus-metrics-exposition-formats/src/main/java/io/prometheus/metrics/expositionformats/internal/PrometheusProtobufWriterImpl.java # prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/OpenMetricsTextFormatWriter.java # prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/PrometheusProtobufWriter.java # prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/PrometheusTextFormatWriter.java # prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/TextFormatUtil.java # prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/GaugeSnapshot.java # prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/MetricMetadata.java # prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/UnknownSnapshot.java
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
fstab
left a comment
There was a problem hiding this comment.
I found one prometheus.properties file that I think is not needed anymore, otherwise it looks great 🎉
Thanks a lot everyone!
prometheus-metrics-model/src/test/resources/prometheus.properties
Outdated
Show resolved
Hide resolved
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
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-formatsmodule will use the new quoting syntax{"foo"}iff the metric does not conform to the legacy name format (foo{})prometheus-metrics-modelmodule 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-8in 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 has a global default (PrometheusNaming.DEFAULT_ESCAPING_SCHEME) 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-pushgatewaymodule 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