Skip to content
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 classLoaderMatcher() for the spring-boot-actuator-autoconfigure i… #6695

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@

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;
import io.opentelemetry.javaagent.extension.instrumentation.HelperResourceBuilder;
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 {
Expand All @@ -20,6 +22,12 @@ public SpringBootActuatorInstrumentationModule() {
super("spring-boot-actuator-autoconfigure", "spring-boot-actuator-autoconfigure-2.0");
}

@Override
public ElementMatcher.Junction<ClassLoader> 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
Expand Down