Update Prometheus client to 1.4.3#8080
Update Prometheus client to 1.4.3#8080zeitlinger wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
Simplified replacement for open-telemetry#7588 - always uses legacy (non-UTF-8) Prometheus name escaping, without adding a flag. In Prometheus client 1.4.x, sanitizeMetricName and sanitizeLabelName no longer convert non-standard characters to underscores (to support UTF-8). To maintain backward compatibility, prometheusName() is called first to convert to legacy format.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8080 +/- ##
============================================
- Coverage 90.20% 90.20% -0.01%
Complexity 7595 7595
============================================
Files 841 841
Lines 22919 22920 +1
Branches 2291 2291
============================================
Hits 20674 20674
Misses 1529 1529
- Partials 716 717 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| * strips invalid leading prefixes. | ||
| */ | ||
| private static String convertLabelName(String key) { | ||
| return sanitizeLabelName(prometheusName(key)); |
There was a problem hiding this comment.
@zeitlinger when I look into the code I see prometheusName calls escapeName(String, EscapingScheme), where EscapingScheme is an enum with values: ALLOW_UTF8, UNDERSCORE_ESCAPING, DOTS_ESCAPING, VALUE_ENCODING_ESCAPING
And I've seen some hints in the code that the metric and attribute name escaping is influenced by headers requested by the client. Do we need to escape at all or will prometheus do we want by default?
Also, we've had offline conversations about the prometheus client library automatically appending suffixes like _total and units, and not providing an opt out mechanism, which makes it problematic for us in opentelemetry-java to implement the translation strategy option. Want to confirm this is still the case with this new version. Seems a bit strange that prometheus would have facilities to produce a full unescaped utf8 metric name but still always produces metric names with the suffixes.
Summary
Simplified replacement for #7588 - updates the Prometheus client from 1.3.10 to 1.4.3 without adding a UTF-8 support flag.
In Prometheus client 1.4.x,
sanitizeMetricNameandsanitizeLabelNameno longer convert non-standard characters (dots, dashes, non-ASCII) to underscores, since the client now supports UTF-8 natively. To maintain backward-compatible behavior,prometheusName()is called first to convert names to legacy Prometheus format before sanitization.Changes:
prometheusServerVersionfrom 1.3.10 to 1.4.3prometheusName()calls for metric names and label names to preserve legacy escapingTest plan
MetricReaderFactoryTestin sdk-extensions/incubator passes