-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
async_hooks: add getActiveResources #37262
async_hooks: add getActiveResources #37262
Conversation
This comment has been minimized.
This comment has been minimized.
@targos Thanks for the links. It seems, we need to move these methods to |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Should I remove |
ae9f657
to
b9ad96f
Compare
I think you should pick up the changes in #21453 instead, reading other PRs it seems there good reasons to not make those APIs public as is.
Probably not, it would make the PR |
This comment has been minimized.
This comment has been minimized.
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.
Is this ready for reviews or still in the works? Do you want to add the wip
label or convert the PR to draft?
@aduh95 I'm still trying to make Fishrock123's cherry picked commit pass the CI 😄. I'll add the |
14bf7cf
to
8bdd85b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
CI: https://ci.nodejs.org/job/node-test-pull-request/36094/ (:heavy_check_mark:) |
@aduh95 I think this is ready for review now. :D |
I wonder why a failed check of a previous run is linked in the checks section. 👀 |
Can you add documentation please? |
Could you cherry-pick @yashLadha's commit in your branch maybe? We want the documentation to be in the same PR so the Adding the |
lib/internal/util.js
Outdated
const handles = process._getActiveHandles(); | ||
const reqs = process._getActiveRequests(); |
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.
Could you avoid using the global process
here and instead load them from internalBinding('process_methods')
? If the plan is to remove the undocumented methods in the future, let's avoid to use it in core.
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.
Thanks for noticing. :)
Replaced it.
I appreciate this being picked back up but I would like us to reconsider a bit how this API works. The use case for |
This comment has been minimized.
This comment has been minimized.
This change picks up the changes from the referenced PR and moves the implementation of `getActiveResources` to `util` to return a summary of the resources. Refs: nodejs#21453
8872d7c
to
fa990cd
Compare
Why on |
@benjamingr I came across this review comment in the referenced PR and thought it would be appropriate to expose it from
Originally posted by @jasnell in #21453 (comment) However, I'm open to exposing this from any other module if that's needed. :) |
My general preference would be to expose it via async_hooks. If that's not a fit, then util would be my second choice. |
@jasnell I have updated the PR to return a summary of the resources instead. Does the API design look okay now? |
@RaisinTen ... I guess the thing that I'm struggling with on this PR is whether this is the right approach. Someone could very easily create an async_hook that tracks |
@jasnell Yes, I agree. Do you think we should aim towards deleting process._getActive* in favour of async_hooks then? |
Closing in favor of #40813 |
This change picks up the changes from the
referenced PR and moves the implementation of
getActiveResources
toasync_hooks
to return asummary of the resources.
Refs: #21453