Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add stable Metrics class to decouple consumers from protobuf version#1873

Merged
zeitlinger merged 1 commit intomainprometheus/client_java:mainfrom
metrics-class-nameprometheus/client_java:metrics-class-nameCopy head branch name to clipboard
Feb 13, 2026
Merged

Add stable Metrics class to decouple consumers from protobuf version#1873
zeitlinger merged 1 commit intomainprometheus/client_java:mainfrom
metrics-class-nameprometheus/client_java:metrics-class-nameCopy head branch name to clipboard

Conversation

@zeitlinger
Copy link
Member

Summary

  • Introduce a stable Metrics.java in the version-free ...generated package that extends the versioned generated class, so consumer code no longer needs import updates on protobuf upgrades.
  • Update generate-protobuf.sh to make the generated class extensible (final removed, constructor protected) and read the old package from the stable class's extends clause.
  • Update all consumer imports to use the stable package, with @SuppressWarnings("NonCanonicalType") for Error Prone compatibility.

Test plan

  • mise run build passes (all 54 modules)
  • mise run test -pl prometheus-metrics-exposition-formats passes (47 tests)
  • mise run lint:super-linter passes

The generated protobuf Metrics.java lives in a versioned package that
changes every protobuf release, requiring import updates in all consumer
files. Introduce a stable extending class in the version-free package
so consumers import from a single stable location. On protobuf upgrades
only the extends clause in the stable class changes, handled
automatically by generate-protobuf.sh.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
Copy link
Member Author

approved by @dhoard

@zeitlinger zeitlinger merged commit 229e2e0 into main Feb 13, 2026
14 checks passed
@zeitlinger zeitlinger deleted the metrics-class-name branch February 13, 2026 16:35
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.

1 participant

Comments

Close sidebar
Morty Proxy This is a proxified and sanitized view of the page, visit original site.