Repository navigation
fix(nodejs): flush logs before invocation completion - #2724
adityareddy-dev wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Thanks for the pr @adityareddy-dev i have taken a look at this pr & more broadly at the layer. I am wondering if we were to instead switch the layer to being a wrapper of the node-sdk package, would the flush issue be automatically solved? If it doesn't could it be solved there instead?
Would it be possible for you to have a test of this, my ask would be that additions are kept to a minimum, pr is focussed on just switching the providers/sdk & we can follow with additional pr's for improving instrumentation handling.
|
I tried NodeSDK 0.223.0 locally with an async handler and the layer's package versions. Logs stayed buffered at completion. Re-registering Lambda instrumentation after SDK startup flushed spans, but logs waited for shutdown. NodeSDK has no invocation-end hook, so switching SDKs alone won't fix the log flush. The existing logger-provider flush PR covers that path and is still open. I'll keep this PR focused on the provider/SDK switch and handle instrumentation separately. |
|
Ok, just to confirm if we switch to node-sdk & the linked pr lands here the issue will be fixed? If so that is great news. |
|
Yes, as long as the layer keeps re-registering the instrumentations after That PR targets SDK 3 and Node 22.15+ though, so we can't take that version as-is while the layer still supports |
|
Closing this, the NodeSDK switch replaces it. |
I made Lambda instrumentation wait for the layer's log provider to flush before completing an invocation. This covers promise, callback and streaming handlers. Shutdown handling is outside this change.
Refs #2537.