Skip to content

Commit c8216b5

Browse files
authored
Send debugger logs to DEBUGGER track (#10585)
DEBUGGER track now apply SDS rules. We want to redact by default the content of debugger logs (not only snapshots). debugger/v2/input and debugger/v1/diagnostics endpoints send data to DEBUGGER track. We privilege debugger/v2/input but fallback to debugger/v1/diagnostics like snapshots
1 parent 5209bc5 commit c8216b5

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

communication/src/main/java/datadog/communication/ddagent/DDAgentFeaturesDiscovery.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,7 @@ private boolean processInfoResponse(State newState, String response) {
268268
}
269269
}
270270

271-
if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V1)) {
272-
newState.debuggerLogEndpoint = DEBUGGER_ENDPOINT_V1;
273-
}
274-
// both debugger v2 and diagnostics endpoints are forwarding events to the DEBUGGER intake
275-
// because older agents support diagnostics from DD agent 7.49
276-
if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V2)) {
277-
newState.debuggerSnapshotEndpoint = DEBUGGER_ENDPOINT_V2;
278-
} else if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
279-
newState.debuggerSnapshotEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
280-
}
281-
if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
282-
newState.debuggerDiagnosticsEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
283-
}
271+
setDebuggerEndpoints(newState, endpoints);
284272

285273
for (String endpoint : dataStreamsEndpoints) {
286274
if (containsEndpoint(endpoints, endpoint)) {
@@ -335,6 +323,26 @@ private boolean processInfoResponse(State newState, String response) {
335323
return false;
336324
}
337325

326+
private static void setDebuggerEndpoints(State newState, Set<String> endpoints) {
327+
// both debugger v2 and diagnostics endpoints are forwarding events to the DEBUGGER intake
328+
// because older agents support diagnostics from DD agent 7.49
329+
if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V2)) {
330+
newState.debuggerLogEndpoint = DEBUGGER_ENDPOINT_V2;
331+
} else if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
332+
newState.debuggerLogEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
333+
} else if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V1)) {
334+
newState.debuggerLogEndpoint = DEBUGGER_ENDPOINT_V1;
335+
}
336+
if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V2)) {
337+
newState.debuggerSnapshotEndpoint = DEBUGGER_ENDPOINT_V2;
338+
} else if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
339+
newState.debuggerSnapshotEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
340+
}
341+
if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
342+
newState.debuggerDiagnosticsEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
343+
}
344+
}
345+
338346
private static boolean containsEndpoint(Set<String> endpoints, String endpoint) {
339347
return endpoints.contains(endpoint) || endpoints.contains("/" + endpoint);
340348
}

dd-smoke-tests/debugger-integration-tests/src/test/java/datadog/smoketest/AgentDebuggerIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void testEndpoints() throws Exception {
116116
}
117117
if (line.contains("Started BatchUploader[Logs]")) {
118118
return !line.matches(
119-
".* Started BatchUploader\\[Logs] with target url http://localhost:\\d+/debugger/v1/input");
119+
".* Started BatchUploader\\[Logs] with target url http://localhost:\\d+/debugger/v1/diagnostics");
120120
}
121121
if (line.contains("Started BatchUploader[SymDB]")) {
122122
return !line.matches(

0 commit comments

Comments
 (0)