diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/utils/ProcessHierarchyUtils.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/utils/ProcessHierarchyUtils.java index d26215474b0..54a1eac1afa 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/utils/ProcessHierarchyUtils.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/utils/ProcessHierarchyUtils.java @@ -38,7 +38,11 @@ private static boolean isMavenParent() { } private static boolean isGradleDaemon() { - return ClassLoader.getSystemClassLoader().getResource("org/gradle/launcher/daemon/") != null; + return ClassLoader.getSystemClassLoader() + .getResource("org/gradle/launcher/daemon/bootstrap/GradleDaemon.class") + != null + // double-check this is not a Gradle Worker + && System.getProperties().getProperty("org.gradle.internal.worker.tmpdir") == null; } public static long getParentSessionId() {