Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,11 @@ private boolean processInfoResponse(State newState, String response) {
newState.debuggerLogEndpoint = DEBUGGER_ENDPOINT_V1;
}
// both debugger v2 and diagnostics endpoints are forwarding events to the DEBUGGER intake
// because older agents support diagnostics, we fall back to it before falling back to v1
// because older agents support diagnostics from DD agent 7.49
if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V2)) {
newState.debuggerSnapshotEndpoint = DEBUGGER_ENDPOINT_V2;
} else if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
newState.debuggerSnapshotEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
} else if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V1)) {
newState.debuggerSnapshotEndpoint = DEBUGGER_ENDPOINT_V1;
}
if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
newState.debuggerDiagnosticsEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
1 * client.newCall(_) >> { Request request -> infoResponse(request, INFO_WITH_TELEMETRY_PROXY_RESPONSE) }
features.supportsTelemetryProxy()
features.supportsDebugger()
features.getDebuggerSnapshotEndpoint() == "debugger/v1/input"
!features.supportsDebuggerDiagnostics()
features.getDebuggerSnapshotEndpoint() == "debugger/v1/diagnostics"
features.supportsDebuggerDiagnostics()
0 * _
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"/evp_proxy/v1/",
"/evp_proxy/v2/",
"/debugger/v1/input",
"/debugger/v1/diagnostics",
"/v0.7/config"
],
"feature_flags": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,11 @@ private static String getLogEndpoint(
private static String getSnapshotEndpoint(
Config config, DDAgentFeaturesDiscovery ddAgentFeaturesDiscovery) {
if (ddAgentFeaturesDiscovery.supportsDebugger()) {
return ddAgentFeaturesDiscovery
.buildUrl(ddAgentFeaturesDiscovery.getDebuggerSnapshotEndpoint())
.toString();
String debuggerSnapshotEndpoint = ddAgentFeaturesDiscovery.getDebuggerSnapshotEndpoint();
if (debuggerSnapshotEndpoint == null) {
throw new IllegalArgumentException("Cannot find snapshot endpoint on datadog agent");
}
return ddAgentFeaturesDiscovery.buildUrl(debuggerSnapshotEndpoint).toString();
}
return config.getFinalDebuggerSnapshotUrl();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public static Config getConfig() {
setFieldInConfig(config, "dynamicInstrumentationClassFileDumpEnabled", true);
setFieldInConfig(config, "dynamicInstrumentationVerifyByteCode", false);
setFieldInConfig(config, "debuggerCodeOriginMaxUserFrames", 20);

setFieldInConfig(config, "dynamicInstrumentationSnapshotUrl", "http://localhost:8080");
return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void runEnabledWithDatadogAgent() throws InterruptedException, IOExceptio
setFieldInConfig(Config.get(), "dynamicInstrumentationMaxPayloadSize", 4096L);
setFieldInContainerInfo(ContainerInfo.get(), "containerId", "");
String infoContent =
"{\"endpoints\": [\"v0.4/traces\", \"debugger/v1/input\", \"v0.7/config\"] }";
"{\"endpoints\": [\"v0.4/traces\", \"debugger/v1/input\", \"debugger/v1/diagnostics\", \"v0.7/config\"] }";
datadogAgentServer.enqueue(new MockResponse().setResponseCode(200).setBody(infoContent));
datadogAgentServer.enqueue(new MockResponse().setResponseCode(200).setBody(infoContent));
try (BufferedReader reader =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import static datadog.communication.http.OkHttpUtils.buildHttpClient
import static datadog.trace.api.ConfigDefaults.DEFAULT_AGENT_HOST
import static datadog.trace.api.ConfigDefaults.DEFAULT_AGENT_TIMEOUT
import static datadog.trace.api.ConfigDefaults.DEFAULT_TRACE_AGENT_PORT
import static datadog.trace.api.config.DebuggerConfig.DYNAMIC_INSTRUMENTATION_SNAPSHOT_URL
import static datadog.trace.api.config.DebuggerConfig.DYNAMIC_INSTRUMENTATION_VERIFY_BYTECODE
import static datadog.trace.api.config.TraceInstrumentationConfig.CODE_ORIGIN_FOR_SPANS_ENABLED
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.closePrevious
Expand Down Expand Up @@ -308,6 +309,7 @@ abstract class InstrumentationSpecification extends DDSpecification implements A
def codeOriginSetup() {
injectSysConfig(CODE_ORIGIN_FOR_SPANS_ENABLED, "true", true)
injectSysConfig(DYNAMIC_INSTRUMENTATION_VERIFY_BYTECODE, "false", true)
injectSysConfig(DYNAMIC_INSTRUMENTATION_SNAPSHOT_URL, "http://localhost:1234/debugger/v1/input", true)
rebuildConfig()

def configuration = Configuration.builder()
Expand Down
2 changes: 1 addition & 1 deletion internal-api/src/main/java/datadog/trace/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -4176,7 +4176,7 @@ public String getFinalDebuggerSnapshotUrl() {
} else if (isCiVisibilityAgentlessEnabled()) {
return Intake.LOGS.getAgentlessUrl(this) + "logs";
} else {
return getFinalDebuggerBaseUrl() + "/debugger/v1/input";
throw new IllegalArgumentException("Cannot find snapshot endpoint on datadog agent");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class ConfigTest extends DDSpecification {
prop.setProperty(DYNAMIC_INSTRUMENTATION_VERIFY_BYTECODE, "true")
prop.setProperty(DYNAMIC_INSTRUMENTATION_INSTRUMENT_THE_WORLD, "method")
prop.setProperty(DYNAMIC_INSTRUMENTATION_EXCLUDE_FILES, "exclude file")
prop.setProperty(DYNAMIC_INSTRUMENTATION_SNAPSHOT_URL, "http://somehost:123/debugger/v1/input")
prop.setProperty(EXCEPTION_REPLAY_ENABLED, "true")
prop.setProperty(TRACE_X_DATADOG_TAGS_MAX_LENGTH, "128")
prop.setProperty(JDK_SOCKET_ENABLED, "false")
Expand Down Expand Up @@ -2785,7 +2786,6 @@ class ConfigTest extends DDSpecification {
Config config = Config.get(prop)

then:
config.finalDebuggerSnapshotUrl == "http://localhost:8126/debugger/v1/input"
config.finalDebuggerSymDBUrl == "http://localhost:8126/symdb/v1/input"
}

Expand Down