Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove AgentInstaller code
  • Loading branch information
Mariovido committed Nov 8, 2024
commit 453d57b54f31efa4a9568b25c746e274d608ba35
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter;
import datadog.trace.util.AgentTaskScheduler;
import de.thetaphi.forbiddenapis.SuppressForbidden;
import java.io.File;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
import java.util.Collections;
Expand All @@ -43,7 +42,6 @@
import net.bytebuddy.dynamic.scaffold.MethodGraph;
import net.bytebuddy.matcher.LatentMatcher;
import net.bytebuddy.utility.JavaModule;
import net.bytebuddy.utility.nullability.MaybeNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -155,57 +153,6 @@ public static ClassFileTransformer installBytebuddyAgent(
.with(AgentStrategies.bufferStrategy())
.with(AgentStrategies.typeStrategy())
.with(new ClassLoadListener())
.with(
new AgentBuilder.Listener.Adapter() {
@Override
public void onTransformation(
TypeDescription typeDescription,
ClassLoader classLoader,
JavaModule module,
boolean loaded,
DynamicType dynamicType) {
try {
if (typeDescription
.getName()
.equals("org.apache.hc.core5.http.message.LineFormatter")) {
//
// Utils.getInstrumentation().retransformClasses(Class.forName("org.apache.hc.core5.http.message.BasicHttpRequest", true, classLoader));
}
dynamicType.saveIn(new File("/Users/mario.vidal/Documents/instrumentations"));
} catch (Throwable e) {
throw new RuntimeException(e);
}
}

@Override
public void onDiscovery(
String typeName,
@MaybeNull ClassLoader classLoader,
@MaybeNull JavaModule module,
boolean loaded) {
super.onDiscovery(typeName, classLoader, module, loaded);
}

@Override
public void onIgnored(
TypeDescription typeDescription,
@MaybeNull ClassLoader classLoader,
@MaybeNull JavaModule module,
boolean loaded) {
super.onIgnored(typeDescription, classLoader, module, loaded);
}

@Override
public void onError(
String typeName,
ClassLoader classLoader,
JavaModule module,
boolean loaded,
Throwable throwable) {
super.onError(typeName, classLoader, module, loaded, throwable);
}
})

// FIXME: we cannot enable it yet due to BB/JVM bug, see
// https://github.com/raphw/byte-buddy/issues/558
// .with(AgentBuilder.LambdaInstrumentationStrategy.ENABLED)
Expand Down