Skip to content

Commit

Permalink
Add classLoaderOptimization() to @WithSpan instrumentations (#7996)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Mar 28, 2023
1 parent d24d798 commit 07335c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.extensionannotations;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
import static net.bytebuddy.matcher.ElementMatchers.hasParameters;
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
Expand Down Expand Up @@ -57,6 +58,11 @@ public class WithSpanInstrumentation implements TypeInstrumentation {
excludedMethodsMatcher = configureExcludedMethods();
}

@Override
public ElementMatcher<ClassLoader> classLoaderOptimization() {
return hasClassesNamed("application.io.opentelemetry.extension.annotations.WithSpan");
}

@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return declaresMethod(annotatedMethodMatcher);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.instrumentationannotations;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static io.opentelemetry.javaagent.instrumentation.instrumentationannotations.WithSpanSingletons.instrumenter;
import static io.opentelemetry.javaagent.instrumentation.instrumentationannotations.WithSpanSingletons.instrumenterWithAttributes;
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
Expand Down Expand Up @@ -60,6 +61,11 @@ public class WithSpanInstrumentation implements TypeInstrumentation {
excludedMethodsMatcher = configureExcludedMethods();
}

@Override
public ElementMatcher<ClassLoader> classLoaderOptimization() {
return hasClassesNamed("application.io.opentelemetry.instrumentation.annotations.WithSpan");
}

@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return declaresMethod(annotatedMethodMatcher);
Expand Down

0 comments on commit 07335c8

Please sign in to comment.