Skip to content

Commit

Permalink
Issue 9336: Auto-instrumentation with JMX not working without a trigg…
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterF778 committed Sep 1, 2023
1 parent 323be54 commit 71db9ff
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71db9ff

Please sign in to comment.