Skip to content

Update Prometheus client to 1.4.3#8080

Open
zeitlinger wants to merge 1 commit intoopen-telemetry:mainfrom
zeitlinger:update-prom-client-simple
Open

Update Prometheus client to 1.4.3#8080
zeitlinger wants to merge 1 commit intoopen-telemetry:mainfrom
zeitlinger:update-prom-client-simple

Conversation

@zeitlinger
Copy link
Member

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, sanitizeMetricName and sanitizeLabelName no 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:

  • Bump prometheusServerVersion from 1.3.10 to 1.4.3
  • Add prometheusName() calls for metric names and label names to preserve legacy escaping
  • Update shaded protobuf import in test (4.31.1 → 4.33.0)

Test plan

  • All existing prometheus exporter tests pass (129 tests)
  • MetricReaderFactoryTest in sdk-extensions/incubator passes

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
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.20%. Comparing base (7ce6c5c) to head (2b8cac6).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

* strips invalid leading prefixes.
*/
private static String convertLabelName(String key) {
return sanitizeLabelName(prometheusName(key));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants