Skip to content

Commit 7375560

Browse files
authored
feat: Support proxy for debugger endpoint v2 (#918)
Now we support proxying requests from `/debugger/v1/input`. This PR adds `/debugger/v2/input` and `/debugger/v1/diagnostics`. #925 ## Test ### Steps 1. Set up Exception Replay following https://docs.datadoghq.com/error_tracking/backend/exception_replay/ 2. Build a test layer and install it on the Lambda 3. Set `DD_TRACE_DEBUG` to `true` 4. Change Lambda timeout from 3s to 30s. Seems Exception Replay dramatically increases the duration of the first invocation. It took 8–9s for my tests. ### Result Before: - In CloudWatch logs, see the error multiple times: `debugger::unsupported_agentUnsupported Datadog agent detected. Snapshots from Dynamic Instrumentation/Exception Replay/Code Origin for Spans will not be uploaded. Please upgrade to version 7.49.0 or later` After: - No such error. - See tracer debug log: `Detected /debugger/v2/input endpoint` - See the error on Error Tracking page <img width="486" height="166" alt="image" src="https://github.com/user-attachments/assets/3d48cb2b-0d5a-4806-97e1-e8146642ce64" /> ## Notes Thanks @nhulston @joeyzhao2018 @purple4reina for discussion and helping debug.
1 parent 626ee59 commit 7375560

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

bottlecap/src/traces/trace_agent.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ const LLM_OBS_EVAL_METRIC_ENDPOINT_PATH_V2: &str =
6060
"/evp_proxy/v2/api/intake/llm-obs/v2/eval-metric";
6161
const LLM_OBS_SPANS_ENDPOINT_PATH: &str = "/evp_proxy/v2/api/v2/llmobs";
6262
const INFO_ENDPOINT_PATH: &str = "/info";
63-
const DEBUGGER_ENDPOINT_PATH: &str = "/debugger/v1/input";
63+
const V1_DEBUGGER_ENDPOINT_PATH: &str = "/debugger/v1/input";
64+
const V2_DEBUGGER_ENDPOINT_PATH: &str = "/debugger/v2/input";
65+
const DEBUGGER_DIAGNOSTICS_ENDPOINT_PATH: &str = "/debugger/v1/diagnostics";
6466
const INSTRUMENTATION_ENDPOINT_PATH: &str = "/telemetry/proxy/api/v2/apmtelemetry";
6567

6668
// Intake endpoints
@@ -69,7 +71,8 @@ const LLM_OBS_SPANS_INTAKE_PATH: &str = "/api/v2/llmobs";
6971
const LLM_OBS_EVAL_METRIC_INTAKE_PATH: &str = "/api/intake/llm-obs/v1/eval-metric";
7072
const LLM_OBS_EVAL_METRIC_INTAKE_PATH_V2: &str = "/api/intake/llm-obs/v2/eval-metric";
7173
const PROFILING_INTAKE_PATH: &str = "/api/v2/profile";
72-
const DEBUGGER_LOGS_INTAKE_PATH: &str = "/api/v2/logs";
74+
const V1_DEBUGGER_LOGS_INTAKE_PATH: &str = "/api/v2/logs";
75+
const V2_DEBUGGER_INTAKE_PATH: &str = "/api/v2/debugger";
7376
const INSTRUMENTATION_INTAKE_PATH: &str = "/api/v2/apmtelemetry";
7477

7578
const TRACER_PAYLOAD_CHANNEL_BUFFER_SIZE: usize = 10;
@@ -256,7 +259,12 @@ impl TraceAgent {
256259
post(Self::llm_obs_eval_metric_proxy_v2),
257260
)
258261
.route(LLM_OBS_SPANS_ENDPOINT_PATH, post(Self::llm_obs_spans_proxy))
259-
.route(DEBUGGER_ENDPOINT_PATH, post(Self::debugger_logs_proxy))
262+
.route(V1_DEBUGGER_ENDPOINT_PATH, post(Self::debugger_logs_proxy))
263+
.route(V2_DEBUGGER_ENDPOINT_PATH, post(Self::debugger_intake_proxy))
264+
.route(
265+
DEBUGGER_DIAGNOSTICS_ENDPOINT_PATH,
266+
post(Self::debugger_intake_proxy),
267+
)
260268
.route(
261269
INSTRUMENTATION_ENDPOINT_PATH,
262270
post(Self::instrumentation_proxy),
@@ -385,18 +393,32 @@ impl TraceAgent {
385393
.await
386394
}
387395

396+
// Used for `/debugger/v1/input` in Exception Replay
388397
async fn debugger_logs_proxy(State(state): State<ProxyState>, request: Request) -> Response {
389398
Self::handle_proxy(
390399
state.config,
391400
state.proxy_aggregator,
392401
request,
393402
"http-intake.logs",
394-
DEBUGGER_LOGS_INTAKE_PATH,
403+
V1_DEBUGGER_LOGS_INTAKE_PATH,
395404
"debugger_logs",
396405
)
397406
.await
398407
}
399408

409+
// Used for `/debugger/v1/diagnostics` and `/debugger/v2/input` in Exception Replay
410+
async fn debugger_intake_proxy(State(state): State<ProxyState>, request: Request) -> Response {
411+
Self::handle_proxy(
412+
state.config,
413+
state.proxy_aggregator,
414+
request,
415+
"debugger-intake",
416+
V2_DEBUGGER_INTAKE_PATH,
417+
"debugger",
418+
)
419+
.await
420+
}
421+
400422
async fn instrumentation_proxy(State(state): State<ProxyState>, request: Request) -> Response {
401423
Self::handle_proxy(
402424
state.config,
@@ -423,7 +445,9 @@ impl TraceAgent {
423445
LLM_OBS_EVAL_METRIC_ENDPOINT_PATH,
424446
LLM_OBS_EVAL_METRIC_ENDPOINT_PATH_V2,
425447
LLM_OBS_SPANS_ENDPOINT_PATH,
426-
DEBUGGER_ENDPOINT_PATH,
448+
V1_DEBUGGER_ENDPOINT_PATH,
449+
V2_DEBUGGER_ENDPOINT_PATH,
450+
DEBUGGER_DIAGNOSTICS_ENDPOINT_PATH,
427451
],
428452
"client_drop_p0s": true,
429453
}

0 commit comments

Comments
 (0)