Skip to content

Commit

Permalink
[pinpoint-apm#9445] Update plugin enable option
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehong-kim committed Nov 28, 2022
1 parent 22adb82 commit cfb62fc
Show file tree
Hide file tree
Showing 30 changed files with 256 additions and 151 deletions.
13 changes: 13 additions & 0 deletions agent/src/main/resources/profiles/local/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ profiler.spring.data.r2dbc.enable=true
###########################################################
# Apache HTTP Client 3.x #
###########################################################
profiler.apache.httpclient3.enable=true
# Record Parameter.
profiler.apache.httpclient3.param=true

Expand Down Expand Up @@ -798,6 +799,7 @@ profiler.apache.httpclient3.io=true
###########################################################
# Apache HTTP Client 4.x #
###########################################################
profiler.apache.httpclient4.enable=true
# Record Parameter.
profiler.apache.httpclient4.param=true

Expand Down Expand Up @@ -929,6 +931,7 @@ profiler.memcached.keytrace=true
# Thrift #
###########################################################
# Profile Thrift
profiler.thrift.enable=true
profiler.thrift.client=true
profiler.thrift.client.async=true
# Profile processor.
Expand Down Expand Up @@ -1051,6 +1054,12 @@ profiler.spring.webflux.client.cookie.sampling.rate=1
# Cookie dump size.
profiler.spring.webflux.client.cookie.dumpsize=1024

###########################################################
# Spring WebMVC
###########################################################
profiler.spring.webmvc.enable=true


###########################################################
# Reactor
###########################################################
Expand Down Expand Up @@ -1123,6 +1132,7 @@ profiler.okhttp.async=true
# Note: logging.enable must use cxf logging
# see http://cxf.apache.org/docs/message-logging.html
###########################################################
profiler.cxf.enable=true
profiler.cxf.service.enable=true
profiler.cxf.logging.enable=true

Expand Down Expand Up @@ -1219,6 +1229,7 @@ profiler.akka.http.transform.targetparameter=scala.Function1,scala.Function1,akk
# Version 0.11+ is supported.
# Please read `readme.md` in Kafka Plugin, before use Kafka Plugin (https://github.com/naver/pinpoint/tree/master/plugins/kafka/README.md)
###########################################################
profiler.kafka.enable=true
profiler.kafka.producer.enable=false
profiler.kafka.consumer.enable=false
# Setting when using spring-kafka (In this case, you can leave profiler.kafka.consumer.entryPoint option to empty.)
Expand Down Expand Up @@ -1281,6 +1292,7 @@ profiler.jdk.concurrent.completable-future=true
###########################################################
# Thread
###########################################################
profiler.thread.enable=true
# which package of runnable(callable) instance can be thread plugin trace
# Set the package name to track
# eg) profiler.thread.match.package=com.company.shopping.cart, com.company.payment
Expand Down Expand Up @@ -1310,6 +1322,7 @@ profiler.paho.mqtt.client.subscriber.enable=true
# RocketMQ (Reliability and stability can not be guaranteed)
# Version 4.x is supported.
###########################################################
profiler.rocketmq.enable=true
profiler.rocketmq.producer.enable=false
profiler.rocketmq.consumer.enable=false
# Comma separated list of package names
Expand Down
13 changes: 13 additions & 0 deletions agent/src/main/resources/profiles/release/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ profiler.spring.data.r2dbc.enable=true
###########################################################
# Apache HTTP Client 3.x #
###########################################################
profiler.apache.httpclient3.enable=true
# Record Parameter.
profiler.apache.httpclient3.param=true

Expand Down Expand Up @@ -794,6 +795,7 @@ profiler.apache.httpclient3.io=true
###########################################################
# Apache HTTP Client 4.x #
###########################################################
profiler.apache.httpclient4.enable=true
# Record Parameter.
profiler.apache.httpclient4.param=true

Expand Down Expand Up @@ -925,6 +927,7 @@ profiler.memcached.keytrace=false
# Thrift #
###########################################################
# Profile Thrift
profiler.thrift.enable=true
profiler.thrift.client=true
profiler.thrift.client.async=true
# Profile processor.
Expand Down Expand Up @@ -1047,6 +1050,12 @@ profiler.spring.webflux.client.cookie.sampling.rate=1
# Cookie dump size.
profiler.spring.webflux.client.cookie.dumpsize=1024

###########################################################
# Spring WebMVC
###########################################################
profiler.spring.webmvc.enable=true


###########################################################
# Reactor
###########################################################
Expand Down Expand Up @@ -1145,6 +1154,7 @@ profiler.okhttp.entity.statuscode=true
# Note: logging.enable must use cxf logging
# see http://cxf.apache.org/docs/message-logging.html
###########################################################
profiler.cxf.enable=true
profiler.cxf.service.enable=true
profiler.cxf.logging.enable=false

Expand Down Expand Up @@ -1242,6 +1252,7 @@ profiler.akka.http.transform.targetparameter=scala.Function1,scala.Function1,akk
# Version 0.11+ is supported.
# Please read `readme.md` in Kafka Plugin, before use Kafka Plugin (https://github.com/naver/pinpoint/tree/master/plugins/kafka/README.md)
###########################################################
profiler.kafka.enable=true
profiler.kafka.producer.enable=false
profiler.kafka.consumer.enable=false
# Setting when using spring-kafka (In this case, you can leave profiler.kafka.consumer.entryPoint option to empty.)
Expand Down Expand Up @@ -1304,6 +1315,7 @@ profiler.jdk.concurrent.completable-future=true
###########################################################
# Thread
###########################################################
profiler.thread.enable=true
# which package of runnable(callable) instance can be thread plugin trace
# Set the package name to track
# eg) profiler.thread.match.package=com.company.shopping.cart, com.company.payment
Expand Down Expand Up @@ -1333,6 +1345,7 @@ profiler.paho.mqtt.client.subscriber.enable=true
# RocketMQ (Reliability and stability can not be guaranteed)
# Version 4.x is supported.
###########################################################
profiler.rocketmq.enable=true
profiler.rocketmq.producer.enable=false
profiler.rocketmq.consumer.enable=false
# Comma separated list of package names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class AgentSdkAsyncPlugin implements ProfilerPlugin, TransformTemplateAwa
public void setup(ProfilerPluginSetupContext context) {
AgentSdkAsyncConfig agentSdkAsyncConfig = new AgentSdkAsyncConfig(context.getConfig());
if (!agentSdkAsyncConfig.isEnable()) {
logger.info("AgentSdkAsyncConfig is disable");
logger.info("{} disabled", this.getClass().getSimpleName());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -55,6 +55,10 @@ public class ArcusPlugin implements ProfilerPlugin, TransformTemplateAware {
@Override
public void setup(ProfilerPluginSetupContext context) {
final ArcusPluginConfig config = new ArcusPluginConfig(context.getConfig());
if (Boolean.FALSE == config.isArcus() && Boolean.FALSE == config.isMemcached()) {
logger.info("{} disabled", this.getClass().getSimpleName());
return;
}
logger.info("{} config:{}", this.getClass().getSimpleName(), config);

final boolean arcus = config.isArcus();
Expand Down Expand Up @@ -94,6 +98,7 @@ private void addArcusClientEditor(final ArcusPluginConfig config) {

public static class ArcusClientTransform implements TransformCallback {
private final PLogger logger = PLoggerFactory.getLogger(this.getClass());

@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);
Expand Down Expand Up @@ -138,7 +143,6 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

return target.toBytecode();
}

}

private void addBaseOperationImplEditor() {
Expand All @@ -153,7 +157,6 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin
target.addField(ServiceCodeAccessor.class);
return target.toBytecode();
}

}

private void addFrontCacheGetFutureEditor() {
Expand All @@ -180,7 +183,6 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

return target.toBytecode();
}

}

private void addFrontCacheMemcachedClientEditor(final ArcusPluginConfig config) {
Expand Down Expand Up @@ -209,7 +211,6 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

return target.toBytecode();
}

}

private void addMemcachedClientEditor(final ArcusPluginConfig config) {
Expand Down Expand Up @@ -244,7 +245,6 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

return target.toBytecode();
}

}

public static class FutureTransform implements TransformCallback {
Expand All @@ -269,7 +269,7 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

return target.toBytecode();
}
};
}

public static class FutureSetOperationTransform implements TransformCallback {

Expand All @@ -286,7 +286,7 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin

return target.toBytecode();
}
};
}

public static class InternalFutureTransform implements TransformCallback {

Expand All @@ -295,16 +295,15 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

target.addField(AsyncContextAccessor.class);

// cancel, get, set
for (InstrumentMethod m : target.getDeclaredMethods(MethodFilters.name("cancel", "get"))) {
m.addScopedInterceptor(FutureInternalMethodInterceptor.class, ArcusConstants.ARCUS_FUTURE_SCOPE);
}

return target.toBytecode();
}
};

}

private void addCollectionFutureEditor(boolean async) {
if (async) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class CxfPlugin implements ProfilerPlugin, TransformTemplateAware {
@Override
public void setup(ProfilerPluginSetupContext context) {
CxfPluginConfig config = new CxfPluginConfig(context.getConfig());
if (Boolean.FALSE == config.isEnable()) {
logger.info("{} disabled", this.getClass().getSimpleName());
return;
}
logger.info("{} config:{}", this.getClass().getSimpleName(), config);

if (config.isServiceProfile()) {
Expand Down Expand Up @@ -78,8 +82,8 @@ public static class ServiceInvokerInterceptorTransformer implements TransformCal

@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {

InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

Expand All @@ -95,8 +99,8 @@ public static class MessageSenderInterceptorTransform implements TransformCallba

@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {

InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);

Expand All @@ -121,8 +125,8 @@ public static class LoggingInInterceptorTransform implements TransformCallback {

@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {

InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);

Expand All @@ -138,8 +142,8 @@ public static class LoggingOutInterceptorTransform implements TransformCallback

@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {

InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);

Expand All @@ -166,8 +170,8 @@ public static class ClientProxyTransform implements TransformCallback {

@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);

// invokeSyncMethod
Expand All @@ -178,12 +182,12 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader,
}
}

public static class MessageSenderEndingInterceptorTransform implements TransformCallback {
public static class MessageSenderEndingInterceptorTransform implements TransformCallback {

@Override
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws InstrumentException {
InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);

// handleMessageMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
public class CxfPluginConfig {

private final boolean enable;
private final boolean serviceProfile;

private final boolean loggingProfile;
Expand All @@ -45,12 +46,17 @@ public class CxfPluginConfig {
* @param src the src
*/
public CxfPluginConfig(ProfilerConfig src) {
this.enable = src.readBoolean("profiler.cxf.enable", true);
this.serviceProfile = src.readBoolean("profiler.cxf.service.enable", false);
this.loggingProfile = src.readBoolean("profiler.cxf.logging.enable", false);
this.clientProfile = src.readBoolean("profiler.cxf.client", false);
this.clientHiddenParams = getStringArray(src.readString("profiler.cxf.client.hiddenParams", ""));
}

public boolean isEnable() {
return enable;
}

public boolean isServiceProfile() {
return serviceProfile;
}
Expand Down Expand Up @@ -89,16 +95,12 @@ private String[] toStringArray(List<String> list) {

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CxfPluginConfig [serviceProfile=");
builder.append(serviceProfile);
builder.append(", loggingProfile=");
builder.append(loggingProfile);
builder.append(", clientProfile(Deprecated)=");
builder.append(clientProfile);
builder.append(", clientHiddenParams(Deprecated)=");
builder.append(Arrays.toString(clientHiddenParams));
builder.append("]");
return builder.toString();
return "CxfPluginConfig{" +
"enable=" + enable +
", serviceProfile=" + serviceProfile +
", loggingProfile=" + loggingProfile +
", clientProfile=" + clientProfile +
", clientHiddenParams=" + Arrays.toString(clientHiddenParams) +
'}';
}
}
Loading

0 comments on commit cfb62fc

Please sign in to comment.