Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change accessor class name. #1334

Merged
merged 10 commits into from
Dec 8, 2015
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void addCacheManagerEditor() {
@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
target.addField(ServiceCodeAccessor.class.getName());
target.addField("com.navercorp.pinpoint.plugin.arcus.ServiceCodeAccessor");
target.addInterceptor("com.navercorp.pinpoint.plugin.arcus.interceptor.CacheManagerConstructInterceptor");
return target.toBytecode();
}
Expand All @@ -126,7 +126,7 @@ private void addBaseOperationImplEditor() {
@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
target.addField(ServiceCodeAccessor.class.getName());
target.addField("com.navercorp.pinpoint.plugin.arcus.ServiceCodeAccessor");
return target.toBytecode();
}

Expand All @@ -140,8 +140,8 @@ private void addFrontCacheGetFutureEditor() {
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

target.addField(CacheNameAccessor.class.getName());
target.addField(CacheKeyAccessor.class.getName());
target.addField("com.navercorp.pinpoint.plugin.arcus.CacheNameAccessor");
target.addField("com.navercorp.pinpoint.plugin.arcus.CacheKeyAccessor");
target.addInterceptor("com.navercorp.pinpoint.plugin.arcus.interceptor.FrontCacheGetFutureConstructInterceptor");

InstrumentMethod get0 = target.getDeclaredMethod("get", new String[]{"long", "java.util.concurrent.TimeUnit"});
Expand Down Expand Up @@ -188,7 +188,7 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

if (target.hasDeclaredMethod("addOp", new String[]{"java.lang.String", "net.spy.memcached.ops.Operation"})) {
target.addField(ServiceCodeAccessor.class.getName());
target.addField("com.navercorp.pinpoint.plugin.arcus.ServiceCodeAccessor");
target.addInterceptor("com.navercorp.pinpoint.plugin.arcus.interceptor.AddOpInterceptor");
}

Expand Down Expand Up @@ -216,7 +216,7 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

target.addField(OperationAccessor.class.getName());
target.addField("com.navercorp.pinpoint.plugin.arcus.OperationAccessor");
target.addField(AsyncTraceIdAccessor.class.getName());

// setOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ private void addHttpConnectionClass() {
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

target.addGetter(HostNameGetter.class.getName(), HttpClient3Constants.FIELD_HOST_NAME);
target.addGetter(PortNumberGetter.class.getName(), HttpClient3Constants.FIELD_PORT_NUMBER);
target.addGetter(ProxyHostNameGetter.class.getName(), HttpClient3Constants.FIELD_PROXY_HOST_NAME);
target.addGetter(ProxyPortNumberGetter.class.getName(), HttpClient3Constants.FIELD_PROXY_PORT_NUMBER);
target.addGetter("com.navercorp.pinpoint.plugin.httpclient3.HostNameGetter", HttpClient3Constants.FIELD_HOST_NAME);
target.addGetter("com.navercorp.pinpoint.plugin.httpclient3.PortNumberGetter", HttpClient3Constants.FIELD_PORT_NUMBER);
target.addGetter("com.navercorp.pinpoint.plugin.httpclient3.ProxyHostNameGetter", HttpClient3Constants.FIELD_PROXY_HOST_NAME);
target.addGetter("com.navercorp.pinpoint.plugin.httpclient3.ProxyPortNumberGetter", HttpClient3Constants.FIELD_PROXY_PORT_NUMBER);

InstrumentMethod open = target.getDeclaredMethod("open");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ private HttpClient4Constants() {
public static final ServiceType HTTP_CLIENT_4 = ServiceTypeFactory.of(9052, "HTTP_CLIENT_4", RECORD_STATISTICS);
public static final ServiceType HTTP_CLIENT_4_INTERNAL = ServiceTypeFactory.of(9053, "HTTP_CLIENT_4_INTERNAL", "HTTP_CLIENT_4");

public static final String METADATA_END_POINT = "endPoint";
public static final String METADATA_DESTINATION_ID = "destinationId";
public static final String METADATA_ASYNC_TRACE_ID = "asyncTraceId";
public static final String FIELD_REQUEST_PRODUCER = "requestProducer";
public static final String FIELD_RESULT_FUTURE = "resultFuture";

public static final String HTTP_CLIENT4_SCOPE = "HttpClient4Scope";
public static final String HTTP_CLIENT4_EXECUTOR_SCOPE = "HttpClient4ExecutorScope";
}
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ private void addDefaultClientExchangeHandlerImplClass() {
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

target.addGetter(RequestProducerGetter.class.getName(), HttpClient4Constants.FIELD_REQUEST_PRODUCER);
target.addGetter(ResultFutureGetter.class.getName(), HttpClient4Constants.FIELD_RESULT_FUTURE);
target.addGetter("com.navercorp.pinpoint.plugin.httpclient4.RequestProducerGetter", HttpClient4Constants.FIELD_REQUEST_PRODUCER);
target.addGetter("com.navercorp.pinpoint.plugin.httpclient4.ResultFutureGetter", HttpClient4Constants.FIELD_RESULT_FUTURE);

InstrumentMethod start = target.getDeclaredMethod("start");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public void setup(ProfilerPluginSetupContext context) {
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

target.addGetter(ConnectedGetter.class.getName(), "connected");
target.addGetter("com.navercorp.pinpoint.plugin.jdk.http.ConnectedGetter", "connected");

if (target.hasField("connecting", "boolean")) {
target.addGetter(ConnectingGetter.class.getName(), "connecting");
target.addGetter("com.navercorp.pinpoint.plugin.jdk.http.ConnectingGetter", "connecting");
}

target.addInterceptor("com.navercorp.pinpoint.plugin.jdk.http.interceptor.HttpURLConnectionInterceptor");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ private OkHttpConstants() {
public static final String FIELD_USER_RESPONSE = "userResponse";
public static final String FIELD_CONNECTION = "connection";
public static final String FIELD_HTTP_URL = "url";

public static final String CONNECTION_GETTER = "com.navercorp.pinpoint.plugin.okhttp.ConnectionGetter";
public static final String HTTP_URL_GETTER = "com.navercorp.pinpoint.plugin.okhttp.HttpUrlGetter";
public static final String URL_GETTER = "com.navercorp.pinpoint.plugin.okhttp.UrlGetter";
public static final String USER_REQUEST_GETTER = "com.navercorp.pinpoint.plugin.okhttp.UserRequestGetter";
public static final String USER_RESPONSE_GETTER = "com.navercorp.pinpoint.plugin.okhttp.UserResponseGetter";
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ private void addHttpEngine(final OkHttpPluginConfig config) {
@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
target.addGetter(UserRequestGetter.class.getName(), OkHttpConstants.FIELD_USER_REQUEST);
target.addGetter(UserResponseGetter.class.getName(), OkHttpConstants.FIELD_USER_RESPONSE);
target.addGetter(ConnectionGetter.class.getName(), OkHttpConstants.FIELD_CONNECTION);
target.addGetter(OkHttpConstants.USER_REQUEST_GETTER, OkHttpConstants.FIELD_USER_REQUEST);
target.addGetter(OkHttpConstants.USER_RESPONSE_GETTER, OkHttpConstants.FIELD_USER_RESPONSE);
target.addGetter(OkHttpConstants.CONNECTION_GETTER, OkHttpConstants.FIELD_CONNECTION);

InstrumentMethod sendRequestMethod = target.getDeclaredMethod("sendRequest");
if (sendRequestMethod != null) {
Expand Down Expand Up @@ -159,11 +159,11 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

if(instrumentor.exist(loader, "com.squareup.okhttp.HttpUrl")) {
// over 2.4.0
target.addGetter(HttpUrlGetter.class.getName(), OkHttpConstants.FIELD_HTTP_URL);
target.addGetter(OkHttpConstants.HTTP_URL_GETTER, OkHttpConstants.FIELD_HTTP_URL);
buildMethod.addInterceptor("com.navercorp.pinpoint.plugin.okhttp.interceptor.RequestBuilderBuildMethodInterceptor");
} else {
// 2.0 ~ 2.3
target.addGetter(UrlGetter.class.getName(), OkHttpConstants.FIELD_HTTP_URL);
target.addGetter(OkHttpConstants.URL_GETTER, OkHttpConstants.FIELD_HTTP_URL);
buildMethod.addInterceptor("com.navercorp.pinpoint.plugin.okhttp.interceptor.RequestBuilderBuildMethodBackwardCompatibilityInterceptor");
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ private RedisConstants() {

public static final ServiceType REDIS = ServiceTypeFactory.of(8200, "REDIS", TERMINAL, RECORD_STATISTICS);
public static final String REDIS_SCOPE = "redisScope";

public static final String END_POINT_ACCESSOR = "com.navercorp.pinpoint.plugin.redis.EndPointAccessor";

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void addJedisClassEditors(RedisPluginConfig config) {

@Override
public void handle(InstrumentClass target) throws InstrumentException {
target.addField(EndPointAccessor.class.getName());
target.addField(RedisConstants.END_POINT_ACCESSOR);
}
});

Expand Down Expand Up @@ -129,7 +129,7 @@ private void addJedisClientClassEditor() {
@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);
target.addField(EndPointAccessor.class.getName());
target.addField(RedisConstants.END_POINT_ACCESSOR);

final InstrumentMethod constructorEditorBuilderArg1 = target.getConstructor("java.lang.String");
if (constructorEditorBuilderArg1 != null) {
Expand Down Expand Up @@ -174,7 +174,7 @@ private void addJedisPipelineClassEditors(RedisPluginConfig config) {

@Override
public void handle(InstrumentClass target) throws InstrumentException {
target.addField(EndPointAccessor.class.getName());
target.addField(RedisConstants.END_POINT_ACCESSOR);

final InstrumentMethod setClientMethodEditorBuilder = target.getDeclaredMethod("setClient", "redis.clients.jedis.Client");
if (setClientMethodEditorBuilder != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ public final class TomcatConstants {
private TomcatConstants() {
}

public static final String TYPE_NAME = "TOMCAT";
public static final ServiceType TOMCAT = ServiceTypeFactory.of(1010, "TOMCAT", RECORD_STATISTICS);
public static final ServiceType TOMCAT_METHOD = ServiceTypeFactory.of(1011, "TOMCAT_METHOD");

public static final String ATTRIBUTE_PINPOINT_TRACE = "PINPOINT_TRACE";
public static final String TOMCAT_SERVLET_ASYNC_SCOPE = "TomcatServletAsyncScope";

public static final String ASYNC_ACCESSOR = "com.navercorp.pinpoint.plugin.tomcat.AsyncAccessor";
public static final String TRACE_ACCESSOR = "com.navercorp.pinpoint.plugin.tomcat.TraceAccessor";

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ private void addRequestEditor() {
@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);
target.addField(TraceAccessor.class.getName());
target.addField(AsyncAccessor.class.getName());
target.addField(TomcatConstants.TRACE_ACCESSOR);
target.addField(TomcatConstants.ASYNC_ACCESSOR);

// clear request.
InstrumentMethod recycleMethodEditorBuilder = target.getDeclaredMethod("recycle");
Expand Down