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 @@ -59,7 +59,8 @@ public class DDAgentFeaturesDiscovery implements DroppingPolicy {

public static final String DATADOG_AGENT_STATE = "Datadog-Agent-State";

public static final String DEBUGGER_ENDPOINT = "debugger/v1/input";
public static final String DEBUGGER_ENDPOINT_V1 = "debugger/v1/input";
public static final String DEBUGGER_ENDPOINT_V2 = "debugger/v2/input";
public static final String DEBUGGER_DIAGNOSTICS_ENDPOINT = "debugger/v1/diagnostics";

public static final String TELEMETRY_PROXY_ENDPOINT = "telemetry/proxy/";
Expand Down Expand Up @@ -266,8 +267,15 @@ private boolean processInfoResponse(String response) {
}
}

if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT)) {
debuggerEndpoint = DEBUGGER_ENDPOINT;
// both debugger endpoint v2 and diagnostics endpoint are forwarding events to the DEBUGGER
// intake
// because older agents support diagnostics, we fallback to it before falling back to v1
if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V2)) {
debuggerEndpoint = DEBUGGER_ENDPOINT_V2;
} else if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
debuggerEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
} else if (containsEndpoint(endpoints, DEBUGGER_ENDPOINT_V1)) {
debuggerEndpoint = DEBUGGER_ENDPOINT_V1;
}
if (containsEndpoint(endpoints, DEBUGGER_DIAGNOSTICS_ENDPOINT)) {
debuggerDiagnosticsEndpoint = DEBUGGER_DIAGNOSTICS_ENDPOINT;
Expand Down Expand Up @@ -353,6 +361,10 @@ public boolean supportsDebugger() {
return debuggerEndpoint != null;
}

public String getDebuggerEndpoint() {
return debuggerEndpoint;
}

public boolean supportsDebuggerDiagnostics() {
return debuggerDiagnosticsEndpoint != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
features.state() == INFO_STATE
features.getConfigEndpoint() == V7_CONFIG_ENDPOINT
features.supportsDebugger()
features.getDebuggerEndpoint() == "debugger/v2/input"
features.supportsDebuggerDiagnostics()
features.supportsEvpProxy()
features.supportsContentEncodingHeadersWithEvpProxy()
Expand Down Expand Up @@ -412,6 +413,9 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
then:
1 * client.newCall(_) >> { Request request -> infoResponse(request, INFO_WITH_TELEMETRY_PROXY_RESPONSE) }
features.supportsTelemetryProxy()
features.supportsDebugger()
features.getDebuggerEndpoint() == "debugger/v1/input"
!features.supportsDebuggerDiagnostics()
0 * _
}

Expand All @@ -428,6 +432,10 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
features.supportsEvpProxy()
features.getEvpProxyEndpoint() == "evp_proxy/v2/" // v3 is advertised, but the tracer should ignore it
!features.supportsContentEncodingHeadersWithEvpProxy()
features.supportsDebugger()
features.getDebuggerEndpoint() == "debugger/v1/diagnostics"
features.supportsDebuggerDiagnostics()
0 * _
}

def "test parse /info response with peer tag back propagation"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"/evp_proxy/v3/",
"/evp_proxy/v4/",
"/debugger/v1/input",
"/debugger/v2/input",
"/debugger/v1/diagnostics",
"/v0.7/config"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ private static void commonInit(Config config) {
ProbeStatusSink probeStatusSink =
new ProbeStatusSink(
config, diagnosticEndpoint, ddAgentFeaturesDiscovery.supportsDebuggerDiagnostics());
DebuggerSink debuggerSink = createDebuggerSink(config, probeStatusSink);
DebuggerSink debuggerSink =
createDebuggerSink(config, ddAgentFeaturesDiscovery, probeStatusSink);
debuggerSink.start();
configurationUpdater =
new ConfigurationUpdater(
Expand Down Expand Up @@ -273,14 +274,19 @@ public static void stopDistributedDebugger() {
LOGGER.info("Sopping Distributed Debugger");
}

private static DebuggerSink createDebuggerSink(Config config, ProbeStatusSink probeStatusSink) {
private static DebuggerSink createDebuggerSink(
Config config,
DDAgentFeaturesDiscovery ddAgentFeaturesDiscovery,
ProbeStatusSink probeStatusSink) {
String tags = getDefaultTagsMergedWithGlobalTags(config);
SnapshotSink snapshotSink =
new SnapshotSink(
config,
tags,
new BatchUploader(
config, config.getFinalDebuggerSnapshotUrl(), SnapshotSink.RETRY_POLICY));
config,
getDebuggerEndpoint(config, ddAgentFeaturesDiscovery),
SnapshotSink.RETRY_POLICY));
SymbolSink symbolSink = new SymbolSink(config);
return new DebuggerSink(
config,
Expand Down Expand Up @@ -314,6 +320,16 @@ public static String getDefaultTagsMergedWithGlobalTags(Config config) {
return debuggerTags + "," + globalTags;
}

private static String getDebuggerEndpoint(
Config config, DDAgentFeaturesDiscovery ddAgentFeaturesDiscovery) {
if (ddAgentFeaturesDiscovery.supportsDebugger()) {
return ddAgentFeaturesDiscovery
.buildUrl(ddAgentFeaturesDiscovery.getDebuggerEndpoint())
.toString();
}
return config.getFinalDebuggerSnapshotUrl();
}

private static String getDiagnosticEndpoint(
Config config, DDAgentFeaturesDiscovery ddAgentFeaturesDiscovery) {
if (ddAgentFeaturesDiscovery.supportsDebuggerDiagnostics()) {
Expand Down
Loading