process: delay and simplify the setup of async hooks trace events
src: move async hooks trace events setup to pre_execution.js
Reasons:
- Moves more environment-dependent setup out of bootstrap/node.js
- No async operations should be done before the call to the setup functions in pre_execution.js so no async hooks should be triggered before that. Therefore it is safe to delay the setup until then.
process: simplify the setup of async hooks trace events
- Remove
trace_category_state
fromEnvironment
- since this is only accessed in the bootstrap process and later in the trace category update handler, we could just pass the initial values into JS land via the trace_events binding, and pass the dynamic values directly to the handler later, instead of accessing them out-of-band via the AliasedBuffer. - Instead of creating the hooks directly in
trace_events_async_hooks.js
, export the hook factory and create the hooks in trace category state toggle.
test: add test for node.async_hooks tracing in workers
test: add test for dynamically enabling node.async_hooks tracing
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines