Issue 9336: Auto-instrumentation with JMX not working without a trigger (#9362)

This commit is contained in:
Peter Findeisen 2023-08-31 23:56:12 -07:00 committed by GitHub
parent 323be549f5
commit 71db9ff7ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,7 @@
package io.opentelemetry.instrumentation.jmx.engine;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -38,6 +39,13 @@ class BeanFinder {
void discoverBeans(MetricConfiguration conf) {
this.conf = conf;
if (!conf.isEmpty()) {
// Issue 9336: Corner case: PlatformMBeanServer will remain unitialized until a direct
// reference to it is made. This call makes sure that the PlatformMBeanServer will be in
// the set of MBeanServers reported by MBeanServerFactory.
ManagementFactory.getPlatformMBeanServer();
}
exec.schedule(
new Runnable() {
@Override