Skip to content

Commit a8a8a87

Browse files
GeoffreyBoothdanielleadams
authored andcommitted
doc: add async_hooks migration note
PR-URL: #45335 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 0a2c558 commit a8a8a87

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

doc/api/async_hooks.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
<!--introduced_in=v8.1.0-->
44

5-
> Stability: 1 - Experimental
5+
> Stability: 1 - Experimental. Please migrate away from this API, if you can.
6+
> We do not recommend using the [`createHook`][], [`AsyncHook`][], and
7+
> [`executionAsyncResource`][] APIs as they have usability issues, safety risks,
8+
> and performance implications. Async context tracking use cases are better
9+
> served by the stable [`AsyncLocalStorage`][] API. If you have a use case for
10+
> `createHook`, `AsyncHook`, or `executionAsyncResource` beyond the context
11+
> tracking need solved by [`AsyncLocalStorage`][] or diagnostics data currently
12+
> provided by [Diagnostics Channel][], please open an issue at
13+
> <https://github.com/nodejs/node/issues> describing your use case so we can
14+
> create a more purpose-focused API.
615
716
<!-- source_link=lib/async_hooks.js -->
817

@@ -869,14 +878,18 @@ The documentation for this class has moved [`AsyncResource`][].
869878
The documentation for this class has moved [`AsyncLocalStorage`][].
870879
871880
[DEP0111]: deprecations.md#dep0111-processbinding
881+
[Diagnostics Channel]: diagnostics_channel.md
872882
[Hook Callbacks]: #hook-callbacks
873883
[PromiseHooks]: https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit
884+
[`AsyncHook`]: #class-asynchook
874885
[`AsyncLocalStorage`]: async_context.md#class-asynclocalstorage
875886
[`AsyncResource`]: async_context.md#class-asyncresource
876887
[`Worker`]: worker_threads.md#class-worker
877888
[`after` callback]: #afterasyncid
878889
[`before` callback]: #beforeasyncid
890+
[`createHook`]: #async_hookscreatehookcallbacks
879891
[`destroy` callback]: #destroyasyncid
892+
[`executionAsyncResource`]: #async_hooksexecutionasyncresource
880893
[`init` callback]: #initasyncid-type-triggerasyncid-resource
881894
[`process.getActiveResourcesInfo()`]: process.md#processgetactiveresourcesinfo
882895
[`promiseResolve` callback]: #promiseresolveasyncid

0 commit comments

Comments
 (0)