Draft
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a minimal fix to the custom DogStatsD client by calling
socket.unref()when the UDP socket is created insrc/metrics/dogstatsd.ts.This prevents the DogStatsD transport socket from keeping the Node.js event loop alive after invocation work is complete, while preserving existing metric emission behavior.
Motivation
Streaming Lambda functions instrumented with
datadog-lambda-jswere consistently hanging until timeout when enhanced metrics were enabled (regression observed on layer versions after thev11.125.0metrics transport refactor).Root cause analysis pointed to DogStatsD socket lifecycle behavior introduced in that refactor. A one-line
unref()is the least invasive mitigation with low blast radius.Testing Guidelines
202 Acceptedin extension debug logs).yarn test src/metrics/dogstatsd.spec.ts --runInBandyarn test src/metrics/dogstatsd.spec.ts src/metrics/listener.spec.ts --runInBandyarn test src/metrics --runInBandunref()behavior indogstatsd.spec.ts.Additional Notes
Types of Changes
Check all that apply