diff --git a/components/environment/src/main/java/datadog/environment/CommandLine.java b/components/environment/src/main/java/datadog/environment/CommandLine.java index cb427bf49e0..e3b87e18b4b 100644 --- a/components/environment/src/main/java/datadog/environment/CommandLine.java +++ b/components/environment/src/main/java/datadog/environment/CommandLine.java @@ -24,7 +24,7 @@ */ class CommandLine { private static final String SUN_JAVA_COMMAND_PROPERTY = "sun.java.command"; - final List fullCommand = findFullCommand(); + private final List fullCommand = findFullCommand(); final String name = getCommandName(); final List arguments = getCommandArguments(); @@ -35,14 +35,14 @@ private List findFullCommand() { } private String getCommandName() { - return fullCommand.isEmpty() ? null : fullCommand.get(0); + return this.fullCommand.isEmpty() ? null : this.fullCommand.get(0); } private List getCommandArguments() { - if (fullCommand.isEmpty()) { - return fullCommand; + if (this.fullCommand.isEmpty()) { + return this.fullCommand; } else { - return fullCommand.subList(1, fullCommand.size()); + return this.fullCommand.subList(1, this.fullCommand.size()); } } } diff --git a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java index b4b6dee02fa..50e0a4acaca 100644 --- a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java +++ b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java @@ -3,9 +3,13 @@ import static datadog.environment.JavaVirtualMachine.isJavaVersionAtLeast; import static datadog.environment.JavaVirtualMachine.isOracleJDK8; import static datadog.trace.api.ConfigDefaults.DEFAULT_STARTUP_LOGS_ENABLED; +import static datadog.trace.api.config.GeneralConfig.DATA_JOBS_COMMAND_PATTERN; +import static datadog.trace.api.config.GeneralConfig.DATA_JOBS_ENABLED; import static datadog.trace.api.telemetry.LogCollector.SEND_TELEMETRY; import static datadog.trace.bootstrap.Library.WILDFLY; import static datadog.trace.bootstrap.Library.detectLibraries; +import static datadog.trace.bootstrap.config.provider.StableConfigSource.FLEET; +import static datadog.trace.bootstrap.config.provider.StableConfigSource.LOCAL; import static datadog.trace.util.AgentThreadFactory.AgentThread.JMX_STARTUP; import static datadog.trace.util.AgentThreadFactory.AgentThread.PROFILER_STARTUP; import static datadog.trace.util.AgentThreadFactory.AgentThread.TRACE_STARTUP; @@ -13,8 +17,10 @@ import static datadog.trace.util.Strings.propertyNameToSystemPropertyName; import static datadog.trace.util.Strings.toEnvVar; +import datadog.environment.EnvironmentVariables; import datadog.environment.JavaVirtualMachine; import datadog.environment.OperatingSystem; +import datadog.environment.SystemProperties; import datadog.trace.api.Config; import datadog.trace.api.Platform; import datadog.trace.api.StatsDClientManager; @@ -210,81 +216,18 @@ public static void start( injectAgentArgsConfig(agentArgs); } - // Retro-compatibility for the old way to configure CI Visibility - if ("true".equals(ddGetProperty("dd.integration.junit.enabled")) - || "true".equals(ddGetProperty("dd.integration.testng.enabled"))) { - setSystemPropertyDefault(AgentFeature.CIVISIBILITY.getSystemProp(), "true"); - } - - ciVisibilityEnabled = isFeatureEnabled(AgentFeature.CIVISIBILITY); - if (ciVisibilityEnabled) { - // if CI Visibility is enabled, all the other features are disabled by default - // unless the user had explicitly enabled them. - setSystemPropertyDefault(AgentFeature.JMXFETCH.getSystemProp(), "false"); - setSystemPropertyDefault(AgentFeature.PROFILING.getSystemProp(), "false"); - setSystemPropertyDefault(AgentFeature.APPSEC.getSystemProp(), "false"); - setSystemPropertyDefault(AgentFeature.IAST.getSystemProp(), "false"); - setSystemPropertyDefault(AgentFeature.REMOTE_CONFIG.getSystemProp(), "false"); - setSystemPropertyDefault(AgentFeature.CWS.getSystemProp(), "false"); - - /*if CI Visibility is enabled, the PrioritizationType should be {@code Prioritization.ENSURE_TRACE} */ - setSystemPropertyDefault( - propertyNameToSystemPropertyName(TracerConfig.PRIORITIZATION_TYPE), "ENSURE_TRACE"); - - try { - setSystemPropertyDefault( - propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_AGENT_JAR_URI), - agentJarURL.toURI().toString()); - } catch (URISyntaxException e) { - throw new IllegalArgumentException( - "Could not create URI from agent JAR URL: " + agentJarURL, e); - } - } - - // Enable automatic fetching of git tags from datadog_git.properties only if CI Visibility is - // not enabled - if (!ciVisibilityEnabled) { - GitInfoProvider.INSTANCE.registerGitInfoBuilder(new EmbeddedGitInfoBuilder()); - } - - boolean dataJobsEnabled = isFeatureEnabled(AgentFeature.DATA_JOBS); - if (dataJobsEnabled) { - log.info("Data Jobs Monitoring enabled, enabling spark integrations"); - - setSystemPropertyDefault( - propertyNameToSystemPropertyName(TracerConfig.TRACE_LONG_RUNNING_ENABLED), "true"); - setSystemPropertyDefault( - propertyNameToSystemPropertyName("integration.spark.enabled"), "true"); - setSystemPropertyDefault( - propertyNameToSystemPropertyName("integration.spark-executor.enabled"), "true"); - // needed for e2e pipeline - setSystemPropertyDefault(propertyNameToSystemPropertyName("data.streams.enabled"), "true"); - setSystemPropertyDefault( - propertyNameToSystemPropertyName("integration.aws-sdk.enabled"), "true"); - setSystemPropertyDefault( - propertyNameToSystemPropertyName("integration.kafka.enabled"), "true"); + configureCiVisibility(agentJarURL); - if (Config.get().isDataJobsOpenLineageEnabled()) { - setSystemPropertyDefault( - propertyNameToSystemPropertyName("integration.spark-openlineage.enabled"), "true"); - } - - String javaCommand = System.getProperty("sun.java.command"); - String dataJobsCommandPattern = Config.get().getDataJobsCommandPattern(); - if (!isDataJobsSupported(javaCommand, dataJobsCommandPattern)) { - log.warn( - "Data Jobs Monitoring is not compatible with non-spark command {} based on command pattern {}. dd-trace-java will not be installed", - javaCommand, - dataJobsCommandPattern); - return; - } + // Halt agent start if DJM is enabled and is not successfully configure + if (!configureDataJobsMonitoring()) { + return; } if (!isSupportedAppSecArch()) { log.debug( "OS and architecture ({}/{}) not supported by AppSec, dd.appsec.enabled will default to false", - System.getProperty("os.name"), - System.getProperty("os.arch")); + SystemProperties.get("os.name"), + SystemProperties.get("os.arch")); setSystemPropertyDefault(AgentFeature.APPSEC.getSystemProp(), "false"); } @@ -444,6 +387,43 @@ public static void start( StaticEventLogger.end("Agent.start"); } + private static boolean configureDataJobsMonitoring() { + boolean dataJobsEnabled = isFeatureEnabled(AgentFeature.DATA_JOBS); + if (dataJobsEnabled) { + log.info("Data Jobs Monitoring enabled, enabling spark integrations"); + + setSystemPropertyDefault( + propertyNameToSystemPropertyName(TracerConfig.TRACE_LONG_RUNNING_ENABLED), "true"); + setSystemPropertyDefault( + propertyNameToSystemPropertyName("integration.spark.enabled"), "true"); + setSystemPropertyDefault( + propertyNameToSystemPropertyName("integration.spark-executor.enabled"), "true"); + // needed for e2e pipeline + setSystemPropertyDefault(propertyNameToSystemPropertyName("data.streams.enabled"), "true"); + setSystemPropertyDefault( + propertyNameToSystemPropertyName("integration.aws-sdk.enabled"), "true"); + setSystemPropertyDefault( + propertyNameToSystemPropertyName("integration.kafka.enabled"), "true"); + + if ("true".equals(ddGetProperty(propertyNameToSystemPropertyName(DATA_JOBS_ENABLED)))) { + setSystemPropertyDefault( + propertyNameToSystemPropertyName("integration.spark-openlineage.enabled"), "true"); + } + + String javaCommand = String.join(" ", JavaVirtualMachine.getCommandArguments()); + String dataJobsCommandPattern = + ddGetProperty(propertyNameToSystemPropertyName(DATA_JOBS_COMMAND_PATTERN)); + if (!isDataJobsSupported(javaCommand, dataJobsCommandPattern)) { + log.warn( + "Data Jobs Monitoring is not compatible with non-spark command {} based on command pattern {}. dd-trace-java will not be installed", + javaCommand, + dataJobsCommandPattern); + return false; + } + } + return true; + } + private static void injectAgentArgsConfig(String agentArgs) { try { final Class agentArgsInjectorClass = @@ -456,6 +436,45 @@ private static void injectAgentArgsConfig(String agentArgs) { } } + private static void configureCiVisibility(URL agentJarURL) { + // Retro-compatibility for the old way to configure CI Visibility + if ("true".equals(ddGetProperty("dd.integration.junit.enabled")) + || "true".equals(ddGetProperty("dd.integration.testng.enabled"))) { + setSystemPropertyDefault(AgentFeature.CIVISIBILITY.getSystemProp(), "true"); + } + + ciVisibilityEnabled = isFeatureEnabled(AgentFeature.CIVISIBILITY); + if (ciVisibilityEnabled) { + // if CI Visibility is enabled, all the other features are disabled by default + // unless the user had explicitly enabled them. + setSystemPropertyDefault(AgentFeature.JMXFETCH.getSystemProp(), "false"); + setSystemPropertyDefault(AgentFeature.PROFILING.getSystemProp(), "false"); + setSystemPropertyDefault(AgentFeature.APPSEC.getSystemProp(), "false"); + setSystemPropertyDefault(AgentFeature.IAST.getSystemProp(), "false"); + setSystemPropertyDefault(AgentFeature.REMOTE_CONFIG.getSystemProp(), "false"); + setSystemPropertyDefault(AgentFeature.CWS.getSystemProp(), "false"); + + /*if CI Visibility is enabled, the PrioritizationType should be {@code Prioritization.ENSURE_TRACE} */ + setSystemPropertyDefault( + propertyNameToSystemPropertyName(TracerConfig.PRIORITIZATION_TYPE), "ENSURE_TRACE"); + + try { + setSystemPropertyDefault( + propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_AGENT_JAR_URI), + agentJarURL.toURI().toString()); + } catch (URISyntaxException e) { + throw new IllegalArgumentException( + "Could not create URI from agent JAR URL: " + agentJarURL, e); + } + } + + // Enable automatic fetching of git tags from datadog_git.properties only if CI Visibility is + // not enabled + if (!ciVisibilityEnabled) { + GitInfoProvider.INSTANCE.registerGitInfoBuilder(new EmbeddedGitInfoBuilder()); + } + } + public static void shutdown(final boolean sync) { StaticEventLogger.end("Agent"); StaticEventLogger.stop(); @@ -950,7 +969,7 @@ private static void startAppSec(SubscriptionService ss, Class scoClass, Objec } private static boolean isSupportedAppSecArch() { - final String arch = System.getProperty("os.arch"); + final String arch = SystemProperties.get("os.arch"); if (OperatingSystem.isWindows()) { // TODO: Windows bindings need to be built for x86 return "amd64".equals(arch) || "x86_64".equals(arch); @@ -1260,13 +1279,7 @@ public void withTracer(TracerAPI tracer) { } private static boolean isAwsLambdaRuntime() { - String val = System.getenv("AWS_LAMBDA_FUNCTION_NAME"); - return val != null && !val.isEmpty(); - } - - private static ScopeListener createScopeListener(String className) throws Throwable { - return (ScopeListener) - AGENT_CLASSLOADER.loadClass(className).getDeclaredConstructor().newInstance(); + return !EnvironmentVariables.getOrDefault("AWS_LAMBDA_FUNCTION_NAME", "").isEmpty(); } private static void shutdownProfilingAgent(final boolean sync) { @@ -1333,7 +1346,8 @@ private static synchronized void startDebuggerAgent( private static void configureLogger() { setSystemPropertyDefault(SIMPLE_LOGGER_SHOW_DATE_TIME_PROPERTY, "true"); setSystemPropertyDefault(SIMPLE_LOGGER_JSON_ENABLED_PROPERTY, "false"); - if (System.getProperty(SIMPLE_LOGGER_JSON_ENABLED_PROPERTY).equalsIgnoreCase("true")) { + String simpleLoggerJsonEnabled = SystemProperties.get(SIMPLE_LOGGER_JSON_ENABLED_PROPERTY); + if (simpleLoggerJsonEnabled != null && simpleLoggerJsonEnabled.equalsIgnoreCase("true")) { setSystemPropertyDefault( SIMPLE_LOGGER_DATE_TIME_FORMAT_PROPERTY, SIMPLE_LOGGER_DATE_TIME_FORMAT_JSON_DEFAULT); } else { @@ -1347,7 +1361,7 @@ private static void configureLogger() { } else { logLevel = ddGetProperty("dd.log.level"); if (null == logLevel) { - logLevel = System.getenv("OTEL_LOG_LEVEL"); + logLevel = EnvironmentVariables.get("OTEL_LOG_LEVEL"); } } @@ -1361,8 +1375,8 @@ private static void configureLogger() { } private static void setSystemPropertyDefault(final String property, final String value) { - if (System.getProperty(property) == null && ddGetEnv(property) == null) { - System.setProperty(property, value); + if (SystemProperties.get(property) == null && ddGetEnv(property) == null) { + SystemProperties.set(property, value); } } @@ -1383,7 +1397,7 @@ private static ClassLoader getPlatformClassLoader() */ private static boolean isDebugMode() { final String tracerDebugLevelSysprop = "dd.trace.debug"; - final String tracerDebugLevelProp = System.getProperty(tracerDebugLevelSysprop); + final String tracerDebugLevelProp = SystemProperties.get(tracerDebugLevelSysprop); if (tracerDebugLevelProp != null) { return Boolean.parseBoolean(tracerDebugLevelProp); @@ -1402,15 +1416,15 @@ private static boolean isFeatureEnabled(AgentFeature feature) { // must be kept in sync with logic from Config! final String featureConfigKey = feature.getConfigKey(); final String featureSystemProp = feature.getSystemProp(); - String featureEnabled = System.getProperty(featureSystemProp); + String featureEnabled = SystemProperties.get(featureSystemProp); if (featureEnabled == null) { - featureEnabled = getStableConfig(StableConfigSource.FLEET, featureConfigKey); + featureEnabled = getStableConfig(FLEET, featureConfigKey); } if (featureEnabled == null) { featureEnabled = ddGetEnv(featureSystemProp); } if (featureEnabled == null) { - featureEnabled = getStableConfig(StableConfigSource.LOCAL, featureConfigKey); + featureEnabled = getStableConfig(LOCAL, featureConfigKey); } if (feature.isEnabledByDefault()) { @@ -1432,15 +1446,15 @@ private static boolean isFullyDisabled(final AgentFeature feature) { // must be kept in sync with logic from Config! final String featureConfigKey = feature.getConfigKey(); final String featureSystemProp = feature.getSystemProp(); - String settingValue = getNullIfEmpty(System.getProperty(featureSystemProp)); + String settingValue = getNullIfEmpty(SystemProperties.get(featureSystemProp)); if (settingValue == null) { - settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.FLEET, featureConfigKey)); + settingValue = getNullIfEmpty(getStableConfig(FLEET, featureConfigKey)); } if (settingValue == null) { settingValue = getNullIfEmpty(ddGetEnv(featureSystemProp)); } if (settingValue == null) { - settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.LOCAL, featureConfigKey)); + settingValue = getNullIfEmpty(getStableConfig(LOCAL, featureConfigKey)); } // defaults to inactive @@ -1489,7 +1503,7 @@ private static int getJmxStartDelay() { */ private static boolean isAppUsingCustomLogManager(final EnumSet libraries) { final String tracerCustomLogManSysprop = "dd.app.customlogmanager"; - final String customLogManagerProp = System.getProperty(tracerCustomLogManSysprop); + final String customLogManagerProp = SystemProperties.get(tracerCustomLogManSysprop); final String customLogManagerEnv = ddGetEnv(tracerCustomLogManSysprop); if (customLogManagerProp != null || customLogManagerEnv != null) { @@ -1504,7 +1518,7 @@ private static boolean isAppUsingCustomLogManager(final EnumSet librari return true; // Wildfly is known to set a custom log manager after startup. } - final String logManagerProp = System.getProperty("java.util.logging.manager"); + final String logManagerProp = SystemProperties.get("java.util.logging.manager"); if (logManagerProp != null) { log.debug("Prop - logging.manager: {}", logManagerProp); return true; @@ -1521,7 +1535,7 @@ private static boolean isAppUsingCustomLogManager(final EnumSet librari */ private static boolean isAppUsingCustomJMXBuilder(final EnumSet libraries) { final String tracerCustomJMXBuilderSysprop = "dd.app.customjmxbuilder"; - final String customJMXBuilderProp = System.getProperty(tracerCustomJMXBuilderSysprop); + final String customJMXBuilderProp = SystemProperties.get(tracerCustomJMXBuilderSysprop); final String customJMXBuilderEnv = ddGetEnv(tracerCustomJMXBuilderSysprop); if (customJMXBuilderProp != null || customJMXBuilderEnv != null) { @@ -1536,7 +1550,7 @@ private static boolean isAppUsingCustomJMXBuilder(final EnumSet librari return true; // Wildfly is known to set a custom JMX builder after startup. } - final String jmxBuilderProp = System.getProperty("javax.management.builder.initial"); + final String jmxBuilderProp = SystemProperties.get("javax.management.builder.initial"); if (jmxBuilderProp != null) { log.debug("Prop - javax.management.builder.initial: {}", jmxBuilderProp); return true; @@ -1547,7 +1561,7 @@ private static boolean isAppUsingCustomJMXBuilder(final EnumSet librari /** Looks for the "dd." system property first then the "DD_" environment variable equivalent. */ private static String ddGetProperty(final String sysProp) { - String value = System.getProperty(sysProp); + String value = SystemProperties.get(sysProp); if (null == value) { value = ddGetEnv(sysProp); } @@ -1561,7 +1575,7 @@ private static String getStableConfig(StableConfigSource source, final String sy /** Looks for the "DD_" environment variable equivalent of the given "dd." system property. */ private static String ddGetEnv(final String sysProp) { - return System.getenv(toEnvVar(sysProp)); + return EnvironmentVariables.get(toEnvVar(sysProp)); } private static boolean okHttpMayIndirectlyLoadJUL() { diff --git a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Library.java b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Library.java index a7482cfb542..33d202f8b22 100644 --- a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Library.java +++ b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Library.java @@ -1,5 +1,6 @@ package datadog.trace.bootstrap; +import datadog.environment.EnvironmentVariables; import java.util.EnumSet; import org.slf4j.Logger; @@ -15,7 +16,7 @@ public enum Library { public static EnumSet detectLibraries(final Logger log) { final EnumSet libraries = EnumSet.noneOf(Library.class); - final String jbossHome = System.getenv("JBOSS_HOME"); + final String jbossHome = EnvironmentVariables.get("JBOSS_HOME"); if (jbossHome != null) { log.debug("Env - jboss: {}", jbossHome); libraries.add(WILDFLY); diff --git a/dd-java-agent/agent-logging/src/main/java/datadog/trace/logging/ddlogger/DDLoggerFactory.java b/dd-java-agent/agent-logging/src/main/java/datadog/trace/logging/ddlogger/DDLoggerFactory.java index 47d03e7cf9e..083d559b711 100644 --- a/dd-java-agent/agent-logging/src/main/java/datadog/trace/logging/ddlogger/DDLoggerFactory.java +++ b/dd-java-agent/agent-logging/src/main/java/datadog/trace/logging/ddlogger/DDLoggerFactory.java @@ -1,5 +1,7 @@ package datadog.trace.logging.ddlogger; +import datadog.environment.EnvironmentVariables; +import datadog.environment.SystemProperties; import datadog.trace.api.Platform; import datadog.trace.logging.LogLevel; import datadog.trace.logging.LogLevelSwitcher; @@ -99,14 +101,14 @@ && isFlagEnabled( private static boolean isFlagEnabled( final String systemProperty, final String envVar, final boolean defaultValue) { - String value = System.getProperty(systemProperty); + String value = SystemProperties.get(systemProperty); if ("true".equalsIgnoreCase(value)) { return true; } if ("false".equalsIgnoreCase(value)) { return false; } - value = System.getenv(envVar); + value = EnvironmentVariables.get(envVar); if ("true".equalsIgnoreCase(value)) { return true; } diff --git a/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java b/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java index b5926c38d93..5e8b8567849 100644 --- a/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java +++ b/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java @@ -152,16 +152,20 @@ private static void agentmainImpl( if (agentClass.getClassLoader() != null) { throw new IllegalStateException("DD Java Agent NOT added to bootstrap classpath."); } - final Method startMethod = - agentClass.getMethod("start", Object.class, Instrumentation.class, URL.class, String.class); - - startMethod.invoke(null, initTelemetry, inst, agentJarURL, agentArgs); + try { + final Method startMethod = + agentClass.getMethod( + "start", Object.class, Instrumentation.class, URL.class, String.class); + startMethod.invoke(null, initTelemetry, inst, agentJarURL, agentArgs); + } catch (Throwable e) { + throw new IllegalStateException("Unable to start DD Java Agent.", e); + } } static boolean getConfig(String configName) { switch (configName) { case LIB_INJECTION_ENABLED_ENV_VAR: - return System.getenv(LIB_INJECTION_ENABLED_ENV_VAR) != null; + return EnvironmentVariables.get(LIB_INJECTION_ENABLED_ENV_VAR) != null; case LIB_INJECTION_FORCE_SYS_PROP: { String envVarName = diff --git a/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentJar.java b/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentJar.java index 3e6683407bc..a32c032ec9f 100644 --- a/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentJar.java +++ b/dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentJar.java @@ -1,5 +1,6 @@ package datadog.trace.bootstrap; +import datadog.trace.bootstrap.environment.SystemProperties; import de.thetaphi.forbiddenapis.SuppressForbidden; import java.io.BufferedReader; import java.io.IOException; @@ -174,7 +175,7 @@ public static String getAgentVersion() throws IOException { } private static void checkProfilerEnv(final String[] args) throws Exception { - String tmpDir = args.length == 2 ? args[1] : System.getProperty("java.io.tmpdir"); + String tmpDir = args.length == 2 ? args[1] : SystemProperties.get("java.io.tmpdir"); installAgentCLI().getMethod("checkProfilerEnv", String.class).invoke(null, tmpDir); } diff --git a/dd-java-agent/src/test/java/jvmbootstraptest/InitializationTelemetryCheck.java b/dd-java-agent/src/test/java/jvmbootstraptest/InitializationTelemetryCheck.java index 14427750b81..85efcea28a3 100644 --- a/dd-java-agent/src/test/java/jvmbootstraptest/InitializationTelemetryCheck.java +++ b/dd-java-agent/src/test/java/jvmbootstraptest/InitializationTelemetryCheck.java @@ -88,12 +88,12 @@ protected boolean checkFileExecutePermission(FilePermission perm, Object ctx, St } } - public static final Result runTestJvm(Class securityManagerClass) + public static Result runTestJvm(Class securityManagerClass) throws Exception { return runTestJvm(securityManagerClass, DEFAULT_TRACE_AGENT_PORT); } - public static final Result runTestJvm( + public static Result runTestJvm( Class securityManagerClass, int port) throws Exception { File jarFile = @@ -130,8 +130,8 @@ public static final Result runTestJvm( } } - static final File createTempFile( - String baseName, String extension, Set perms) throws IOException { + static File createTempFile(String baseName, String extension, Set perms) + throws IOException { Path path = Files.createTempFile( baseName + "-integration-telemetry-check", @@ -142,11 +142,11 @@ static final File createTempFile( return file; } - static final void write(File file, String... lines) throws IOException { + static void write(File file, String... lines) throws IOException { Files.write(file.toPath(), Arrays.asList(lines)); } - static final String read(File file) { + static String read(File file) { try { return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); } catch (IOException e) { @@ -154,13 +154,13 @@ static final String read(File file) { } } - static final void delete(File... tempFiles) { + static void delete(File... tempFiles) { for (File file : tempFiles) { file.delete(); } } - public static final Class[] requiredClasses( + public static Class[] requiredClasses( Class securityManagerClass) { if (securityManagerClass == null) { @@ -178,7 +178,7 @@ public static final Class[] requiredClasses( } } - public static final Map envVars(File forwarderFile) { + public static Map envVars(File forwarderFile) { Map envVars = new HashMap<>(); envVars.put("DD_TELEMETRY_FORWARDER_PATH", forwarderFile.getAbsolutePath()); return envVars; diff --git a/internal-api/src/main/java/datadog/trace/api/Config.java b/internal-api/src/main/java/datadog/trace/api/Config.java index 2e8e014274f..5e08f1f9c64 100644 --- a/internal-api/src/main/java/datadog/trace/api/Config.java +++ b/internal-api/src/main/java/datadog/trace/api/Config.java @@ -323,7 +323,6 @@ import static datadog.trace.api.config.GeneralConfig.APPLICATION_KEY; import static datadog.trace.api.config.GeneralConfig.APPLICATION_KEY_FILE; import static datadog.trace.api.config.GeneralConfig.AZURE_APP_SERVICES; -import static datadog.trace.api.config.GeneralConfig.DATA_JOBS_COMMAND_PATTERN; import static datadog.trace.api.config.GeneralConfig.DATA_JOBS_ENABLED; import static datadog.trace.api.config.GeneralConfig.DATA_JOBS_OPENLINEAGE_ENABLED; import static datadog.trace.api.config.GeneralConfig.DATA_STREAMS_BUCKET_DURATION_SECONDS; @@ -1143,7 +1142,6 @@ public static String getHostName() { private final int cwsTlsRefresh; private final boolean dataJobsEnabled; - private final String dataJobsCommandPattern; private final boolean dataJobsOpenLineageEnabled; private final boolean dataStreamsEnabled; @@ -2535,7 +2533,6 @@ PROFILING_DATADOG_PROFILER_ENABLED, isDatadogProfilerSafeInCurrentEnvironment()) dataJobsOpenLineageEnabled = configProvider.getBoolean( DATA_JOBS_OPENLINEAGE_ENABLED, DEFAULT_DATA_JOBS_OPENLINEAGE_ENABLED); - dataJobsCommandPattern = configProvider.getString(DATA_JOBS_COMMAND_PATTERN); dataStreamsEnabled = configProvider.getBoolean(DATA_STREAMS_ENABLED, DEFAULT_DATA_STREAMS_ENABLED); @@ -4385,10 +4382,6 @@ public boolean isDataJobsOpenLineageEnabled() { return dataJobsOpenLineageEnabled; } - public String getDataJobsCommandPattern() { - return dataJobsCommandPattern; - } - public boolean isApmTracingEnabled() { return apmTracingEnabled; } @@ -5687,8 +5680,6 @@ public String toString() { + appSecRaspEnabled + ", dataJobsEnabled=" + dataJobsEnabled - + ", dataJobsCommandPattern=" - + dataJobsCommandPattern + ", apmTracingEnabled=" + apmTracingEnabled + ", jdkSocketEnabled="