Constantify non decorator matcher
This commit is contained in:
parent
bc85e69aad
commit
2f71ad850f
|
@ -23,9 +23,11 @@ import java.util.SortedSet;
|
|||
import java.util.TreeSet;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.description.annotation.AnnotationSource;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import net.bytebuddy.matcher.ElementMatcher.Junction;
|
||||
import net.bytebuddy.utility.JavaModule;
|
||||
|
||||
/**
|
||||
|
@ -45,6 +47,12 @@ public interface Instrumenter {
|
|||
|
||||
@Slf4j
|
||||
abstract class Default implements Instrumenter {
|
||||
|
||||
// Added here instead of AgentInstaller's ignores because it's relatively
|
||||
// expensive. https://github.com/DataDog/dd-trace-java/pull/1045
|
||||
public static final Junction<AnnotationSource> NOT_DECORATOR_MATCHER =
|
||||
not(isAnnotatedWith(named("javax.decorator.Decorator")));
|
||||
|
||||
private final SortedSet<String> instrumentationNames;
|
||||
private final String instrumentationPrimaryName;
|
||||
private final InstrumentationContextProvider contextProvider;
|
||||
|
@ -83,9 +91,7 @@ public interface Instrumenter {
|
|||
classLoaderMatcher(),
|
||||
"Instrumentation class loader matcher unexpected exception: "
|
||||
+ getClass().getName()))
|
||||
// Added here instead of AgentInstaller's ignores because it's relatively
|
||||
// expensive. https://github.com/DataDog/dd-trace-java/pull/1045
|
||||
.and(not(isAnnotatedWith(named("javax.decorator.Decorator"))))
|
||||
.and(NOT_DECORATOR_MATCHER)
|
||||
.and(new MuzzleMatcher())
|
||||
.and(new PostMatchHook())
|
||||
.transform(DDTransformers.defaultTransformers());
|
||||
|
|
|
@ -2,13 +2,13 @@ package datadog.trace.agent.tooling.context;
|
|||
|
||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.BOOTSTRAP_CLASSLOADER;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||
|
||||
import datadog.trace.agent.tooling.HelperInjector;
|
||||
import datadog.trace.agent.tooling.Instrumenter;
|
||||
import datadog.trace.agent.tooling.Instrumenter.Default;
|
||||
import datadog.trace.agent.tooling.Utils;
|
||||
import datadog.trace.api.Config;
|
||||
import datadog.trace.bootstrap.ContextStore;
|
||||
|
@ -358,9 +358,7 @@ public class FieldBackedProvider implements InstrumentationContextProvider {
|
|||
not(isInterface()).and(safeHasSuperType(named(entry.getKey()))),
|
||||
instrumenter.classLoaderMatcher())
|
||||
.and(safeToInjectFieldsMatcher())
|
||||
// Added here instead of AgentInstaller's ignores because it's relatively
|
||||
// expensive. https://github.com/DataDog/dd-trace-java/pull/1045
|
||||
.and(not(isAnnotatedWith(named("javax.decorator.Decorator"))))
|
||||
.and(Default.NOT_DECORATOR_MATCHER)
|
||||
.transform(AgentBuilder.Transformer.NoOp.INSTANCE);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue