Update Prometheus client to 1.5.0#8080
Update Prometheus client to 1.5.0#8080zeitlinger wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8080 +/- ##
============================================
- Coverage 90.31% 90.31% -0.01%
Complexity 7606 7606
============================================
Files 839 839
Lines 22888 22889 +1
Branches 2283 2283
============================================
Hits 20672 20672
Misses 1506 1506
- Partials 710 711 +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.
2b8cac6 to
e56b562
Compare
e56b562 to
63d2327
Compare
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
63d2327 to
3815925
Compare
Summary
Simplified replacement for #7588 - updates the Prometheus client from 1.3.10 to 1.5.0 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.5.0prometheusName()calls for metric names and label names to preserve legacy escapingMetricsclass fromio.prometheus.metrics.expositionformats.generated.Metricsinstead of versioned protobuf package (new in 1.5.0, see Add stable Metrics class to decouple consumers from protobuf version prometheus/client_java#1873)@SuppressWarnings("NonCanonicalType")— the stableMetricsclass extends the versioned protobuf-generated class, so Error Prone flags inner type references as non-canonicalTest plan
MetricReaderFactoryTestin sdk-extensions/incubator passes