oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.36k stars 1.63k forks source link

[Native Image] jvm_gc_* and jvm_buffer_* metrics missing #9912

Open patpatpat123 opened 2 weeks ago

patpatpat123 commented 2 weeks ago

Describe the Issue

For a springboot 3.4 ( latest as of this writing) and GraalVM JDK23, project, there are missing metrics.

For background, the same app https://github.com/patpatpat123/nativejvmmetricsissueminimal running in "normal" (not native) will have the jvmgc and jvmbuffer metrics

The exact same app, running as native image, will not have the metrics, which is the issue.

Not having GC, buffer etc metrics greatly impact the observability of the native image app.

Thank you for looking into this.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java 23 2024-09-17 Java(TM) SE Runtime Environment Oracle GraalVM 23+37.1 (build 23+37-jvmci-b01) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23+37.1 (build 23+37-jvmci-b01, mixed mode, sharing)

Operating System and Version

Mac os

Diagnostic Flag Confirmation

Run Command

mvn -Pnative spring-boot:build-image

docker run docker.io/library/sre-demo:0.0.1-SNAPSHOT

Expected Behavior

to see jvmgc and jvmbuffer in both non native and native image

Actual Behavior

jvmgc and jvmbuffer are present only in non native run, but absent when running native image.

Steps to Reproduce

mvn -Pnative spring-boot:build-image

docker run docker.io/library/sre-demo:0.0.1-SNAPSHOT

Additional Context

https://github.com/patpatpat123/nativejvmmetricsissueminimal

Run-Time Log Output and Error Messages

No response

oubidar-Abderrahim commented 1 week ago

reading jvm events with native image is not a straightforward process and requires some tweaking, there are a few example using OpenTelemetry with GraalVM native image that you can find online, also it would make sense to check with Spring Boot on what they support and with which GraalVM version

Karm commented 1 week ago

@patpatpat123 Wouldn't JFR be an option for you?

roberttoyonaga commented 1 week ago

@patpatpat123 I'm not sure if this will work for you use-case, but I think micrometer uses GC Notifications for gc related metrics. There's a PR up for adding notification support, which might solve your problem: https://github.com/oracle/graal/pull/9799

Otherwise, like Karm said, I think JFR could help you too.

patpatpat123 commented 1 week ago

Hello @oubidar-Abderrahim ,

Your comment is not very clear, and it seems you are trying to offload a graalvm issue to other teams. Furthermore, the closing of this issue seems inappropriate as well.

After some investigation, it seems this issue is indeed related to graalvm https://github.com/oracle/graal/issues/8237 Please feel free to close this as duplicate, but the issue is clear and accepted.

Furthermore, I do not think this issue should be closed, as https://github.com/oracle/graal/issues/8237 only addresses part of the issue. For the buffer metrics, SubstrateVM needs to provide an implementation of BufferPoolMXBean which I believe it currently doesn't. I didn't find any issue in their issue tracker requesting it

Would you like me to open an issue reflecting this as well? Thank you

roberttoyonaga commented 1 week ago

Hi @patpatpat123

Furthermore, I do not think this issue should be closed, as https://github.com/oracle/graal/issues/8237 only addresses part of the issue. For the buffer metrics, SubstrateVM needs to provide an implementation of BufferPoolMXBean which I believe it currently doesn't. I didn't find any issue in their issue tracker requesting it Would you like me to open an issue reflecting this as well?

Hmm I don't think it's necessary to open another separate issue. Maybe just mention briefly in the description that https://github.com/oracle/graal/issues/8237 already covers the GC metrics, but you're still concerned about the buffer metrics.

roberttoyonaga commented 1 week ago

Hi @oubidar-Abderrahim, I see that you've assigned me to this issue. I probably won't end up working on this for a while and don't want to give the impression that this is actively being worked on, in case someone else wants to give it a shot.

However, if no one at Oracle plans on taking this issue, feel free to keep me assigned in the meantime.