fix: avoid protobuf debug reflection in native images#2251
Conversation
|
how do we know this fixes the graal specific issue? were you able to reproduce it? your PR description also says "Note: Docker/Testcontainers exporter integration test was not run locally because Docker Desktop’s Linux engine was not running." which i think is just something you and your local llm need to sort out? |
I'll try to find a solution to this and give you a reproducable steps or results. |
d4afe3d to
8178cff
Compare
|
@jaydeluca I reproduced the GraalVM native-image debug protobuf issue on Windows without Docker. Environment:
Important: run Before, on
Result on After, on
Result on fix branch: Attaching the tool(native-debug-repro.zip) I used for the above test. Seeking your re-review. |
|
https://github.com/prometheus/client_java/blob/main/.github/workflows/native-tests.yml run graalvm tests which runs https://github.com/prometheus/client_java/blob/main/integration-tests/it-spring-boot-smoke-test/src/test/java/io/prometheus/metrics/it/springboot/ApplicationTest.java using graalvm - can you add a reproducer there? |
@zeitlinger I have added a reproducer to the existing Spring Boot native smoke test in ApplicationTest. It now exercises
|
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com> Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com> Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com> Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com> Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
108bb18 to
f776759
Compare
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
|
@arnabnandy7 I removed arnabnandy7@c9c70bb#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8 - as the ctor is not taking a shaded class any more - seems to work |
|
thanks for the contribution 😄 |
Thanks for clarifying and cleaning things up for me. |
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
PrometheusProtobufWriterImpl#toDebugString(...)to use the new formatter.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