opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Add rules for basic JVM monitoring to intstrumentation/jmx-metrics

Open adamw opened this issue 1 year ago • 1 comments

I'd like to propose adding a set of rules for reporting basic JVM metrics (GC, memory, classloaders). I've seen some of these mentioned in the README, though there's no built-in ruleset.

I've created my own basing on another otel project, and maybe this might be useful for others as well? (probably in combination with the rule sets already defined (for tomcat, kafka etc.)). Initially, I kind of expected these to be reported by default, but it turned out otherwise :) Unless there are other mechanisms for funnelling the basic JVM metrics into otel, that are preferable?

adamw avatar Sep 20 '24 19:09 adamw

hi @adamw!

I kind of expected these to be reported by default

you should be getting these by default: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/runtime/jvm-metrics.md

trask avatar Sep 23 '24 18:09 trask

@trask Thanks! Do you mean these metrics should be gathered & exposed automatically - just by using the SDK (I don't think that's happening ;) )? Or that I should rename the metrics I added here to adhere to this naming convention (which I should, if they are not gathered automatically)?

adamw avatar Sep 24 '24 07:09 adamw

(btw. - I'm not using the Java agent, but trying to initialize everything from my main method, fwiw)

adamw avatar Sep 24 '24 07:09 adamw

Do you mean these metrics should be gathered & exposed automatically - just by using the SDK (I don't think that's happening ;) )?

Just using the SDK is not enough to get these, you'll need https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/runtime-telemetry/runtime-telemetry-java8/library

laurit avatar Sep 24 '24 09:09 laurit

@laurit Works great, I missed that library, thank you! Closing this then :)

adamw avatar Sep 24 '24 11:09 adamw