Move matchers to separate package and split matcher classes out
This commit is contained in:
parent
833f67816e
commit
f70c35842d
|
@ -1,5 +1,7 @@
|
|||
package datadog.trace.agent.tooling;
|
||||
|
||||
import datadog.trace.agent.tooling.bytebuddy.DDCachingPoolStrategy;
|
||||
import datadog.trace.agent.tooling.bytebuddy.DDLocationStrategy;
|
||||
import datadog.trace.bootstrap.WeakMap;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,393 +0,0 @@
|
|||
package datadog.trace.agent.tooling;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.hasSignature;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.build.HashCodeAndEqualsPlugin;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.description.type.TypeList;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import net.bytebuddy.matcher.ElementMatchers;
|
||||
|
||||
/**
|
||||
* This class provides some custom ByteBuddy element matchers to use when applying instrumentation
|
||||
*/
|
||||
@Slf4j
|
||||
public class ByteBuddyElementMatchers {
|
||||
|
||||
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeExtendsClass(
|
||||
final ElementMatcher<? super TypeDescription> matcher) {
|
||||
return new SafeExtendsClassMatcher<>(new SafeErasureMatcher<>(matcher));
|
||||
}
|
||||
|
||||
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeHasInterface(
|
||||
final ElementMatcher<? super TypeDescription> matcher) {
|
||||
return new SafeHasSuperTypeMatcher<>(new SafeErasureMatcher<>(matcher), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches any type description that declares a super type that matches the provided matcher.
|
||||
* Exceptions during matching process are logged and ignored.
|
||||
*
|
||||
* @param matcher The type to be checked for being a super type of the matched type.
|
||||
* @param <T> The type of the matched object.
|
||||
* @return A matcher that matches any type description that declares a super type that matches the
|
||||
* provided matcher.
|
||||
* @see ElementMatchers#hasSuperType(net.bytebuddy.matcher.ElementMatcher)
|
||||
*/
|
||||
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeHasSuperType(
|
||||
final ElementMatcher<? super TypeDescription> matcher) {
|
||||
return new SafeHasSuperTypeMatcher<>(new SafeErasureMatcher<>(matcher), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps another matcher to assure that an element is not matched in case that the matching causes
|
||||
* an {@link Exception}. Logs exception if it happens.
|
||||
*
|
||||
* @param matcher The element matcher that potentially throws an exception.
|
||||
* @param <T> The type of the matched object.
|
||||
* @return A matcher that returns {@code false} in case that the given matcher throws an
|
||||
* exception.
|
||||
*/
|
||||
public static <T> ElementMatcher.Junction<T> failSafe(
|
||||
final ElementMatcher<? super T> matcher, final String description) {
|
||||
return new SafeMatcher<>(matcher, false, description);
|
||||
}
|
||||
|
||||
private static TypeDescription safeAsErasure(final TypeDefinition typeDefinition) {
|
||||
try {
|
||||
return typeDefinition.asErasure();
|
||||
} catch (final Exception e) {
|
||||
log.debug(
|
||||
"{} trying to get erasure for target {}: {}",
|
||||
e.getClass().getSimpleName(),
|
||||
safeTypeDefinitionName(typeDefinition),
|
||||
e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An element matcher that matches a super type. This is different from {@link
|
||||
* net.bytebuddy.matcher.HasSuperTypeMatcher} in the following way:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Exceptions are logged
|
||||
* <li>When exception happens the rest of the inheritance subtree is discarded (since ByteBuddy
|
||||
* cannot load/parse type information for it) but search in other subtrees continues
|
||||
* </ul>
|
||||
*
|
||||
* <p>This is useful because this allows us to see when matcher's check is not complete (i.e. part
|
||||
* of it fails), at the same time it makes best effort instead of failing quickly (like {@code
|
||||
* failSafe(hasSuperType(...))} does) which means the code is more resilient to classpath
|
||||
* inconsistencies
|
||||
*
|
||||
* @param <T> The type of the matched entity.
|
||||
* @see net.bytebuddy.matcher.HasSuperTypeMatcher
|
||||
*/
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
private static class SafeHasSuperTypeMatcher<T extends TypeDescription>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
/** The matcher to apply to any super type of the matched type. */
|
||||
private final ElementMatcher<? super TypeDescription.Generic> matcher;
|
||||
|
||||
private final boolean interfacesOnly;
|
||||
/**
|
||||
* Creates a new matcher for a super type.
|
||||
*
|
||||
* @param matcher The matcher to apply to any super type of the matched type.
|
||||
*/
|
||||
public SafeHasSuperTypeMatcher(
|
||||
final ElementMatcher<? super TypeDescription.Generic> matcher,
|
||||
final boolean interfacesOnly) {
|
||||
this.matcher = matcher;
|
||||
this.interfacesOnly = interfacesOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
final Set<TypeDescription> checkedInterfaces = new HashSet<>();
|
||||
// We do not use foreach loop and iterator interface here because we need to catch exceptions
|
||||
// in {@code getSuperClass} calls
|
||||
TypeDefinition typeDefinition = target;
|
||||
while (typeDefinition != null) {
|
||||
if (((!interfacesOnly || typeDefinition.isInterface())
|
||||
&& matcher.matches(typeDefinition.asGenericType()))
|
||||
|| hasInterface(typeDefinition, checkedInterfaces)) {
|
||||
return true;
|
||||
}
|
||||
typeDefinition = safeGetSuperClass(typeDefinition);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches a type's interfaces against the provided matcher.
|
||||
*
|
||||
* @param typeDefinition The type for which to check all implemented interfaces.
|
||||
* @param checkedInterfaces The interfaces that have already been checked.
|
||||
* @return {@code true} if any interface matches the supplied matcher.
|
||||
*/
|
||||
private boolean hasInterface(
|
||||
final TypeDefinition typeDefinition, final Set<TypeDescription> checkedInterfaces) {
|
||||
for (final TypeDefinition interfaceType : safeGetInterfaces(typeDefinition)) {
|
||||
final TypeDescription erasure = safeAsErasure(interfaceType);
|
||||
if (erasure != null) {
|
||||
if (checkedInterfaces.add(interfaceType.asErasure())
|
||||
&& (matcher.matches(interfaceType.asGenericType())
|
||||
|| hasInterface(interfaceType, checkedInterfaces))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TypeDefinition#getInterfaces() produces an interator which may throw an exception during
|
||||
* iteration if an interface is absent from the classpath.
|
||||
*
|
||||
* <p>This method exists to allow getting interfaces even if the lookup on one fails.
|
||||
*/
|
||||
private List<TypeDefinition> safeGetInterfaces(final TypeDefinition typeDefinition) {
|
||||
final List<TypeDefinition> interfaceTypes = new ArrayList<>();
|
||||
try {
|
||||
final Iterator<TypeDescription.Generic> interfaceIter =
|
||||
typeDefinition.getInterfaces().iterator();
|
||||
while (interfaceIter.hasNext()) {
|
||||
interfaceTypes.add(interfaceIter.next());
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
log.debug(
|
||||
"{} trying to get interfaces for target {}: {}",
|
||||
e.getClass().getSimpleName(),
|
||||
safeTypeDefinitionName(typeDefinition),
|
||||
e.getMessage());
|
||||
}
|
||||
return interfaceTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "safeHasSuperType(" + matcher + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An element matcher that matches its argument's {@link TypeDescription.Generic} raw type against
|
||||
* the given matcher for a {@link TypeDescription}. As a wildcard does not define an erasure, a
|
||||
* runtime exception is thrown when this matcher is applied to a wildcard.
|
||||
*
|
||||
* <p>Catches and logs exception if it was thrown when getting erasure, returning false.
|
||||
*
|
||||
* @param <T> The type of the matched entity.
|
||||
* @see net.bytebuddy.matcher.ErasureMatcher
|
||||
*/
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
private static class SafeErasureMatcher<T extends TypeDefinition>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
/** The matcher to apply to the raw type of the matched element. */
|
||||
private final ElementMatcher<? super TypeDescription> matcher;
|
||||
|
||||
/**
|
||||
* Creates a new erasure matcher.
|
||||
*
|
||||
* @param matcher The matcher to apply to the raw type.
|
||||
*/
|
||||
public SafeErasureMatcher(final ElementMatcher<? super TypeDescription> matcher) {
|
||||
this.matcher = matcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
final TypeDescription erasure = safeAsErasure(target);
|
||||
if (erasure == null) {
|
||||
return false;
|
||||
} else {
|
||||
// We would like matcher exceptions to propagate
|
||||
return matcher.matches(erasure);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "safeErasure(" + matcher + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A fail-safe matcher catches exceptions that are thrown by a delegate matcher and returns an
|
||||
* alternative value.
|
||||
*
|
||||
* <p>Logs exception if it was thrown.
|
||||
*
|
||||
* @param <T> The type of the matched entity.
|
||||
* @see net.bytebuddy.matcher.FailSafeMatcher
|
||||
*/
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
private static class SafeMatcher<T> extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
/** The delegate matcher that might throw an exception. */
|
||||
private final ElementMatcher<? super T> matcher;
|
||||
|
||||
/** The fallback value in case of an exception. */
|
||||
private final boolean fallback;
|
||||
|
||||
/** The text description to log if exception happens. */
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* Creates a new fail-safe element matcher.
|
||||
*
|
||||
* @param matcher The delegate matcher that might throw an exception.
|
||||
* @param fallback The fallback value in case of an exception.
|
||||
* @param description Descriptive string to log along with exception.
|
||||
*/
|
||||
public SafeMatcher(
|
||||
final ElementMatcher<? super T> matcher, final boolean fallback, final String description) {
|
||||
this.matcher = matcher;
|
||||
this.fallback = fallback;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
try {
|
||||
return matcher.matches(target);
|
||||
} catch (final Exception e) {
|
||||
log.debug(description, e);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "safeMatcher(try(" + matcher + ") or " + fallback + ")";
|
||||
}
|
||||
}
|
||||
|
||||
private static String safeTypeDefinitionName(final TypeDefinition td) {
|
||||
try {
|
||||
return td.getTypeName();
|
||||
} catch (final IllegalStateException ex) {
|
||||
final String message = ex.getMessage();
|
||||
if (message.startsWith("Cannot resolve type description for ")) {
|
||||
return message.replace("Cannot resolve type description for ", "");
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: add javadoc
|
||||
public static <T extends MethodDescription> ElementMatcher.Junction<T> hasSuperMethod(
|
||||
final ElementMatcher<? super MethodDescription> matcher) {
|
||||
return new HasSuperMethodMatcher<>(matcher);
|
||||
}
|
||||
|
||||
// TODO: add javadoc
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
private static class HasSuperMethodMatcher<T extends MethodDescription>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
private final ElementMatcher<? super MethodDescription> matcher;
|
||||
|
||||
public HasSuperMethodMatcher(final ElementMatcher<? super MethodDescription> matcher) {
|
||||
this.matcher = matcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final MethodDescription target) {
|
||||
if (target.isConstructor()) {
|
||||
return false;
|
||||
}
|
||||
final Junction<MethodDescription> signatureMatcher = hasSignature(target.asSignatureToken());
|
||||
TypeDefinition declaringType = target.getDeclaringType();
|
||||
final Set<TypeDefinition> checkedInterfaces = new HashSet<>();
|
||||
|
||||
while (declaringType != null) {
|
||||
for (final MethodDescription methodDescription : declaringType.getDeclaredMethods()) {
|
||||
if (signatureMatcher.matches(methodDescription) && matcher.matches(methodDescription)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (matchesInterface(declaringType.getInterfaces(), signatureMatcher, checkedInterfaces)) {
|
||||
return true;
|
||||
}
|
||||
declaringType = safeGetSuperClass(declaringType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matchesInterface(
|
||||
final TypeList.Generic interfaces,
|
||||
final Junction<MethodDescription> signatureMatcher,
|
||||
final Set<TypeDefinition> checkedInterfaces) {
|
||||
for (final TypeDefinition type : interfaces) {
|
||||
if (!checkedInterfaces.contains(type)) {
|
||||
checkedInterfaces.add(type);
|
||||
for (final MethodDescription methodDescription : type.getDeclaredMethods()) {
|
||||
if (signatureMatcher.matches(methodDescription) && matcher.matches(methodDescription)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (matchesInterface(type.getInterfaces(), signatureMatcher, checkedInterfaces)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "hasSuperMethodMatcher(" + matcher + ")";
|
||||
}
|
||||
}
|
||||
|
||||
private static TypeDefinition safeGetSuperClass(final TypeDefinition typeDefinition) {
|
||||
try {
|
||||
return typeDefinition.getSuperClass();
|
||||
} catch (final Exception e) {
|
||||
log.debug(
|
||||
"{} trying to get super class for target {}: {}",
|
||||
e.getClass().getSimpleName(),
|
||||
safeTypeDefinitionName(typeDefinition),
|
||||
e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class SafeExtendsClassMatcher<T extends TypeDescription>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
private final ElementMatcher<? super TypeDescription.Generic> matcher;
|
||||
|
||||
public SafeExtendsClassMatcher(final ElementMatcher<? super TypeDescription.Generic> matcher) {
|
||||
this.matcher = matcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
// We do not use foreach loop and iterator interface here because we need to catch exceptions
|
||||
// in {@code getSuperClass} calls
|
||||
TypeDefinition typeDefinition = target;
|
||||
while (typeDefinition != null) {
|
||||
if (matcher.matches(typeDefinition.asGenericType())) {
|
||||
return true;
|
||||
}
|
||||
typeDefinition = safeGetSuperClass(typeDefinition);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
package datadog.trace.agent.tooling;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.failSafe;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.failSafe;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.any;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||
|
||||
import datadog.trace.agent.tooling.bytebuddy.DDTransformers;
|
||||
import datadog.trace.agent.tooling.context.FieldBackedProvider;
|
||||
import datadog.trace.agent.tooling.context.InstrumentationContextProvider;
|
||||
import datadog.trace.agent.tooling.context.NoopContextProvider;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package datadog.trace.agent.tooling;
|
||||
package datadog.trace.agent.tooling.bytebuddy;
|
||||
|
||||
import static net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package datadog.trace.agent.tooling;
|
||||
package datadog.trace.agent.tooling.bytebuddy;
|
||||
|
||||
import datadog.trace.agent.tooling.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package datadog.trace.agent.tooling;
|
||||
package datadog.trace.agent.tooling.bytebuddy;
|
||||
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.asm.TypeConstantAdjustment;
|
||||
|
@ -12,10 +12,10 @@ public class DDTransformers {
|
|||
new AgentBuilder.Transformer() {
|
||||
@Override
|
||||
public DynamicType.Builder<?> transform(
|
||||
DynamicType.Builder<?> builder,
|
||||
TypeDescription typeDescription,
|
||||
ClassLoader classLoader,
|
||||
JavaModule javaModule) {
|
||||
final DynamicType.Builder<?> builder,
|
||||
final TypeDescription typeDescription,
|
||||
final ClassLoader classLoader,
|
||||
final JavaModule javaModule) {
|
||||
return builder.visit(TypeConstantAdjustment.INSTANCE);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,72 @@
|
|||
package datadog.trace.agent.tooling.bytebuddy.matcher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import net.bytebuddy.matcher.ElementMatchers;
|
||||
|
||||
/**
|
||||
* This class provides some custom ByteBuddy element matchers to use when applying instrumentation
|
||||
*/
|
||||
@Slf4j
|
||||
public class DDElementMatchers {
|
||||
|
||||
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeExtendsClass(
|
||||
final ElementMatcher<? super TypeDescription> matcher) {
|
||||
return new SafeExtendsClassMatcher<>(new SafeErasureMatcher<>(matcher));
|
||||
}
|
||||
|
||||
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeHasInterface(
|
||||
final ElementMatcher<? super TypeDescription> matcher) {
|
||||
return new SafeHasSuperTypeMatcher<>(new SafeErasureMatcher<>(matcher), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches any type description that declares a super type that matches the provided matcher.
|
||||
* Exceptions during matching process are logged and ignored.
|
||||
*
|
||||
* @param matcher The type to be checked for being a super type of the matched type.
|
||||
* @param <T> The type of the matched object.
|
||||
* @return A matcher that matches any type description that declares a super type that matches the
|
||||
* provided matcher.
|
||||
* @see ElementMatchers#hasSuperType(net.bytebuddy.matcher.ElementMatcher)
|
||||
*/
|
||||
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeHasSuperType(
|
||||
final ElementMatcher<? super TypeDescription> matcher) {
|
||||
return new SafeHasSuperTypeMatcher<>(new SafeErasureMatcher<>(matcher), false);
|
||||
}
|
||||
// TODO: add javadoc
|
||||
public static <T extends MethodDescription> ElementMatcher.Junction<T> hasSuperMethod(
|
||||
final ElementMatcher<? super MethodDescription> matcher) {
|
||||
return new HasSuperMethodMatcher<>(matcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps another matcher to assure that an element is not matched in case that the matching causes
|
||||
* an {@link Exception}. Logs exception if it happens.
|
||||
*
|
||||
* @param matcher The element matcher that potentially throws an exception.
|
||||
* @param <T> The type of the matched object.
|
||||
* @return A matcher that returns {@code false} in case that the given matcher throws an
|
||||
* exception.
|
||||
*/
|
||||
public static <T> ElementMatcher.Junction<T> failSafe(
|
||||
final ElementMatcher<? super T> matcher, final String description) {
|
||||
return new SafeMatcher<>(matcher, false, description);
|
||||
}
|
||||
|
||||
static String safeTypeDefinitionName(final TypeDefinition td) {
|
||||
try {
|
||||
return td.getTypeName();
|
||||
} catch (final IllegalStateException ex) {
|
||||
final String message = ex.getMessage();
|
||||
if (message.startsWith("Cannot resolve type description for ")) {
|
||||
return message.replace("Cannot resolve type description for ", "");
|
||||
} else {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package datadog.trace.agent.tooling.bytebuddy.matcher;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.hasSignature;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import net.bytebuddy.build.HashCodeAndEqualsPlugin;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeList;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
// TODO: add javadoc
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
class HasSuperMethodMatcher<T extends MethodDescription>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
private final ElementMatcher<? super MethodDescription> matcher;
|
||||
|
||||
public HasSuperMethodMatcher(final ElementMatcher<? super MethodDescription> matcher) {
|
||||
this.matcher = matcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final MethodDescription target) {
|
||||
if (target.isConstructor()) {
|
||||
return false;
|
||||
}
|
||||
final Junction<MethodDescription> signatureMatcher = hasSignature(target.asSignatureToken());
|
||||
TypeDefinition declaringType = target.getDeclaringType();
|
||||
final Set<TypeDefinition> checkedInterfaces = new HashSet<>();
|
||||
|
||||
while (declaringType != null) {
|
||||
for (final MethodDescription methodDescription : declaringType.getDeclaredMethods()) {
|
||||
if (signatureMatcher.matches(methodDescription) && matcher.matches(methodDescription)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (matchesInterface(declaringType.getInterfaces(), signatureMatcher, checkedInterfaces)) {
|
||||
return true;
|
||||
}
|
||||
declaringType = DDElementMatchers.safeGetSuperClass(declaringType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matchesInterface(
|
||||
final TypeList.Generic interfaces,
|
||||
final Junction<MethodDescription> signatureMatcher,
|
||||
final Set<TypeDefinition> checkedInterfaces) {
|
||||
for (final TypeDefinition type : interfaces) {
|
||||
if (!checkedInterfaces.contains(type)) {
|
||||
checkedInterfaces.add(type);
|
||||
for (final MethodDescription methodDescription : type.getDeclaredMethods()) {
|
||||
if (signatureMatcher.matches(methodDescription) && matcher.matches(methodDescription)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (matchesInterface(type.getInterfaces(), signatureMatcher, checkedInterfaces)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "hasSuperMethodMatcher(" + matcher + ")";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package datadog.trace.agent.tooling.bytebuddy.matcher;
|
||||
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeTypeDefinitionName;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.build.HashCodeAndEqualsPlugin;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
/**
|
||||
* An element matcher that matches its argument's {@link TypeDescription.Generic} raw type against
|
||||
* the given matcher for a {@link TypeDescription}. As a wildcard does not define an erasure, a
|
||||
* runtime exception is thrown when this matcher is applied to a wildcard.
|
||||
*
|
||||
* <p>Catches and logs exception if it was thrown when getting erasure, returning false.
|
||||
*
|
||||
* @param <T> The type of the matched entity.
|
||||
* @see net.bytebuddy.matcher.ErasureMatcher
|
||||
*/
|
||||
@Slf4j
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
class SafeErasureMatcher<T extends TypeDefinition> extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
/** The matcher to apply to the raw type of the matched element. */
|
||||
private final ElementMatcher<? super TypeDescription> matcher;
|
||||
|
||||
/**
|
||||
* Creates a new erasure matcher.
|
||||
*
|
||||
* @param matcher The matcher to apply to the raw type.
|
||||
*/
|
||||
public SafeErasureMatcher(final ElementMatcher<? super TypeDescription> matcher) {
|
||||
this.matcher = matcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
final TypeDescription erasure = safeAsErasure(target);
|
||||
if (erasure == null) {
|
||||
return false;
|
||||
} else {
|
||||
// We would like matcher exceptions to propagate
|
||||
return matcher.matches(erasure);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "safeErasure(" + matcher + ")";
|
||||
}
|
||||
|
||||
static TypeDescription safeAsErasure(final TypeDefinition typeDefinition) {
|
||||
try {
|
||||
return typeDefinition.asErasure();
|
||||
} catch (final Exception e) {
|
||||
log.debug(
|
||||
"{} trying to get erasure for target {}: {}",
|
||||
e.getClass().getSimpleName(),
|
||||
safeTypeDefinitionName(typeDefinition),
|
||||
e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package datadog.trace.agent.tooling.bytebuddy.matcher;
|
||||
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
class SafeExtendsClassMatcher<T extends TypeDescription>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
private final ElementMatcher<? super TypeDescription.Generic> matcher;
|
||||
|
||||
public SafeExtendsClassMatcher(final ElementMatcher<? super TypeDescription.Generic> matcher) {
|
||||
this.matcher = matcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
// We do not use foreach loop and iterator interface here because we need to catch exceptions
|
||||
// in {@code getSuperClass} calls
|
||||
TypeDefinition typeDefinition = target;
|
||||
while (typeDefinition != null) {
|
||||
if (matcher.matches(typeDefinition.asGenericType())) {
|
||||
return true;
|
||||
}
|
||||
typeDefinition = DDElementMatchers.safeGetSuperClass(typeDefinition);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
package datadog.trace.agent.tooling.bytebuddy.matcher;
|
||||
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeTypeDefinitionName;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.SafeErasureMatcher.safeAsErasure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.build.HashCodeAndEqualsPlugin;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
/**
|
||||
* An element matcher that matches a super type. This is different from {@link
|
||||
* net.bytebuddy.matcher.HasSuperTypeMatcher} in the following way:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Exceptions are logged
|
||||
* <li>When exception happens the rest of the inheritance subtree is discarded (since ByteBuddy
|
||||
* cannot load/parse type information for it) but search in other subtrees continues
|
||||
* </ul>
|
||||
*
|
||||
* <p>This is useful because this allows us to see when matcher's check is not complete (i.e. part
|
||||
* of it fails), at the same time it makes best effort instead of failing quickly (like {@code
|
||||
* failSafe(hasSuperType(...))} does) which means the code is more resilient to classpath
|
||||
* inconsistencies
|
||||
*
|
||||
* @param <T> The type of the matched entity.
|
||||
* @see net.bytebuddy.matcher.HasSuperTypeMatcher
|
||||
*/
|
||||
@Slf4j
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
class SafeHasSuperTypeMatcher<T extends TypeDescription>
|
||||
extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
/** The matcher to apply to any super type of the matched type. */
|
||||
private final ElementMatcher<? super TypeDescription.Generic> matcher;
|
||||
|
||||
private final boolean interfacesOnly;
|
||||
/**
|
||||
* Creates a new matcher for a super type.
|
||||
*
|
||||
* @param matcher The matcher to apply to any super type of the matched type.
|
||||
*/
|
||||
public SafeHasSuperTypeMatcher(
|
||||
final ElementMatcher<? super TypeDescription.Generic> matcher, final boolean interfacesOnly) {
|
||||
this.matcher = matcher;
|
||||
this.interfacesOnly = interfacesOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
final Set<TypeDescription> checkedInterfaces = new HashSet<>();
|
||||
// We do not use foreach loop and iterator interface here because we need to catch exceptions
|
||||
// in {@code getSuperClass} calls
|
||||
TypeDefinition typeDefinition = target;
|
||||
while (typeDefinition != null) {
|
||||
if (((!interfacesOnly || typeDefinition.isInterface())
|
||||
&& matcher.matches(typeDefinition.asGenericType()))
|
||||
|| hasInterface(typeDefinition, checkedInterfaces)) {
|
||||
return true;
|
||||
}
|
||||
typeDefinition = safeGetSuperClass(typeDefinition);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches a type's interfaces against the provided matcher.
|
||||
*
|
||||
* @param typeDefinition The type for which to check all implemented interfaces.
|
||||
* @param checkedInterfaces The interfaces that have already been checked.
|
||||
* @return {@code true} if any interface matches the supplied matcher.
|
||||
*/
|
||||
private boolean hasInterface(
|
||||
final TypeDefinition typeDefinition, final Set<TypeDescription> checkedInterfaces) {
|
||||
for (final TypeDefinition interfaceType : safeGetInterfaces(typeDefinition)) {
|
||||
final TypeDescription erasure = safeAsErasure(interfaceType);
|
||||
if (erasure != null) {
|
||||
if (checkedInterfaces.add(interfaceType.asErasure())
|
||||
&& (matcher.matches(interfaceType.asGenericType())
|
||||
|| hasInterface(interfaceType, checkedInterfaces))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TypeDefinition#getInterfaces() produces an interator which may throw an exception during
|
||||
* iteration if an interface is absent from the classpath.
|
||||
*
|
||||
* <p>This method exists to allow getting interfaces even if the lookup on one fails.
|
||||
*/
|
||||
private List<TypeDefinition> safeGetInterfaces(final TypeDefinition typeDefinition) {
|
||||
final List<TypeDefinition> interfaceTypes = new ArrayList<>();
|
||||
try {
|
||||
final Iterator<TypeDescription.Generic> interfaceIter =
|
||||
typeDefinition.getInterfaces().iterator();
|
||||
while (interfaceIter.hasNext()) {
|
||||
interfaceTypes.add(interfaceIter.next());
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
log.debug(
|
||||
"{} trying to get interfaces for target {}: {}",
|
||||
e.getClass().getSimpleName(),
|
||||
safeTypeDefinitionName(typeDefinition),
|
||||
e.getMessage());
|
||||
}
|
||||
return interfaceTypes;
|
||||
}
|
||||
|
||||
static TypeDefinition safeGetSuperClass(final TypeDefinition typeDefinition) {
|
||||
try {
|
||||
return typeDefinition.getSuperClass();
|
||||
} catch (final Exception e) {
|
||||
log.debug(
|
||||
"{} trying to get super class for target {}: {}",
|
||||
e.getClass().getSimpleName(),
|
||||
safeTypeDefinitionName(typeDefinition),
|
||||
e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "safeHasSuperType(" + matcher + ")";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package datadog.trace.agent.tooling.bytebuddy.matcher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.build.HashCodeAndEqualsPlugin;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
/**
|
||||
* A fail-safe matcher catches exceptions that are thrown by a delegate matcher and returns an
|
||||
* alternative value.
|
||||
*
|
||||
* <p>Logs exception if it was thrown.
|
||||
*
|
||||
* @param <T> The type of the matched entity.
|
||||
* @see net.bytebuddy.matcher.FailSafeMatcher
|
||||
*/
|
||||
@Slf4j
|
||||
@HashCodeAndEqualsPlugin.Enhance
|
||||
class SafeMatcher<T> extends ElementMatcher.Junction.AbstractBase<T> {
|
||||
|
||||
/** The delegate matcher that might throw an exception. */
|
||||
private final ElementMatcher<? super T> matcher;
|
||||
|
||||
/** The fallback value in case of an exception. */
|
||||
private final boolean fallback;
|
||||
|
||||
/** The text description to log if exception happens. */
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* Creates a new fail-safe element matcher.
|
||||
*
|
||||
* @param matcher The delegate matcher that might throw an exception.
|
||||
* @param fallback The fallback value in case of an exception.
|
||||
* @param description Descriptive string to log along with exception.
|
||||
*/
|
||||
public SafeMatcher(
|
||||
final ElementMatcher<? super T> matcher, final boolean fallback, final String description) {
|
||||
this.matcher = matcher;
|
||||
this.fallback = fallback;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final T target) {
|
||||
try {
|
||||
return matcher.matches(target);
|
||||
} catch (final Exception e) {
|
||||
log.debug(description, e);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "safeMatcher(try(" + matcher + ") or " + fallback + ")";
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.agent.tooling.context;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
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;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.agent.test
|
||||
|
||||
import datadog.trace.agent.tooling.DDLocationStrategy
|
||||
import datadog.trace.agent.tooling.bytebuddy.DDLocationStrategy
|
||||
import datadog.trace.util.test.DDSpecification
|
||||
import net.bytebuddy.agent.builder.AgentBuilder
|
||||
import spock.lang.Shared
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package datadog.trace.agent.tooling
|
||||
|
||||
import datadog.trace.agent.tooling.bytebuddy.DDCachingPoolStrategy
|
||||
import datadog.trace.util.test.DDSpecification
|
||||
import net.bytebuddy.description.type.TypeDescription
|
||||
import net.bytebuddy.dynamic.ClassFileLocator
|
||||
|
@ -204,7 +205,7 @@ class CacheProviderTest extends DDSpecification {
|
|||
}
|
||||
|
||||
static newClassLoader() {
|
||||
return new URLClassLoader([] as URL[], (ClassLoader)null)
|
||||
return new URLClassLoader([] as URL[], (ClassLoader) null)
|
||||
}
|
||||
|
||||
static newLocator() {
|
||||
|
@ -215,7 +216,8 @@ class CacheProviderTest extends DDSpecification {
|
|||
}
|
||||
|
||||
@Override
|
||||
void close() throws IOException {}
|
||||
void close() throws IOException {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.apachehttpasyncclient;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.apachehttpasyncclient;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.apachehttpclient;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.aws.v0;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.aws.v2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.aws.v2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.classloading;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.couchbase.client;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.dropwizard.view;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.finatra;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v3_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v3_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.instrumentation.hibernate.HibernateDecorator.DECORATOR;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v3_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.hibernate.HibernateDecorator.DECORATOR;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v3_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.instrumentation.hibernate.HibernateDecorator.DECORATOR;
|
||||
import static datadog.trace.instrumentation.hibernate.SessionMethodUtils.SCOPE_ONLY_METHODS;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v3_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_0;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_0;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.instrumentation.hibernate.HibernateDecorator.DECORATOR;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_0;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.hibernate.HibernateDecorator.DECORATOR;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_0;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.instrumentation.hibernate.HibernateDecorator.DECORATOR;
|
||||
import static datadog.trace.instrumentation.hibernate.SessionMethodUtils.SCOPE_ONLY_METHODS;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_0;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hibernate.core.v4_3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.http_url_connection;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.hystrix;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.instrumentation.hystrix.HystrixDecorator.DECORATE;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.returns;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.noopSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.java.concurrent;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package datadog.trace.instrumentation.jaxrs1;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.hasSuperMethod;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.hasSuperMethod;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jaxrs2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jaxrs2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.instrumentation.jaxrs2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.hasSuperMethod;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.hasSuperMethod;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jaxrs2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.instrumentation.jaxrs2.JaxRsAnnotationsDecorator.DECORATE;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package datadog.trace.instrumentation.jaxrs.v1;
|
||||
|
||||
import static datadog.trace.agent.decorator.HttpServerDecorator.DD_SPAN_ATTRIBUTE;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.instrumentation.jaxrs;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.returns;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jdbc;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jdbc;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jdbc;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jdbc;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.jdbc.JDBCDecorator.DECORATE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jdbc;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.jdbc.JDBCDecorator.DECORATE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jetty8;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jms;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jms;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jms;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.jsp;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.jsp.JSPDecorator.DECORATE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.netty40;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.netty40;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.netty41;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.netty41;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.play24;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.returns;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.play26;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.returns;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.playws1;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.playws1.HeadersInjectAdapter.SETTER;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.playws21;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.playws21.HeadersInjectAdapter.SETTER;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.playws2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.playws2.HeadersInjectAdapter.SETTER;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.rabbitmq.amqp;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.noopSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.rabbitmq.amqp;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.instrumentation.rabbitmq.amqp.RabbitDecorator.DECORATE;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.ratpack;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.ratpack;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.reactor.core;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.rmi.client;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.rmi.context.client;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.instrumentation.rmi.context.ContextPropagator.PROPAGATOR;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.rmi.context.server;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.instrumentation.rmi.context.ContextPropagator.DD_CONTEXT_CALL_ID;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.rmi.server;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.rmi.ThreadLocalContext.THREAD_LOCAL_CONTEXT;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.instrumentation.servlet2;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.instrumentation.servlet3;
|
||||
|
||||
import static datadog.trace.agent.decorator.HttpServerDecorator.DD_SPAN_ATTRIBUTE;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
import static datadog.trace.instrumentation.servlet3.HttpServletRequestInjectAdapter.SETTER;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.servlet3;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.instrumentation.servlet.dispatcher;
|
||||
|
||||
import static datadog.trace.agent.decorator.HttpServerDecorator.DD_SPAN_ATTRIBUTE;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.servlet.dispatcher;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.servlet.filter;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.servlet.http;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.servlet.http;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.propagate;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.springwebflux.client;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.springwebflux.server;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.springwebflux.server;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package datadog.trace.instrumentation.springweb;
|
||||
|
||||
import static datadog.trace.agent.decorator.HttpServerDecorator.DD_SPAN_ATTRIBUTE;
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasInterface;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.trace_annotation;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.instrumentation.trace_annotation.TraceConfigInstrumentation.PACKAGE_CLASS_NAME_REGEX;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.is;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.trace_annotation;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
|
@ -46,8 +46,8 @@ public class TraceConfigInstrumentation implements Instrumenter {
|
|||
|
||||
private final Map<String, Set<String>> classMethodsToTrace;
|
||||
|
||||
private boolean validateConfigString(String configString) {
|
||||
for (String segment : configString.split(";")) {
|
||||
private boolean validateConfigString(final String configString) {
|
||||
for (final String segment : configString.split(";")) {
|
||||
if (!segment.trim().matches(CONFIG_FORMAT)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.twilio;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.twilio.TwilioClientDecorator.DECORATE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package datadog.trace.instrumentation.twilio;
|
||||
|
||||
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeExtendsClass;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
|
||||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
|
||||
import static datadog.trace.instrumentation.twilio.TwilioClientDecorator.DECORATE;
|
||||
|
|
Loading…
Reference in New Issue