Skip to content

fix: avoid protobuf debug reflection in native images#2251

Open
arnabnandy7 wants to merge 1 commit into
prometheus:mainfrom
arnabnandy7:fix/graalvm-native-histogram
Open

fix: avoid protobuf debug reflection in native images#2251
arnabnandy7 wants to merge 1 commit into
prometheus:mainfrom
arnabnandy7:fix/graalvm-native-histogram

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Summary

Fixes #1995.

This PR avoids GraalVM native-image failures when using the protobuf debug exposition format with native histograms. The debug output path now formats protobuf metric families through direct generated protobuf getters instead of TextFormat.printer(), which relied on reflection unavailable in native images.

Changes

  • Added a reflection-free protobuf debug formatter.
  • Updated PrometheusProtobufWriterImpl#toDebugString(...) to use the new formatter.
  • Added a native histogram debug-string regression test.

Testing

  • mise run lint:fix
  • ./mvnw.cmd -pl prometheus-metrics-exposition-formats test -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn
  • ./mvnw.cmd -pl prometheus-metrics-exposition-formats-shaded -am install -DskipTests -Dcoverage.skip=true

Note: Docker/Testcontainers exporter integration test was not run locally because Docker Desktop’s Linux engine was not running.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
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.

Native Histogram not working with GraalVM

1 participant