Skip to content

Commit

Permalink
Replace UnloadedType with ByteBuddy TypeDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Kent committed Aug 3, 2018
1 parent c1ec598 commit 0cbef2d
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 390 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

@Slf4j
public class AgentInstaller {
public static final DDLocationStrategy LOCATION_STRATEGY = new DDLocationStrategy();
private static volatile Instrumentation INSTRUMENTATION;

public static Instrumentation getInstrumentation() {
Expand All @@ -44,7 +45,7 @@ public static ResettableClassFileTransformer installBytebuddyAgent(
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(AgentBuilder.DescriptionStrategy.Default.POOL_ONLY)
.with(new LoggingListener())
.with(new DDLocationStrategy())
.with(LOCATION_STRATEGY)
.ignore(any(), skipClassLoader())
.or(nameStartsWith("datadog.trace."))
.or(nameStartsWith("datadog.opentracing."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
* reached.
*/
public class DDLocationStrategy implements AgentBuilder.LocationStrategy {
public ClassFileLocator classFileLocator(ClassLoader classLoader) {
return classFileLocator(classLoader, null);
}

@Override
public ClassFileLocator classFileLocator(ClassLoader classLoader, final JavaModule javaModule) {
final List<ClassFileLocator> locators = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,11 @@ public Method merge(Method anotherMethod) {
public String toString() {
// <init>()V
// toString()Ljava/lang/String;
return name
+ Type.getMethodType(returnType, parameterTypes.toArray(new Type[0])).getDescriptor();
return name + getDescriptor();
}

public String getDescriptor() {
return Type.getMethodType(returnType, parameterTypes.toArray(new Type[0])).getDescriptor();
}

@Override
Expand Down

0 comments on commit 0cbef2d

Please sign in to comment.