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 adfaef07392..7a4b446e7de 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 @@ -221,6 +221,15 @@ public static void start( 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"); + String javaCommand = System.getProperty("sun.java.command"); String dataJobsCommandPattern = Config.get().getDataJobsCommandPattern(); if (!isDataJobsSupported(javaCommand, dataJobsCommandPattern)) { @@ -230,15 +239,6 @@ public static void start( dataJobsCommandPattern); return; } - - 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"); } if (!isSupportedAppSecArch()) {