-
Notifications
You must be signed in to change notification settings - Fork 979
Add metric jvm.file_descriptor.count
to jvm runtime experimental metrics
#13904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metric jvm.file_descriptor.count
to jvm runtime experimental metrics
#13904
Conversation
jvm.file_descriptor.count
to jvm runtime experimental metrics
🔧 The result from spotlessApply was committed to the PR branch. |
…n' of github.com:schmikei/opentelemetry-java-instrumentation into feat/add-jvm-file-descriptors-to-runtime-instrumentation
#13913 has been merged, you should be able to update it from |
Meter meter = JmxRuntimeMetricsUtil.getMeter(openTelemetry); | ||
List<AutoCloseable> observables = new ArrayList<>(); | ||
|
||
if (osBean instanceof com.sun.management.UnixOperatingSystemMXBean) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what I'm a bit confused about is that in
Lines 35 to 41 in df42601
Supplier<Long> processCpuTimeSupplier = | |
methodInvoker(osBean, OS_BEAN_HOTSPOT, METHOD_PROCESS_CPU_TIME, Long.class); | |
if (processCpuTimeSupplier == null) { | |
// More users will be on hotspot than j9, so check for j9 second | |
processCpuTimeSupplier = | |
methodInvoker(osBean, OS_BEAN_J9, METHOD_PROCESS_CPU_TIME, Long.class); | |
} |
com.sun.management.UnixOperatingSystemMXBean
is not available. If it has always been so why does CpuMethods
use reflection at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Googling for NoClassDefFoundError UnixOperatingSystemMXBean
indicates that even if this class is present in the jdk there could still be a NoClassDefFoundError
when the application server does not delegate loading all classes to boot or system loader. This is so for example on wildfly. So I think it could be beneficial to use Class.forName
to check for the presence of com.sun.management.UnixOperatingSystemMXBean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I was meaning to look into this further cross JDKs today. Thank you so much for making that change 🚀
Apologies for the delay, was battling some larger issues, but I believe that this should add the new experimental metric introduced in #13722
Resolves #13757