feat: Support proxy for debugger endpoint v2 by lym953 · Pull Request #918 · DataDog/datadog-lambda-extension
Conversation
Now we support proxying requests from /debugger/v1/input. This PR adds /debugger/v2/input and /debugger/v1/diagnostics.
Test
Steps
- Set up Exception Replay following https://docs.datadoghq.com/error_tracking/backend/exception_replay/
- Build a test layer and install it on the Lambda
- Set
DD_TRACE_DEBUGtotrue - 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
Notes
Thanks @nhulston @joeyzhao2018 @purple4reina for discussion and helping debug.
| .route(LLM_OBS_SPANS_ENDPOINT_PATH, post(Self::llm_obs_spans_proxy)) | ||
| .route(DEBUGGER_ENDPOINT_PATH, post(Self::debugger_logs_proxy)) | ||
| .route(V1_DEBUGGER_ENDPOINT_PATH, post(Self::debugger_logs_proxy)) | ||
| .route(V2_DEBUGGER_ENDPOINT_PATH, post(Self::debugger_logs_proxy)) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct to use Self::debugger_logs_proxy? Should any param here be different?
| async fn debugger_logs_proxy(State(state): State<ProxyState>, request: Request) -> Response { | |
| Self::handle_proxy( | |
| state.config, | |
| state.proxy_aggregator, | |
| request, | |
| "http-intake.logs", | |
| DEBUGGER_LOGS_INTAKE_PATH, | |
| "debugger_logs", | |
| ) | |
| .await | |
| } |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was incorrect in Slack. After looking at the datadog-agent code, it looks like the params changed in v2. See the suggested code changes in the other comments
lym953
marked this pull request as ready for review
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const V1_DEBUGGER_LOGS_INTAKE_PATH: &str = "/api/v2/logs"; | |
| const V2_DEBUGGER_INTAKE_PATH: &str = "/api/v2/debugger"; |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Can we test in a real Lambda before merging?
lym953
deleted the
yiming.luo/debugger-proxy
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
