Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static datadog.trace.api.Config.isExplicitlyDisabled;

import datadog.environment.JavaVirtualMachine;
import datadog.trace.api.Config;
import datadog.trace.api.config.DebuggerConfig;
import datadog.trace.api.config.TraceInstrumentationConfig;
Expand Down Expand Up @@ -29,12 +30,17 @@ public void updateConfig(DebuggerConfigUpdate update) {
update.getDynamicInstrumentationEnabled(),
DebuggerAgent::startDynamicInstrumentation,
DebuggerAgent::stopDynamicInstrumentation);
startOrStopFeature(
config,
DebuggerConfig.EXCEPTION_REPLAY_ENABLED,
update.getExceptionReplayEnabled(),
DebuggerAgent::startExceptionReplay,
DebuggerAgent::stopExceptionReplay);
if (JavaVirtualMachine.isJavaVersionAtLeast(11)) {
Comment thread
jpbempel marked this conversation as resolved.
Comment thread
jpbempel marked this conversation as resolved.
Comment thread
jpbempel marked this conversation as resolved.
Comment thread
jpbempel marked this conversation as resolved.
// Cannot remotely enable Exception Replay for JDK < 11 (JVM 8 bug)
startOrStopFeature(
config,
DebuggerConfig.EXCEPTION_REPLAY_ENABLED,
update.getExceptionReplayEnabled(),
DebuggerAgent::startExceptionReplay,
DebuggerAgent::stopExceptionReplay);
} else {
LOGGER.debug("Cannot start Exception Replay on JDK version < 11");
}
startOrStopFeature(
config,
TraceInstrumentationConfig.CODE_ORIGIN_FOR_SPANS_ENABLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import datadog.communication.ddagent.DDAgentFeaturesDiscovery;
import datadog.communication.ddagent.SharedCommunicationObjects;
import datadog.environment.JavaVirtualMachine;
import datadog.remoteconfig.ConfigurationPoller;
import datadog.trace.api.Config;
import datadog.trace.api.debugger.DebuggerConfigUpdate;
Expand All @@ -27,12 +28,20 @@ public void enableDisable() {
productConfigUpdater.updateConfig(new DebuggerConfigUpdate());
productConfigUpdater.updateConfig(new DebuggerConfigUpdate(true, true, true, true));
assertTrue(productConfigUpdater.isDynamicInstrumentationEnabled());
assertTrue(productConfigUpdater.isExceptionReplayEnabled());
if (JavaVirtualMachine.isJavaVersionAtLeast(11)) {
assertTrue(productConfigUpdater.isExceptionReplayEnabled());
} else {
assertFalse(productConfigUpdater.isExceptionReplayEnabled());
}
assertTrue(productConfigUpdater.isCodeOriginEnabled());
assertTrue(productConfigUpdater.isDistributedDebuggerEnabled());
productConfigUpdater.updateConfig(new DebuggerConfigUpdate());
assertTrue(productConfigUpdater.isDynamicInstrumentationEnabled());
assertTrue(productConfigUpdater.isExceptionReplayEnabled());
if (JavaVirtualMachine.isJavaVersionAtLeast(11)) {
assertTrue(productConfigUpdater.isExceptionReplayEnabled());
} else {
assertFalse(productConfigUpdater.isExceptionReplayEnabled());
}
assertTrue(productConfigUpdater.isCodeOriginEnabled());
assertTrue(productConfigUpdater.isDistributedDebuggerEnabled());
productConfigUpdater.updateConfig(new DebuggerConfigUpdate(false, false, false, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@NonRetryable
public class InProductEnablementIntegrationTest extends ServerAppDebuggerIntegrationTest {
Expand Down Expand Up @@ -81,6 +83,7 @@ void testDynamicInstrumentationEnablementStaticallyDisabled() throws Exception {

@Test
@DisplayName("testExceptionReplayEnablement")
@EnabledForJreRange(min = JRE.JAVA_11)
void testExceptionReplayEnablement() throws Exception {
additionalJvmArgs.add("-Ddd.third.party.excludes=datadog.smoketest");
appUrl = startAppAndAndGetUrl();
Expand All @@ -100,6 +103,7 @@ void testExceptionReplayEnablement() throws Exception {
@Flaky
@Test
@DisplayName("testExceptionReplayEnablementFailure")
@EnabledForJreRange(min = JRE.JAVA_11)
void testExceptionReplayEnablementFailure() throws Exception {
additionalJvmArgs.add("-Ddd.exception.replay.enabled=true");
additionalJvmArgs.add("-Ddd.third.party.excludes=datadog.smoketest");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -59,6 +61,8 @@ static void closeMockBackend() throws Exception {
}

@Test
// Exception Replay is disabled by default on JDK8 due to JVM bug
@EnabledForJreRange(min = JRE.JAVA_11)
void testHeadlessFailedTestReplay() throws Exception {
String projectName = "test_junit_console_failed_test_replay";
givenProjectFiles(projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.slf4j.Logger;
Expand Down Expand Up @@ -312,6 +314,8 @@ void testServiceNamePropagation(String projectName, String mavenVersion) throws
"failed-test-replay | test_failed_maven_failed_test_replay | 3.9.9 "
})
@ParameterizedTest
// Exception Replay is disabled by default on JDK8 due to JVM bug
@EnabledForJreRange(min = JRE.JAVA_11)
void testFailedTestReplay(String projectName, String mavenVersion) throws Exception {
givenWrapperPropertiesFile(mavenVersion);
givenMavenProjectFiles(projectName);
Expand Down
Loading