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

[#10643] Change behavior of disable option #10645

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions agent/src/main/resources/pinpoint-root.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# - -Dpinpoint.config=$MY_CONFIG_PATH/pinpoint.config
pinpoint.profiler.profiles.active=release

# Pinpoint Disable (default : false)
# Using VM option or environmental variable will disable Pinpoint agent more strictly
pinpoint.disable=false

# GRPC or THRIFT
profiler.transport.module=GRPC
###########################################################
Expand Down Expand Up @@ -131,8 +135,6 @@ profiler.system.property.io.netty.noPreferDirect=false
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
5 changes: 3 additions & 2 deletions agent/src/main/resources/profiles/local/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# Support external property
# - -Dpinpoint.config=$MY_CONFIG_PATH/pinpoint.config

# pinpoint disable (default : false)
# Using VM option or environmental variable will disable Pinpoint agent more strictly
pinpoint.disable=false

# GRPC or THRIFT
profiler.transport.module=GRPC
Expand All @@ -23,8 +26,6 @@ profiler.transport.grpc.collector.ip=127.0.0.1
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
5 changes: 3 additions & 2 deletions agent/src/main/resources/profiles/release/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# Support external property
# - -Dpinpoint.config=$MY_CONFIG_PATH/pinpoint.config

# Pinpoint Disable (default : false)
# Using VM option or environmental variable will disable Pinpoint agent more strictly
pinpoint.disable=false

# GRPC or THRIFT
profiler.transport.module=GRPC
Expand All @@ -22,8 +25,6 @@ profiler.transport.grpc.collector.ip=127.0.0.1
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

private static final TransportModule DEFAULT_TRANSPORT_MODULE = TransportModule.GRPC;

@Value("${profiler.enable:true}")
private boolean profileEnable = false;
@Value("${pinpoint.disable:false}")
private String pinpointDisable = "false";

@Value("${profiler.logdir.maxbackupsize}")
private int logDirMaxBackupSize = 5;
Expand Down Expand Up @@ -114,11 +114,9 @@
this.transportModule = TransportModule.parse(transportModule, DEFAULT_TRANSPORT_MODULE);
}



@Override
public boolean isProfileEnable() {
return profileEnable;
public String getPinpointDisable() {
return pinpointDisable;

Check warning on line 119 in bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java

View check run for this annotation

Codecov / codecov/patch

bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java#L119

Added line #L119 was not covered by tests
}

@Override
Expand Down Expand Up @@ -275,7 +273,7 @@

@Override
public String toString() {
return "DefaultProfilerConfig{" + "profileEnable='" + profileEnable + '\'' +
return "DefaultProfilerConfig{" + "pinpointDisable='" + pinpointDisable + '\'' +

Check warning on line 276 in bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java

View check run for this annotation

Codecov / codecov/patch

bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/config/DefaultProfilerConfig.java#L276

Added line #L276 was not covered by tests
", activeProfile=" + activeProfile +
", logDirMaxBackupSize=" + logDirMaxBackupSize +
", staticResourceCleanup=" + staticResourceCleanup +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public interface ProfilerConfig {

TransportModule getTransportModule();


boolean isProfileEnable();
String getPinpointDisable();

int getJdbcSqlCacheSize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ private Profiles() {
public static final String LOG_CONFIG_LOCATION_KEY = "pinpoint.profiler.log.config.location";

public static final String CONFIG_LOAD_MODE_KEY = "pinpoint.config.load.mode";

public enum CONFIG_LOAD_MODE {
PROFILE,
// for IT TEST
Expand All @@ -38,7 +39,6 @@ public enum CONFIG_LOAD_MODE {
public static final String CONFIG_FILE_NAME = "pinpoint-root.config";
// 2. profile config
public static final String PROFILE_CONFIG_FILE_NAME = "pinpoint.config";

// 3. external config
public static final String EXTERNAL_CONFIG_KEY = "pinpoint.config";
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@
}

private static boolean disabled() {
final String env = System.getenv("PINPOINT_DISABLE");
final String prop = System.getProperty("pinpoint.disable");
return env != null || prop != null;
final String disable = prop != null ? prop : System.getenv("PINPOINT_DISABLE");

return (disable != null) && !disable.equalsIgnoreCase("false");
}

private final String agentArgs;
Expand Down Expand Up @@ -115,7 +116,6 @@
}



private ModuleBootLoader loadModuleBootLoader(Instrumentation instrumentation, ClassLoader parentClassLoader) {
if (!ModuleUtils.isModuleSupported()) {
return null;
Expand All @@ -131,7 +131,7 @@
try {
AgentDirectory agentDir = classPathResolver.resolve();
return agentDir;
} catch(Exception e) {
} catch (Exception e) {

Check warning on line 134 in bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointBootStrap.java

View check run for this annotation

Codecov / codecov/patch

bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointBootStrap.java#L134

Added line #L134 was not covered by tests
logger.warn("AgentDir resolve fail Caused by:" + e.getMessage(), e);
return null;
}
Expand All @@ -141,7 +141,7 @@
private ClassLoader getParentClassLoader() {
final ClassLoader classLoader = getPinpointBootStrapClassLoader();
if (classLoader == Object.class.getClassLoader()) {
logger.info("parentClassLoader:BootStrapClassLoader:" + classLoader );
logger.info("parentClassLoader:BootStrapClassLoader:" + classLoader);

Check warning on line 144 in bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointBootStrap.java

View check run for this annotation

Codecov / codecov/patch

bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointBootStrap.java#L144

Added line #L144 was not covered by tests
} else {
logger.info("parentClassLoader:" + classLoader);
}
Expand Down Expand Up @@ -171,7 +171,6 @@
}



private static void logPinpointAgentLoadFail() {
final String errorLog =
"*****************************************************************************\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

/**
* @author Jongho Moon
*
*/
class PinpointStarter {

Expand Down Expand Up @@ -118,6 +117,10 @@
final Properties properties = loadProperties();

ProfilerConfig profilerConfig = ProfilerConfigLoader.load(properties);
if (!profilerConfig.getPinpointDisable().equalsIgnoreCase("false")) {
this.logger.warn("value of disable property is not false, pinpoint.disable=" + profilerConfig.getPinpointDisable());
return false;

Check warning on line 122 in bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java

View check run for this annotation

Codecov / codecov/patch

bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java#L121-L122

Added lines #L121 - L122 were not covered by tests
}

// set the path of log file as a system property
saveAgentIdForLog(agentIds);
Expand Down Expand Up @@ -328,15 +331,15 @@
// pinpoint module first
for (Path path : releaseLib) {
Path fileName = path.getFileName();
if(fileName != null) {
if (fileName != null) {
if (fileName.startsWith(PINPOINT_PREFIX)) {
orderList.add(path);
}
}
}
for (Path path : releaseLib) {
Path fileName = path.getFileName();
if(fileName != null) {
if (fileName != null) {
if (!fileName.startsWith(PINPOINT_PREFIX)) {
orderList.add(path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.interceptorregistry.size=8192
profiler.jvm.collect.interval=1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.interceptorregistry.size=8192
profiler.jvm.collect.interval=1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ profiler.profiles.active=local
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.interceptorregistry.size=8192

# Manually override jvm vendor name (Oracle, IBM, OpenJDK, etc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
2 changes: 0 additions & 2 deletions plugins-it/jtds-it/src/test/resources/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

# Application namespace
# Differentiate from external pinpoint agents. (e.g., com.pinpoint)
profiler.application.namespace=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.jvm.collect.interval=1000

profiler.sampling.enable=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
###########################################################
# Profiler Global Configuration #
###########################################################
profiler.enable=true

profiler.interceptorregistry.size=8192

# Manually override jvm vendor name (Oracle, IBM, OpenJDK, etc)
Expand Down
Loading
Loading