You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add stable Metrics class to decouple consumers from protobuf version (#1873)
## 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
- [x] `mise run build` passes (all 54 modules)
- [x] `mise run test -pl prometheus-metrics-exposition-formats` passes
(47 tests)
- [x] `mise run lint:super-linter` passes
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Copy file name to clipboardExpand all lines: prometheus-metrics-exposition-formats/src/main/generated/io/prometheus/metrics/expositionformats/generated/com_google_protobuf_4_33_5/Metrics.java
Copy file name to clipboardExpand all lines: prometheus-metrics-exposition-formats/src/main/java/io/prometheus/metrics/expositionformats/internal/PrometheusProtobufWriterImpl.java
Copy file name to clipboardExpand all lines: prometheus-metrics-exposition-formats/src/test/java/io/prometheus/metrics/expositionformats/DuplicateNamesProtobufTest.java
Copy file name to clipboardExpand all lines: prometheus-metrics-exposition-formats/src/test/java/io/prometheus/metrics/expositionformats/ProtobufExpositionFormatsTest.java
0 commit comments