diff --git a/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/actuator/SpringBootActuatorInstrumentationModule.java b/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/actuator/SpringBootActuatorInstrumentationModule.java index d49def3beab0..1aa98998b3de 100644 --- a/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/actuator/SpringBootActuatorInstrumentationModule.java +++ b/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/actuator/SpringBootActuatorInstrumentationModule.java @@ -5,6 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.spring.actuator; +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; import static java.util.Collections.singletonList; import com.google.auto.service.AutoService; @@ -12,6 +13,7 @@ import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; @AutoService(InstrumentationModule.class) public class SpringBootActuatorInstrumentationModule extends InstrumentationModule { @@ -20,6 +22,12 @@ public SpringBootActuatorInstrumentationModule() { super("spring-boot-actuator-autoconfigure", "spring-boot-actuator-autoconfigure-2.0"); } + @Override + public ElementMatcher.Junction classLoaderMatcher() { + // added in micrometer-core 1.5 + return hasClassesNamed("io.micrometer.core.instrument.config.validate.Validated"); + } + @Override public void registerHelperResources(HelperResourceBuilder helperResourceBuilder) { // autoconfigure classes are loaded as resources using ClassPathResource