-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
lib: add a diagnostic channel for observing AsyncContextFrame.set #58229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also add the channel to the diagnostics_channel docs here: https://github.com/nodejs/node/blob/main/doc/api/diagnostics_channel.md?plain=1#L1104
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58229 +/- ##
=======================================
Coverage 90.12% 90.12%
=======================================
Files 629 629
Lines 186638 186638
Branches 36618 36622 +4
=======================================
+ Hits 168202 168216 +14
+ Misses 11222 11201 -21
- Partials 7214 7221 +7
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might also be a good idea to have the tests validate that the frame can be used to look up the state for a given store. The store is the key so it should just be frame.get(store) to get the value.
Adds an
async_context_frame.set
diagnostic channel for observingAsyncContextFrame.set
.This is helpful for functionality in extensions written in C++ that need to keep some derived native state from one or more
AsyncLocalStorage
s in sync with changes in active frame. It is possible that such an extension needs to use the state when it can not enter V8 to obtain the data throughAsyncLocalStorage
JS API. A subscriber to this diagnostic channel can be used instead to eagerly keep the native state updated.