Repository navigation
fix: flush tracer DogStatsD metrics after each invocation - #873
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
The completion hook flushes tracer metrics after successful and failed handlers, with guards for missing APIs and synchronous flush errors. Source review identified no actionable defect.
🤖 Bits Code Review · Commit 2ef044a
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 2 Pipeline jobs failed
ℹ️ Info🔁 Datadog re-ran Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 9b322a3 | Docs | View more details | Give us feedback! |
What does this PR do?
Flush
tracer.dogstatsdat the start ofMetricsListener.onCompleteInvocation, before flushing the Lambda metrics client and requesting an extension flush. This runs after every invocation, including when the handler throws, and does not depend on extension detection.The metrics and trace listeners share one
TracerWrapperso they use the same resolved tracer instance. The wrapper tolerates missing tracer APIs and catches flush errors so they cannot change the handler result.Motivation
Fixes #868. Custom metrics emitted through
tracer.dogstatsd.*otherwise wait for the tracer's 10-second timer and can remain buffered when Lambda freezes an infrequently invoked function.Testing Guidelines
Additional Notes
Local validation reused installed dependencies with Node.js 26.12.0 and dd-trace 5.118.0. Deployed AWS integration tests were not run.
Types of Changes
Check all that apply