2020-08-21 16:25:39 -07:00
|
|
|
# Diagnostics Channel
|
|
|
|
|
2022-11-05 05:03:53 -07:00
|
|
|
<!-- YAML
|
2023-03-08 00:47:10 -08:00
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
2022-11-05 05:03:53 -07:00
|
|
|
changes:
|
2023-01-05, Version 18.13.0 'Hydrogen' (LTS)
Notable changes:
Add support for externally shared js builtins:
By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.
Contributed by Michael Dawson in https://github.com/nodejs/node/pull/44376
Introduce `File`:
The File class is part of the [FileAPI](https://w3c.github.io/FileAPI/).
It can be used anywhere a Blob can, for example in `URL.createObjectURL`
and `FormData`. It contains two properties that Blobs do not have: `lastModified`,
the last time the file was modified in ms, and `name`, the name of the file.
Contributed by Khafra in https://github.com/nodejs/node/pull/45139
Support function mocking on Node.js test runner:
The `node:test` module supports mocking during testing via a top-level `mock`
object.
```js
test('spies on an object method', (t) => {
const number = {
value: 5,
add(a) {
return this.value + a;
},
};
t.mock.method(number, 'add');
assert.strictEqual(number.add(3), 8);
assert.strictEqual(number.add.mock.calls.length, 1);
});
```
Contributed by Colin Ihrig in https://github.com/nodejs/node/pull/45326
Other notable changes:
build:
* disable v8 snapshot compression by default (Joyee Cheung) https://github.com/nodejs/node/pull/45716
crypto:
* update root certificates (Luigi Pinca) https://github.com/nodejs/node/pull/45490
deps:
* update ICU to 72.1 (Michaël Zasso) https://github.com/nodejs/node/pull/45068
doc:
* add doc-only deprecation for headers/trailers setters (Rich Trott) https://github.com/nodejs/node/pull/45697
* add Rafael to the tsc (Michael Dawson) https://github.com/nodejs/node/pull/45691
* deprecate use of invalid ports in `url.parse` (Antoine du Hamel) https://github.com/nodejs/node/pull/45576
* add lukekarrys to collaborators (Luke Karrys) https://github.com/nodejs/node/pull/45180
* add anonrig to collaborators (Yagiz Nizipli) https://github.com/nodejs/node/pull/45002
* deprecate url.parse() (Rich Trott) https://github.com/nodejs/node/pull/44919
lib:
* drop fetch experimental warning (Matteo Collina) https://github.com/nodejs/node/pull/45287
net:
* (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) https://github.com/nodejs/node/pull/44731
* src:
* (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) https://github.com/nodejs/node/pull/45639
* (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) https://github.com/nodejs/node/pull/42869
test_runner:
* (SEMVER-MINOR) add t.after() hook (Colin Ihrig) https://github.com/nodejs/node/pull/45792
* (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) https://github.com/nodejs/node/pull/45792
tls:
* (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) https://github.com/nodejs/node/pull/44935
* remove trustcor root ca certificates (Ben Noordhuis) https://github.com/nodejs/node/pull/45776
tools:
* update certdata.txt (Luigi Pinca) https://github.com/nodejs/node/pull/45490
util:
* add fast path for utf8 encoding (Yagiz Nizipli) https://github.com/nodejs/node/pull/45412
* improve textdecoder decode performance (Yagiz Nizipli) https://github.com/nodejs/node/pull/45294
* (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) https://github.com/nodejs/node/pull/21128
PR-URL: https://github.com/nodejs/node/pull/46025
2022-12-30 15:18:44 -05:00
|
|
|
- version:
|
|
|
|
- v19.2.0
|
|
|
|
- v18.13.0
|
2022-11-05 05:03:53 -07:00
|
|
|
pr-url: https://github.com/nodejs/node/pull/45290
|
|
|
|
description: diagnostics_channel is now Stable.
|
|
|
|
-->
|
|
|
|
|
2020-11-03 17:57:08 +01:00
|
|
|
<!--introduced_in=v15.1.0-->
|
2020-08-21 16:25:39 -07:00
|
|
|
|
2022-11-05 05:03:53 -07:00
|
|
|
> Stability: 2 - Stable
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
<!-- source_link=lib/diagnostics_channel.js -->
|
|
|
|
|
2022-04-20 10:23:41 +02:00
|
|
|
The `node:diagnostics_channel` module provides an API to create named channels
|
2020-08-21 16:25:39 -07:00
|
|
|
to report arbitrary message data for diagnostics purposes.
|
|
|
|
|
|
|
|
It can be accessed using:
|
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
It is intended that a module writer wanting to report diagnostics messages
|
|
|
|
will create one or many top-level channels to report messages through.
|
|
|
|
Channels may also be acquired at runtime but it is not encouraged
|
|
|
|
due to the additional overhead of doing so. Channels may be exported for
|
|
|
|
convenience, but as long as the name is known it can be acquired anywhere.
|
|
|
|
|
|
|
|
If you intend for your module to produce diagnostics data for others to
|
|
|
|
consume it is recommended that you include documentation of what named
|
|
|
|
channels are used along with the shape of the message data. Channel names
|
|
|
|
should generally include the module name to avoid collisions with data from
|
|
|
|
other modules.
|
|
|
|
|
|
|
|
## Public API
|
|
|
|
|
|
|
|
### Overview
|
|
|
|
|
|
|
|
Following is a simple overview of the public API.
|
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
// Get a reusable channel object
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
2022-04-12 15:54:03 -07:00
|
|
|
function onMessage(message, name) {
|
2021-06-15 10:09:29 -07:00
|
|
|
// Received data
|
2022-04-12 15:54:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Subscribe to the channel
|
|
|
|
diagnostics_channel.subscribe('my-channel', onMessage);
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
// Check if the channel has an active subscriber
|
|
|
|
if (channel.hasSubscribers) {
|
|
|
|
// Publish data to the channel
|
|
|
|
channel.publish({
|
2022-11-17 08:19:12 -05:00
|
|
|
some: 'data',
|
2021-06-15 10:09:29 -07:00
|
|
|
});
|
|
|
|
}
|
2022-04-12 15:54:03 -07:00
|
|
|
|
|
|
|
// Unsubscribe from the channel
|
|
|
|
diagnostics_channel.unsubscribe('my-channel', onMessage);
|
2021-06-15 10:09:29 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
// Get a reusable channel object
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
2022-04-12 15:54:03 -07:00
|
|
|
function onMessage(message, name) {
|
2020-08-21 16:25:39 -07:00
|
|
|
// Received data
|
2022-04-12 15:54:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Subscribe to the channel
|
|
|
|
diagnostics_channel.subscribe('my-channel', onMessage);
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
// Check if the channel has an active subscriber
|
|
|
|
if (channel.hasSubscribers) {
|
|
|
|
// Publish data to the channel
|
|
|
|
channel.publish({
|
2022-11-17 08:19:12 -05:00
|
|
|
some: 'data',
|
2020-08-21 16:25:39 -07:00
|
|
|
});
|
|
|
|
}
|
2022-04-12 15:54:03 -07:00
|
|
|
|
|
|
|
// Unsubscribe from the channel
|
|
|
|
diagnostics_channel.unsubscribe('my-channel', onMessage);
|
2020-08-21 16:25:39 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
#### `diagnostics_channel.hasSubscribers(name)`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
|
|
|
-->
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
* `name` {string|symbol} The channel name
|
|
|
|
* Returns: {boolean} If there are active subscribers
|
|
|
|
|
|
|
|
Check if there are active subscribers to the named channel. This is helpful if
|
|
|
|
the message you want to send might be expensive to prepare.
|
|
|
|
|
|
|
|
This API is optional but helpful when trying to publish messages from very
|
2021-02-11 18:46:45 +01:00
|
|
|
performance-sensitive code.
|
2020-08-21 16:25:39 -07:00
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
if (diagnostics_channel.hasSubscribers('my-channel')) {
|
|
|
|
// There are subscribers, prepare and publish message
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
if (diagnostics_channel.hasSubscribers('my-channel')) {
|
|
|
|
// There are subscribers, prepare and publish message
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `diagnostics_channel.channel(name)`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
|
|
|
-->
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
* `name` {string|symbol} The channel name
|
|
|
|
* Returns: {Channel} The named channel object
|
|
|
|
|
2022-04-12 15:54:03 -07:00
|
|
|
This is the primary entry-point for anyone wanting to publish to a named
|
2020-08-21 16:25:39 -07:00
|
|
|
channel. It produces a channel object which is optimized to reduce overhead at
|
|
|
|
publish time as much as possible.
|
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
```
|
|
|
|
|
2022-04-12 15:54:03 -07:00
|
|
|
#### `diagnostics_channel.subscribe(name, onMessage)`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2022-07-25 22:32:16 -04:00
|
|
|
- v18.7.0
|
2022-08-16, Version 16.17.0 'Gallium' (LTS)
Notable changes:
Adds `util.parseArgs` helper for higher level command-line argument
parsing.
Contributed by Benjamin Coe, John Gee, Darcy Clarke, Joe Sepi,
Kevin Gibbons, Aaron Casanova, Jessica Nahulan, and Jordan Harband.
https://github.com/nodejs/node/pull/42675
Node.js ESM Loader hooks now support multiple custom loaders, and
composition is achieved via "chaining": `foo-loader` calls `bar-loader`
calls `qux-loader` (a custom loader _must_ now signal a short circuit
when intentionally not calling the next). See the ESM docs
(https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) for details.
Contributed by Jacob Smith, Geoffrey Booth, and Bradley Farias.
https://github.com/nodejs/node/pull/42623
The `node:test` module, which was initially introduced in Node.js
v18.0.0, is now available with all the changes done to it up to Node.js
v18.7.0.
To better align Node.js' experimental implementation of the Web Crypto
API with other runtimes, several changes were made:
* Support for CFRG curves was added, with the `'Ed25519'`, `'Ed448'`,
`'X25519'`, and `'X448'` algorithms.
* The proprietary `'NODE-DSA'`, `'NODE-DH'`, `'NODE-SCRYPT'`,
`'NODE-ED25519'`, `'NODE-ED448'`, `'NODE-X25519'`, and `'NODE-X448'`
algorithms were removed.
* The proprietary `'node.keyObject'` import/export format was removed.
Contributed by Filip Skokan.
https://github.com/nodejs/node/pull/42507
https://github.com/nodejs/node/pull/43310
Updated Corepack to 0.12.1 - https://github.com/nodejs/node/pull/43965
Updated ICU to 71.1 - https://github.com/nodejs/node/pull/42655
Updated npm to 8.15.0 - https://github.com/nodejs/node/pull/43917
Updated Undici to 5.8.0 - https://github.com/nodejs/node/pull/43886
(SEMVER-MINOR) crypto: make authTagLength optional for CC20P1305 (Tobias Nießen) https://github.com/nodejs/node/pull/42427
(SEMVER-MINOR) crypto: align webcrypto RSA key import/export with other implementations (Filip Skokan) https://github.com/nodejs/node/pull/42816
(SEMVER-MINOR) dns: export error code constants from `dns/promises` (Feng Yu) https://github.com/nodejs/node/pull/43176
doc: deprecate coercion to integer in process.exit (Daeyeon Jeong) https://github.com/nodejs/node/pull/43738
(SEMVER-MINOR) doc: deprecate diagnostics_channel object subscribe method (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) errors: add support for cause in aborterror (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) events: expose CustomEvent on global with CLI flag (Daeyeon Jeong) https://github.com/nodejs/node/pull/43885
(SEMVER-MINOR) events: add `CustomEvent` (Daeyeon Jeong) https://github.com/nodejs/node/pull/43514
(SEMVER-MINOR) events: propagate abortsignal reason in new AbortError ctor in events (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: propagate abortsignal reason in new AbortSignal constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: make params in writing methods optional (LiviaMedeiros) https://github.com/nodejs/node/pull/42601
(SEMVER-MINOR) fs: add `read(buffer[, options])` versions (LiviaMedeiros) https://github.com/nodejs/node/pull/42768
(SEMVER-MINOR) http: add drop request event for http server (theanarkh) https://github.com/nodejs/node/pull/43806
(SEMVER-MINOR) http: add diagnostics channel for http client (theanarkh) https://github.com/nodejs/node/pull/43580
(SEMVER-MINOR) http: add perf_hooks detail for http request and client (theanarkh) https://github.com/nodejs/node/pull/43361
(SEMVER-MINOR) http: add uniqueHeaders option to request and createServer (Paolo Insogna) https://github.com/nodejs/node/pull/41397
(SEMVER-MINOR) http2: propagate abortsignal reason in new AbortError constructor (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) http2: compat support for array headers (OneNail) https://github.com/nodejs/node/pull/42901
(SEMVER-MINOR) lib: propagate abortsignal reason in new AbortError constructor in blob (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) lib: add abortSignal.throwIfAborted() (James M Snell) https://github.com/nodejs/node/pull/40951
(SEMVER-MINOR) lib: improved diagnostics_channel subscribe/unsubscribe (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) module: add isBuiltIn method (hemanth.hm) https://github.com/nodejs/node/pull/43396
(SEMVER-MINOR) module,repl: support 'node:'-only core modules (Colin Ihrig) https://github.com/nodejs/node/pull/42325
(SEMVER-MINOR) net: add drop event for net server (theanarkh) https://github.com/nodejs/node/pull/43582
(SEMVER-MINOR) net: add ability to reset a tcp socket (pupilTong) https://github.com/nodejs/node/pull/43112
(SEMVER-MINOR) node-api: emit uncaught-exception on unhandled tsfn callbacks (Chengzhong Wu) https://github.com/nodejs/node/pull/36510
(SEMVER-MINOR) perf_hooks: add PerformanceResourceTiming (RafaelGSS) https://github.com/nodejs/node/pull/42725
(SEMVER-MINOR) report: add more heap infos in process report (theanarkh) https://github.com/nodejs/node/pull/43116
(SEMVER-MINOR) src: add --openssl-legacy-provider option (Daniel Bevenius) https://github.com/nodejs/node/pull/40478
(SEMVER-MINOR) src: define fs.constants.S_IWUSR & S_IRUSR for Win (Liviu Ionescu) https://github.com/nodejs/node/pull/42757
(SEMVER-MINOR) src,doc,test: add --openssl-shared-config option (Daniel Bevenius) https://github.com/nodejs/node/pull/43124
(SEMVER-MINOR) stream: use cause options in AbortError constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) stream: add iterator helper find (Nitzan Uziely) https://github.com/nodejs/node/pull/41849
(SEMVER-MINOR) stream: add writableAborted (Robert Nagy) https://github.com/nodejs/node/pull/40802
(SEMVER-MINOR) timers: propagate signal.reason in awaitable timers (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) v8: add v8.startupSnapshot utils (Joyee Cheung) https://github.com/nodejs/node/pull/43329
(SEMVER-MINOR) v8: export more fields in getHeapStatistics (theanarkh) https://github.com/nodejs/node/pull/42784
(SEMVER-MINOR) worker: add hasRef() to MessagePort (Darshan Sen) https://github.com/nodejs/node/pull/42849
PR-URL: https://github.com/nodejs/node/pull/44098
2022-08-02 14:34:18 +02:00
|
|
|
- v16.17.0
|
2022-04-12 15:54:03 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
* `name` {string|symbol} The channel name
|
|
|
|
* `onMessage` {Function} The handler to receive channel messages
|
|
|
|
* `message` {any} The message data
|
|
|
|
* `name` {string|symbol} The name of the channel
|
|
|
|
|
|
|
|
Register a message handler to subscribe to this channel. This message handler
|
|
|
|
will be run synchronously whenever a message is published to the channel. Any
|
|
|
|
errors thrown in the message handler will trigger an [`'uncaughtException'`][].
|
|
|
|
|
|
|
|
```mjs
|
2022-11-06 06:53:23 +09:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2022-04-12 15:54:03 -07:00
|
|
|
|
|
|
|
diagnostics_channel.subscribe('my-channel', (message, name) => {
|
|
|
|
// Received data
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-11-06 06:53:23 +09:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2022-04-12 15:54:03 -07:00
|
|
|
|
|
|
|
diagnostics_channel.subscribe('my-channel', (message, name) => {
|
|
|
|
// Received data
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `diagnostics_channel.unsubscribe(name, onMessage)`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2022-07-25 22:32:16 -04:00
|
|
|
- v18.7.0
|
2022-08-16, Version 16.17.0 'Gallium' (LTS)
Notable changes:
Adds `util.parseArgs` helper for higher level command-line argument
parsing.
Contributed by Benjamin Coe, John Gee, Darcy Clarke, Joe Sepi,
Kevin Gibbons, Aaron Casanova, Jessica Nahulan, and Jordan Harband.
https://github.com/nodejs/node/pull/42675
Node.js ESM Loader hooks now support multiple custom loaders, and
composition is achieved via "chaining": `foo-loader` calls `bar-loader`
calls `qux-loader` (a custom loader _must_ now signal a short circuit
when intentionally not calling the next). See the ESM docs
(https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) for details.
Contributed by Jacob Smith, Geoffrey Booth, and Bradley Farias.
https://github.com/nodejs/node/pull/42623
The `node:test` module, which was initially introduced in Node.js
v18.0.0, is now available with all the changes done to it up to Node.js
v18.7.0.
To better align Node.js' experimental implementation of the Web Crypto
API with other runtimes, several changes were made:
* Support for CFRG curves was added, with the `'Ed25519'`, `'Ed448'`,
`'X25519'`, and `'X448'` algorithms.
* The proprietary `'NODE-DSA'`, `'NODE-DH'`, `'NODE-SCRYPT'`,
`'NODE-ED25519'`, `'NODE-ED448'`, `'NODE-X25519'`, and `'NODE-X448'`
algorithms were removed.
* The proprietary `'node.keyObject'` import/export format was removed.
Contributed by Filip Skokan.
https://github.com/nodejs/node/pull/42507
https://github.com/nodejs/node/pull/43310
Updated Corepack to 0.12.1 - https://github.com/nodejs/node/pull/43965
Updated ICU to 71.1 - https://github.com/nodejs/node/pull/42655
Updated npm to 8.15.0 - https://github.com/nodejs/node/pull/43917
Updated Undici to 5.8.0 - https://github.com/nodejs/node/pull/43886
(SEMVER-MINOR) crypto: make authTagLength optional for CC20P1305 (Tobias Nießen) https://github.com/nodejs/node/pull/42427
(SEMVER-MINOR) crypto: align webcrypto RSA key import/export with other implementations (Filip Skokan) https://github.com/nodejs/node/pull/42816
(SEMVER-MINOR) dns: export error code constants from `dns/promises` (Feng Yu) https://github.com/nodejs/node/pull/43176
doc: deprecate coercion to integer in process.exit (Daeyeon Jeong) https://github.com/nodejs/node/pull/43738
(SEMVER-MINOR) doc: deprecate diagnostics_channel object subscribe method (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) errors: add support for cause in aborterror (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) events: expose CustomEvent on global with CLI flag (Daeyeon Jeong) https://github.com/nodejs/node/pull/43885
(SEMVER-MINOR) events: add `CustomEvent` (Daeyeon Jeong) https://github.com/nodejs/node/pull/43514
(SEMVER-MINOR) events: propagate abortsignal reason in new AbortError ctor in events (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: propagate abortsignal reason in new AbortSignal constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: make params in writing methods optional (LiviaMedeiros) https://github.com/nodejs/node/pull/42601
(SEMVER-MINOR) fs: add `read(buffer[, options])` versions (LiviaMedeiros) https://github.com/nodejs/node/pull/42768
(SEMVER-MINOR) http: add drop request event for http server (theanarkh) https://github.com/nodejs/node/pull/43806
(SEMVER-MINOR) http: add diagnostics channel for http client (theanarkh) https://github.com/nodejs/node/pull/43580
(SEMVER-MINOR) http: add perf_hooks detail for http request and client (theanarkh) https://github.com/nodejs/node/pull/43361
(SEMVER-MINOR) http: add uniqueHeaders option to request and createServer (Paolo Insogna) https://github.com/nodejs/node/pull/41397
(SEMVER-MINOR) http2: propagate abortsignal reason in new AbortError constructor (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) http2: compat support for array headers (OneNail) https://github.com/nodejs/node/pull/42901
(SEMVER-MINOR) lib: propagate abortsignal reason in new AbortError constructor in blob (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) lib: add abortSignal.throwIfAborted() (James M Snell) https://github.com/nodejs/node/pull/40951
(SEMVER-MINOR) lib: improved diagnostics_channel subscribe/unsubscribe (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) module: add isBuiltIn method (hemanth.hm) https://github.com/nodejs/node/pull/43396
(SEMVER-MINOR) module,repl: support 'node:'-only core modules (Colin Ihrig) https://github.com/nodejs/node/pull/42325
(SEMVER-MINOR) net: add drop event for net server (theanarkh) https://github.com/nodejs/node/pull/43582
(SEMVER-MINOR) net: add ability to reset a tcp socket (pupilTong) https://github.com/nodejs/node/pull/43112
(SEMVER-MINOR) node-api: emit uncaught-exception on unhandled tsfn callbacks (Chengzhong Wu) https://github.com/nodejs/node/pull/36510
(SEMVER-MINOR) perf_hooks: add PerformanceResourceTiming (RafaelGSS) https://github.com/nodejs/node/pull/42725
(SEMVER-MINOR) report: add more heap infos in process report (theanarkh) https://github.com/nodejs/node/pull/43116
(SEMVER-MINOR) src: add --openssl-legacy-provider option (Daniel Bevenius) https://github.com/nodejs/node/pull/40478
(SEMVER-MINOR) src: define fs.constants.S_IWUSR & S_IRUSR for Win (Liviu Ionescu) https://github.com/nodejs/node/pull/42757
(SEMVER-MINOR) src,doc,test: add --openssl-shared-config option (Daniel Bevenius) https://github.com/nodejs/node/pull/43124
(SEMVER-MINOR) stream: use cause options in AbortError constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) stream: add iterator helper find (Nitzan Uziely) https://github.com/nodejs/node/pull/41849
(SEMVER-MINOR) stream: add writableAborted (Robert Nagy) https://github.com/nodejs/node/pull/40802
(SEMVER-MINOR) timers: propagate signal.reason in awaitable timers (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) v8: add v8.startupSnapshot utils (Joyee Cheung) https://github.com/nodejs/node/pull/43329
(SEMVER-MINOR) v8: export more fields in getHeapStatistics (theanarkh) https://github.com/nodejs/node/pull/42784
(SEMVER-MINOR) worker: add hasRef() to MessagePort (Darshan Sen) https://github.com/nodejs/node/pull/42849
PR-URL: https://github.com/nodejs/node/pull/44098
2022-08-02 14:34:18 +02:00
|
|
|
- v16.17.0
|
2022-04-12 15:54:03 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
* `name` {string|symbol} The channel name
|
|
|
|
* `onMessage` {Function} The previous subscribed handler to remove
|
|
|
|
* Returns: {boolean} `true` if the handler was found, `false` otherwise.
|
|
|
|
|
|
|
|
Remove a message handler previously registered to this channel with
|
|
|
|
[`diagnostics_channel.subscribe(name, onMessage)`][].
|
|
|
|
|
|
|
|
```mjs
|
2022-11-06 06:53:23 +09:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2022-04-12 15:54:03 -07:00
|
|
|
|
|
|
|
function onMessage(message, name) {
|
|
|
|
// Received data
|
|
|
|
}
|
|
|
|
|
|
|
|
diagnostics_channel.subscribe('my-channel', onMessage);
|
|
|
|
|
|
|
|
diagnostics_channel.unsubscribe('my-channel', onMessage);
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-11-06 06:53:23 +09:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2022-04-12 15:54:03 -07:00
|
|
|
|
|
|
|
function onMessage(message, name) {
|
|
|
|
// Received data
|
|
|
|
}
|
|
|
|
|
|
|
|
diagnostics_channel.subscribe('my-channel', onMessage);
|
|
|
|
|
|
|
|
diagnostics_channel.unsubscribe('my-channel', onMessage);
|
|
|
|
```
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
#### `diagnostics_channel.tracingChannel(nameOrChannels)`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `nameOrChannels` {string|TracingChannel} Channel name or
|
|
|
|
object containing all the [TracingChannel Channels][]
|
|
|
|
* Returns: {TracingChannel} Collection of channels to trace with
|
|
|
|
|
|
|
|
Creates a [`TracingChannel`][] wrapper for the given
|
|
|
|
[TracingChannel Channels][]. If a name is given, the corresponding tracing
|
|
|
|
channels will be created in the form of `tracing:${name}:${eventType}` where
|
|
|
|
`eventType` corresponds to the types of [TracingChannel Channels][].
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channelsByName = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
// or...
|
|
|
|
|
|
|
|
const channelsByCollection = diagnostics_channel.tracingChannel({
|
|
|
|
start: diagnostics_channel.channel('tracing:my-channel:start'),
|
|
|
|
end: diagnostics_channel.channel('tracing:my-channel:end'),
|
|
|
|
asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
|
|
|
|
asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
|
|
|
|
error: diagnostics_channel.channel('tracing:my-channel:error'),
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channelsByName = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
// or...
|
|
|
|
|
|
|
|
const channelsByCollection = diagnostics_channel.tracingChannel({
|
|
|
|
start: diagnostics_channel.channel('tracing:my-channel:start'),
|
|
|
|
end: diagnostics_channel.channel('tracing:my-channel:end'),
|
|
|
|
asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
|
|
|
|
asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
|
|
|
|
error: diagnostics_channel.channel('tracing:my-channel:error'),
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
### Class: `Channel`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
|
|
|
-->
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
The class `Channel` represents an individual named channel within the data
|
2022-08-10 10:47:59 -05:00
|
|
|
pipeline. It is used to track subscribers and to publish messages when there
|
2020-08-21 16:25:39 -07:00
|
|
|
are subscribers present. It exists as a separate object to avoid channel
|
|
|
|
lookups at publish time, enabling very fast publish speeds and allowing
|
|
|
|
for heavy use while incurring very minimal cost. Channels are created with
|
|
|
|
[`diagnostics_channel.channel(name)`][], constructing a channel directly
|
|
|
|
with `new Channel(name)` is not supported.
|
|
|
|
|
|
|
|
#### `channel.hasSubscribers`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
|
|
|
-->
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
* Returns: {boolean} If there are active subscribers
|
|
|
|
|
|
|
|
Check if there are active subscribers to this channel. This is helpful if
|
|
|
|
the message you want to send might be expensive to prepare.
|
|
|
|
|
|
|
|
This API is optional but helpful when trying to publish messages from very
|
2021-02-11 18:46:45 +01:00
|
|
|
performance-sensitive code.
|
2020-08-21 16:25:39 -07:00
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
if (channel.hasSubscribers) {
|
|
|
|
// There are subscribers, prepare and publish message
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
if (channel.hasSubscribers) {
|
|
|
|
// There are subscribers, prepare and publish message
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `channel.publish(message)`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
|
|
|
-->
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
* `message` {any} The message to send to the channel subscribers
|
|
|
|
|
|
|
|
Publish a message to any subscribers to the channel. This will trigger
|
|
|
|
message handlers synchronously so they will execute within the same context.
|
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.publish({
|
2022-11-17 08:19:12 -05:00
|
|
|
some: 'message',
|
2021-06-15 10:09:29 -07:00
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.publish({
|
2022-11-17 08:19:12 -05:00
|
|
|
some: 'message',
|
2020-08-21 16:25:39 -07:00
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `channel.subscribe(onMessage)`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
2022-08-16, Version 16.17.0 'Gallium' (LTS)
Notable changes:
Adds `util.parseArgs` helper for higher level command-line argument
parsing.
Contributed by Benjamin Coe, John Gee, Darcy Clarke, Joe Sepi,
Kevin Gibbons, Aaron Casanova, Jessica Nahulan, and Jordan Harband.
https://github.com/nodejs/node/pull/42675
Node.js ESM Loader hooks now support multiple custom loaders, and
composition is achieved via "chaining": `foo-loader` calls `bar-loader`
calls `qux-loader` (a custom loader _must_ now signal a short circuit
when intentionally not calling the next). See the ESM docs
(https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) for details.
Contributed by Jacob Smith, Geoffrey Booth, and Bradley Farias.
https://github.com/nodejs/node/pull/42623
The `node:test` module, which was initially introduced in Node.js
v18.0.0, is now available with all the changes done to it up to Node.js
v18.7.0.
To better align Node.js' experimental implementation of the Web Crypto
API with other runtimes, several changes were made:
* Support for CFRG curves was added, with the `'Ed25519'`, `'Ed448'`,
`'X25519'`, and `'X448'` algorithms.
* The proprietary `'NODE-DSA'`, `'NODE-DH'`, `'NODE-SCRYPT'`,
`'NODE-ED25519'`, `'NODE-ED448'`, `'NODE-X25519'`, and `'NODE-X448'`
algorithms were removed.
* The proprietary `'node.keyObject'` import/export format was removed.
Contributed by Filip Skokan.
https://github.com/nodejs/node/pull/42507
https://github.com/nodejs/node/pull/43310
Updated Corepack to 0.12.1 - https://github.com/nodejs/node/pull/43965
Updated ICU to 71.1 - https://github.com/nodejs/node/pull/42655
Updated npm to 8.15.0 - https://github.com/nodejs/node/pull/43917
Updated Undici to 5.8.0 - https://github.com/nodejs/node/pull/43886
(SEMVER-MINOR) crypto: make authTagLength optional for CC20P1305 (Tobias Nießen) https://github.com/nodejs/node/pull/42427
(SEMVER-MINOR) crypto: align webcrypto RSA key import/export with other implementations (Filip Skokan) https://github.com/nodejs/node/pull/42816
(SEMVER-MINOR) dns: export error code constants from `dns/promises` (Feng Yu) https://github.com/nodejs/node/pull/43176
doc: deprecate coercion to integer in process.exit (Daeyeon Jeong) https://github.com/nodejs/node/pull/43738
(SEMVER-MINOR) doc: deprecate diagnostics_channel object subscribe method (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) errors: add support for cause in aborterror (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) events: expose CustomEvent on global with CLI flag (Daeyeon Jeong) https://github.com/nodejs/node/pull/43885
(SEMVER-MINOR) events: add `CustomEvent` (Daeyeon Jeong) https://github.com/nodejs/node/pull/43514
(SEMVER-MINOR) events: propagate abortsignal reason in new AbortError ctor in events (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: propagate abortsignal reason in new AbortSignal constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: make params in writing methods optional (LiviaMedeiros) https://github.com/nodejs/node/pull/42601
(SEMVER-MINOR) fs: add `read(buffer[, options])` versions (LiviaMedeiros) https://github.com/nodejs/node/pull/42768
(SEMVER-MINOR) http: add drop request event for http server (theanarkh) https://github.com/nodejs/node/pull/43806
(SEMVER-MINOR) http: add diagnostics channel for http client (theanarkh) https://github.com/nodejs/node/pull/43580
(SEMVER-MINOR) http: add perf_hooks detail for http request and client (theanarkh) https://github.com/nodejs/node/pull/43361
(SEMVER-MINOR) http: add uniqueHeaders option to request and createServer (Paolo Insogna) https://github.com/nodejs/node/pull/41397
(SEMVER-MINOR) http2: propagate abortsignal reason in new AbortError constructor (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) http2: compat support for array headers (OneNail) https://github.com/nodejs/node/pull/42901
(SEMVER-MINOR) lib: propagate abortsignal reason in new AbortError constructor in blob (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) lib: add abortSignal.throwIfAborted() (James M Snell) https://github.com/nodejs/node/pull/40951
(SEMVER-MINOR) lib: improved diagnostics_channel subscribe/unsubscribe (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) module: add isBuiltIn method (hemanth.hm) https://github.com/nodejs/node/pull/43396
(SEMVER-MINOR) module,repl: support 'node:'-only core modules (Colin Ihrig) https://github.com/nodejs/node/pull/42325
(SEMVER-MINOR) net: add drop event for net server (theanarkh) https://github.com/nodejs/node/pull/43582
(SEMVER-MINOR) net: add ability to reset a tcp socket (pupilTong) https://github.com/nodejs/node/pull/43112
(SEMVER-MINOR) node-api: emit uncaught-exception on unhandled tsfn callbacks (Chengzhong Wu) https://github.com/nodejs/node/pull/36510
(SEMVER-MINOR) perf_hooks: add PerformanceResourceTiming (RafaelGSS) https://github.com/nodejs/node/pull/42725
(SEMVER-MINOR) report: add more heap infos in process report (theanarkh) https://github.com/nodejs/node/pull/43116
(SEMVER-MINOR) src: add --openssl-legacy-provider option (Daniel Bevenius) https://github.com/nodejs/node/pull/40478
(SEMVER-MINOR) src: define fs.constants.S_IWUSR & S_IRUSR for Win (Liviu Ionescu) https://github.com/nodejs/node/pull/42757
(SEMVER-MINOR) src,doc,test: add --openssl-shared-config option (Daniel Bevenius) https://github.com/nodejs/node/pull/43124
(SEMVER-MINOR) stream: use cause options in AbortError constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) stream: add iterator helper find (Nitzan Uziely) https://github.com/nodejs/node/pull/41849
(SEMVER-MINOR) stream: add writableAborted (Robert Nagy) https://github.com/nodejs/node/pull/40802
(SEMVER-MINOR) timers: propagate signal.reason in awaitable timers (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) v8: add v8.startupSnapshot utils (Joyee Cheung) https://github.com/nodejs/node/pull/43329
(SEMVER-MINOR) v8: export more fields in getHeapStatistics (theanarkh) https://github.com/nodejs/node/pull/42784
(SEMVER-MINOR) worker: add hasRef() to MessagePort (Darshan Sen) https://github.com/nodejs/node/pull/42849
PR-URL: https://github.com/nodejs/node/pull/44098
2022-08-02 14:34:18 +02:00
|
|
|
deprecated:
|
|
|
|
- v18.7.0
|
|
|
|
- v16.17.0
|
2021-09-24 13:47:58 +02:00
|
|
|
-->
|
|
|
|
|
2022-05-31 10:52:09 -07:00
|
|
|
> Stability: 0 - Deprecated: Use [`diagnostics_channel.subscribe(name, onMessage)`][]
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
* `onMessage` {Function} The handler to receive channel messages
|
|
|
|
* `message` {any} The message data
|
|
|
|
* `name` {string|symbol} The name of the channel
|
|
|
|
|
|
|
|
Register a message handler to subscribe to this channel. This message handler
|
|
|
|
will be run synchronously whenever a message is published to the channel. Any
|
|
|
|
errors thrown in the message handler will trigger an [`'uncaughtException'`][].
|
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.subscribe((message, name) => {
|
|
|
|
// Received data
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.subscribe((message, name) => {
|
|
|
|
// Received data
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `channel.unsubscribe(onMessage)`
|
|
|
|
|
2021-09-24 13:47:58 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v15.1.0
|
|
|
|
- v14.17.0
|
2022-08-16, Version 16.17.0 'Gallium' (LTS)
Notable changes:
Adds `util.parseArgs` helper for higher level command-line argument
parsing.
Contributed by Benjamin Coe, John Gee, Darcy Clarke, Joe Sepi,
Kevin Gibbons, Aaron Casanova, Jessica Nahulan, and Jordan Harband.
https://github.com/nodejs/node/pull/42675
Node.js ESM Loader hooks now support multiple custom loaders, and
composition is achieved via "chaining": `foo-loader` calls `bar-loader`
calls `qux-loader` (a custom loader _must_ now signal a short circuit
when intentionally not calling the next). See the ESM docs
(https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) for details.
Contributed by Jacob Smith, Geoffrey Booth, and Bradley Farias.
https://github.com/nodejs/node/pull/42623
The `node:test` module, which was initially introduced in Node.js
v18.0.0, is now available with all the changes done to it up to Node.js
v18.7.0.
To better align Node.js' experimental implementation of the Web Crypto
API with other runtimes, several changes were made:
* Support for CFRG curves was added, with the `'Ed25519'`, `'Ed448'`,
`'X25519'`, and `'X448'` algorithms.
* The proprietary `'NODE-DSA'`, `'NODE-DH'`, `'NODE-SCRYPT'`,
`'NODE-ED25519'`, `'NODE-ED448'`, `'NODE-X25519'`, and `'NODE-X448'`
algorithms were removed.
* The proprietary `'node.keyObject'` import/export format was removed.
Contributed by Filip Skokan.
https://github.com/nodejs/node/pull/42507
https://github.com/nodejs/node/pull/43310
Updated Corepack to 0.12.1 - https://github.com/nodejs/node/pull/43965
Updated ICU to 71.1 - https://github.com/nodejs/node/pull/42655
Updated npm to 8.15.0 - https://github.com/nodejs/node/pull/43917
Updated Undici to 5.8.0 - https://github.com/nodejs/node/pull/43886
(SEMVER-MINOR) crypto: make authTagLength optional for CC20P1305 (Tobias Nießen) https://github.com/nodejs/node/pull/42427
(SEMVER-MINOR) crypto: align webcrypto RSA key import/export with other implementations (Filip Skokan) https://github.com/nodejs/node/pull/42816
(SEMVER-MINOR) dns: export error code constants from `dns/promises` (Feng Yu) https://github.com/nodejs/node/pull/43176
doc: deprecate coercion to integer in process.exit (Daeyeon Jeong) https://github.com/nodejs/node/pull/43738
(SEMVER-MINOR) doc: deprecate diagnostics_channel object subscribe method (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) errors: add support for cause in aborterror (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) events: expose CustomEvent on global with CLI flag (Daeyeon Jeong) https://github.com/nodejs/node/pull/43885
(SEMVER-MINOR) events: add `CustomEvent` (Daeyeon Jeong) https://github.com/nodejs/node/pull/43514
(SEMVER-MINOR) events: propagate abortsignal reason in new AbortError ctor in events (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: propagate abortsignal reason in new AbortSignal constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) fs: make params in writing methods optional (LiviaMedeiros) https://github.com/nodejs/node/pull/42601
(SEMVER-MINOR) fs: add `read(buffer[, options])` versions (LiviaMedeiros) https://github.com/nodejs/node/pull/42768
(SEMVER-MINOR) http: add drop request event for http server (theanarkh) https://github.com/nodejs/node/pull/43806
(SEMVER-MINOR) http: add diagnostics channel for http client (theanarkh) https://github.com/nodejs/node/pull/43580
(SEMVER-MINOR) http: add perf_hooks detail for http request and client (theanarkh) https://github.com/nodejs/node/pull/43361
(SEMVER-MINOR) http: add uniqueHeaders option to request and createServer (Paolo Insogna) https://github.com/nodejs/node/pull/41397
(SEMVER-MINOR) http2: propagate abortsignal reason in new AbortError constructor (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) http2: compat support for array headers (OneNail) https://github.com/nodejs/node/pull/42901
(SEMVER-MINOR) lib: propagate abortsignal reason in new AbortError constructor in blob (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) lib: add abortSignal.throwIfAborted() (James M Snell) https://github.com/nodejs/node/pull/40951
(SEMVER-MINOR) lib: improved diagnostics_channel subscribe/unsubscribe (Stephen Belanger) https://github.com/nodejs/node/pull/42714
(SEMVER-MINOR) module: add isBuiltIn method (hemanth.hm) https://github.com/nodejs/node/pull/43396
(SEMVER-MINOR) module,repl: support 'node:'-only core modules (Colin Ihrig) https://github.com/nodejs/node/pull/42325
(SEMVER-MINOR) net: add drop event for net server (theanarkh) https://github.com/nodejs/node/pull/43582
(SEMVER-MINOR) net: add ability to reset a tcp socket (pupilTong) https://github.com/nodejs/node/pull/43112
(SEMVER-MINOR) node-api: emit uncaught-exception on unhandled tsfn callbacks (Chengzhong Wu) https://github.com/nodejs/node/pull/36510
(SEMVER-MINOR) perf_hooks: add PerformanceResourceTiming (RafaelGSS) https://github.com/nodejs/node/pull/42725
(SEMVER-MINOR) report: add more heap infos in process report (theanarkh) https://github.com/nodejs/node/pull/43116
(SEMVER-MINOR) src: add --openssl-legacy-provider option (Daniel Bevenius) https://github.com/nodejs/node/pull/40478
(SEMVER-MINOR) src: define fs.constants.S_IWUSR & S_IRUSR for Win (Liviu Ionescu) https://github.com/nodejs/node/pull/42757
(SEMVER-MINOR) src,doc,test: add --openssl-shared-config option (Daniel Bevenius) https://github.com/nodejs/node/pull/43124
(SEMVER-MINOR) stream: use cause options in AbortError constructors (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) stream: add iterator helper find (Nitzan Uziely) https://github.com/nodejs/node/pull/41849
(SEMVER-MINOR) stream: add writableAborted (Robert Nagy) https://github.com/nodejs/node/pull/40802
(SEMVER-MINOR) timers: propagate signal.reason in awaitable timers (James M Snell) https://github.com/nodejs/node/pull/41008
(SEMVER-MINOR) v8: add v8.startupSnapshot utils (Joyee Cheung) https://github.com/nodejs/node/pull/43329
(SEMVER-MINOR) v8: export more fields in getHeapStatistics (theanarkh) https://github.com/nodejs/node/pull/42784
(SEMVER-MINOR) worker: add hasRef() to MessagePort (Darshan Sen) https://github.com/nodejs/node/pull/42849
PR-URL: https://github.com/nodejs/node/pull/44098
2022-08-02 14:34:18 +02:00
|
|
|
deprecated:
|
|
|
|
- v18.7.0
|
|
|
|
- v16.17.0
|
2021-10-19 11:56:42 +02:00
|
|
|
changes:
|
2022-01-25 13:22:09 -05:00
|
|
|
- version:
|
|
|
|
- v17.1.0
|
2022-02-01 00:34:51 -05:00
|
|
|
- v16.14.0
|
2022-01-25 13:22:09 -05:00
|
|
|
- v14.19.0
|
2021-10-19 11:56:42 +02:00
|
|
|
pr-url: https://github.com/nodejs/node/pull/40433
|
2021-10-19 12:01:41 +02:00
|
|
|
description: Added return value. Added to channels without subscribers.
|
2021-09-24 13:47:58 +02:00
|
|
|
-->
|
|
|
|
|
2022-05-31 10:52:09 -07:00
|
|
|
> Stability: 0 - Deprecated: Use [`diagnostics_channel.unsubscribe(name, onMessage)`][]
|
|
|
|
|
2020-08-21 16:25:39 -07:00
|
|
|
* `onMessage` {Function} The previous subscribed handler to remove
|
2021-10-19 11:56:42 +02:00
|
|
|
* Returns: {boolean} `true` if the handler was found, `false` otherwise.
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
Remove a message handler previously registered to this channel with
|
|
|
|
[`channel.subscribe(onMessage)`][].
|
|
|
|
|
2021-06-15 10:09:29 -07:00
|
|
|
```mjs
|
2022-04-20 10:23:41 +02:00
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
2021-06-15 10:09:29 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
function onMessage(message, name) {
|
|
|
|
// Received data
|
|
|
|
}
|
|
|
|
|
|
|
|
channel.subscribe(onMessage);
|
|
|
|
|
|
|
|
channel.unsubscribe(onMessage);
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
2022-04-20 10:23:41 +02:00
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
2020-08-21 16:25:39 -07:00
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
function onMessage(message, name) {
|
|
|
|
// Received data
|
|
|
|
}
|
|
|
|
|
|
|
|
channel.subscribe(onMessage);
|
|
|
|
|
|
|
|
channel.unsubscribe(onMessage);
|
|
|
|
```
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
#### `channel.bindStore(store[, transform])`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `store` {AsyncLocalStorage} The store to which to bind the context data
|
|
|
|
* `transform` {Function} Transform context data before setting the store context
|
|
|
|
|
|
|
|
When [`channel.runStores(context, ...)`][] is called, the given context data
|
|
|
|
will be applied to any store bound to the channel. If the store has already been
|
|
|
|
bound the previous `transform` function will be replaced with the new one.
|
|
|
|
The `transform` function may be omitted to set the given context data as the
|
|
|
|
context directly.
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
|
|
|
|
|
const store = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.bindStore(store, (data) => {
|
|
|
|
return { data };
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
const { AsyncLocalStorage } = require('node:async_hooks');
|
|
|
|
|
|
|
|
const store = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.bindStore(store, (data) => {
|
|
|
|
return { data };
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `channel.unbindStore(store)`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `store` {AsyncLocalStorage} The store to unbind from the channel.
|
|
|
|
* Returns: {boolean} `true` if the store was found, `false` otherwise.
|
|
|
|
|
|
|
|
Remove a message handler previously registered to this channel with
|
|
|
|
[`channel.bindStore(store)`][].
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
|
|
|
|
|
const store = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.bindStore(store);
|
|
|
|
channel.unbindStore(store);
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
const { AsyncLocalStorage } = require('node:async_hooks');
|
|
|
|
|
|
|
|
const store = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.bindStore(store);
|
|
|
|
channel.unbindStore(store);
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `channel.runStores(context, fn[, thisArg[, ...args]])`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `context` {any} Message to send to subscribers and bind to stores
|
|
|
|
* `fn` {Function} Handler to run within the entered storage context
|
|
|
|
* `thisArg` {any} The receiver to be used for the function call.
|
|
|
|
* `...args` {any} Optional arguments to pass to the function.
|
|
|
|
|
|
|
|
Applies the given data to any AsyncLocalStorage instances bound to the channel
|
|
|
|
for the duration of the given function, then publishes to the channel within
|
|
|
|
the scope of that data is applied to the stores.
|
|
|
|
|
|
|
|
If a transform function was given to [`channel.bindStore(store)`][] it will be
|
|
|
|
applied to transform the message data before it becomes the context value for
|
|
|
|
the store. The prior storage context is accessible from within the transform
|
|
|
|
function in cases where context linking is required.
|
|
|
|
|
2023-04-23 17:04:08 +03:30
|
|
|
The context applied to the store should be accessible in any async code which
|
2023-03-31 10:40:30 -07:00
|
|
|
continues from execution which began during the given function, however
|
|
|
|
there are some situations in which [context loss][] may occur.
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
|
|
|
|
|
const store = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.bindStore(store, (message) => {
|
|
|
|
const parent = store.getStore();
|
|
|
|
return new Span(message, parent);
|
|
|
|
});
|
|
|
|
channel.runStores({ some: 'message' }, () => {
|
|
|
|
store.getStore(); // Span({ some: 'message' })
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
const { AsyncLocalStorage } = require('node:async_hooks');
|
|
|
|
|
|
|
|
const store = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
const channel = diagnostics_channel.channel('my-channel');
|
|
|
|
|
|
|
|
channel.bindStore(store, (message) => {
|
|
|
|
const parent = store.getStore();
|
|
|
|
return new Span(message, parent);
|
|
|
|
});
|
|
|
|
channel.runStores({ some: 'message' }, () => {
|
|
|
|
store.getStore(); // Span({ some: 'message' })
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
### Class: `TracingChannel`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
The class `TracingChannel` is a collection of [TracingChannel Channels][] which
|
|
|
|
together express a single traceable action. It is used to formalize and
|
|
|
|
simplify the process of producing events for tracing application flow.
|
|
|
|
[`diagnostics_channel.tracingChannel()`][] is used to construct a
|
|
|
|
`TracingChannel`. As with `Channel` it is recommended to create and reuse a
|
|
|
|
single `TracingChannel` at the top-level of the file rather than creating them
|
|
|
|
dynamically.
|
|
|
|
|
|
|
|
#### `tracingChannel.subscribe(subscribers)`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `subscribers` {Object} Set of [TracingChannel Channels][] subscribers
|
|
|
|
* `start` {Function} The [`start` event][] subscriber
|
|
|
|
* `end` {Function} The [`end` event][] subscriber
|
|
|
|
* `asyncStart` {Function} The [`asyncStart` event][] subscriber
|
|
|
|
* `asyncEnd` {Function} The [`asyncEnd` event][] subscriber
|
|
|
|
* `error` {Function} The [`error` event][] subscriber
|
|
|
|
|
|
|
|
Helper to subscribe a collection of functions to the corresponding channels.
|
|
|
|
This is the same as calling [`channel.subscribe(onMessage)`][] on each channel
|
|
|
|
individually.
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.subscribe({
|
|
|
|
start(message) {
|
|
|
|
// Handle start message
|
|
|
|
},
|
|
|
|
end(message) {
|
|
|
|
// Handle end message
|
|
|
|
},
|
|
|
|
asyncStart(message) {
|
|
|
|
// Handle asyncStart message
|
|
|
|
},
|
|
|
|
asyncEnd(message) {
|
|
|
|
// Handle asyncEnd message
|
|
|
|
},
|
|
|
|
error(message) {
|
|
|
|
// Handle error message
|
|
|
|
},
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.subscribe({
|
|
|
|
start(message) {
|
|
|
|
// Handle start message
|
|
|
|
},
|
|
|
|
end(message) {
|
|
|
|
// Handle end message
|
|
|
|
},
|
|
|
|
asyncStart(message) {
|
|
|
|
// Handle asyncStart message
|
|
|
|
},
|
|
|
|
asyncEnd(message) {
|
|
|
|
// Handle asyncEnd message
|
|
|
|
},
|
|
|
|
error(message) {
|
|
|
|
// Handle error message
|
|
|
|
},
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `tracingChannel.unsubscribe(subscribers)`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `subscribers` {Object} Set of [TracingChannel Channels][] subscribers
|
|
|
|
* `start` {Function} The [`start` event][] subscriber
|
|
|
|
* `end` {Function} The [`end` event][] subscriber
|
|
|
|
* `asyncStart` {Function} The [`asyncStart` event][] subscriber
|
|
|
|
* `asyncEnd` {Function} The [`asyncEnd` event][] subscriber
|
|
|
|
* `error` {Function} The [`error` event][] subscriber
|
|
|
|
* Returns: {boolean} `true` if all handlers were successfully unsubscribed,
|
|
|
|
and `false` otherwise.
|
|
|
|
|
|
|
|
Helper to unsubscribe a collection of functions from the corresponding channels.
|
|
|
|
This is the same as calling [`channel.unsubscribe(onMessage)`][] on each channel
|
|
|
|
individually.
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.unsubscribe({
|
|
|
|
start(message) {
|
|
|
|
// Handle start message
|
|
|
|
},
|
|
|
|
end(message) {
|
|
|
|
// Handle end message
|
|
|
|
},
|
|
|
|
asyncStart(message) {
|
|
|
|
// Handle asyncStart message
|
|
|
|
},
|
|
|
|
asyncEnd(message) {
|
|
|
|
// Handle asyncEnd message
|
|
|
|
},
|
|
|
|
error(message) {
|
|
|
|
// Handle error message
|
|
|
|
},
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.unsubscribe({
|
|
|
|
start(message) {
|
|
|
|
// Handle start message
|
|
|
|
},
|
|
|
|
end(message) {
|
|
|
|
// Handle end message
|
|
|
|
},
|
|
|
|
asyncStart(message) {
|
|
|
|
// Handle asyncStart message
|
|
|
|
},
|
|
|
|
asyncEnd(message) {
|
|
|
|
// Handle asyncEnd message
|
|
|
|
},
|
|
|
|
error(message) {
|
|
|
|
// Handle error message
|
|
|
|
},
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `tracingChannel.traceSync(fn[, context[, thisArg[, ...args]]])`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `fn` {Function} Function to wrap a trace around
|
|
|
|
* `context` {Object} Shared object to correlate events through
|
|
|
|
* `thisArg` {any} The receiver to be used for the function call
|
|
|
|
* `...args` {any} Optional arguments to pass to the function
|
|
|
|
* Returns: {any} The return value of the given function
|
|
|
|
|
|
|
|
Trace a synchronous function call. This will always produce a [`start` event][]
|
|
|
|
and [`end` event][] around the execution and may produce an [`error` event][]
|
|
|
|
if the given function throws an error. This will run the given function using
|
|
|
|
[`channel.runStores(context, ...)`][] on the `start` channel which ensures all
|
|
|
|
events should have any bound stores set to match this trace context.
|
|
|
|
|
2024-03-06 19:03:32 -08:00
|
|
|
To ensure only correct trace graphs are formed, events will only be published
|
|
|
|
if subscribers are present prior to starting the trace. Subscriptions which are
|
|
|
|
added after the trace begins will not receive future events from that trace,
|
|
|
|
only future traces will be seen.
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.traceSync(() => {
|
|
|
|
// Do something
|
|
|
|
}, {
|
|
|
|
some: 'thing',
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.traceSync(() => {
|
|
|
|
// Do something
|
|
|
|
}, {
|
|
|
|
some: 'thing',
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
#### `tracingChannel.tracePromise(fn[, context[, thisArg[, ...args]]])`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `fn` {Function} Promise-returning function to wrap a trace around
|
|
|
|
* `context` {Object} Shared object to correlate trace events through
|
|
|
|
* `thisArg` {any} The receiver to be used for the function call
|
|
|
|
* `...args` {any} Optional arguments to pass to the function
|
|
|
|
* Returns: {Promise} Chained from promise returned by the given function
|
|
|
|
|
|
|
|
Trace a promise-returning function call. This will always produce a
|
|
|
|
[`start` event][] and [`end` event][] around the synchronous portion of the
|
|
|
|
function execution, and will produce an [`asyncStart` event][] and
|
|
|
|
[`asyncEnd` event][] when a promise continuation is reached. It may also
|
|
|
|
produce an [`error` event][] if the given function throws an error or the
|
|
|
|
returned promise rejects. This will run the given function using
|
|
|
|
[`channel.runStores(context, ...)`][] on the `start` channel which ensures all
|
|
|
|
events should have any bound stores set to match this trace context.
|
|
|
|
|
2024-03-06 19:03:32 -08:00
|
|
|
To ensure only correct trace graphs are formed, events will only be published
|
|
|
|
if subscribers are present prior to starting the trace. Subscriptions which are
|
|
|
|
added after the trace begins will not receive future events from that trace,
|
|
|
|
only future traces will be seen.
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.tracePromise(async () => {
|
|
|
|
// Do something
|
|
|
|
}, {
|
|
|
|
some: 'thing',
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.tracePromise(async () => {
|
|
|
|
// Do something
|
|
|
|
}, {
|
|
|
|
some: 'thing',
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2023-12-08 22:01:23 +01:00
|
|
|
#### `tracingChannel.traceCallback(fn, position, context, thisArg, ...args)`
|
2023-03-31 10:40:30 -07:00
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
2023-04-05 23:24:18 -03:00
|
|
|
- v19.9.0
|
2023-11-27 12:19:49 +01:00
|
|
|
- v18.19.0
|
2023-03-31 10:40:30 -07:00
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* `fn` {Function} callback using function to wrap a trace around
|
|
|
|
* `position` {number} Zero-indexed argument position of expected callback
|
2023-12-08 22:01:23 +01:00
|
|
|
(defaults to last argument if `undefined` is passed)
|
|
|
|
* `context` {Object} Shared object to correlate trace events through (defaults
|
|
|
|
to `{}` if `undefined` is passed)
|
2023-03-31 10:40:30 -07:00
|
|
|
* `thisArg` {any} The receiver to be used for the function call
|
2023-12-08 22:01:23 +01:00
|
|
|
* `...args` {any} arguments to pass to the function (must include the callback)
|
2023-03-31 10:40:30 -07:00
|
|
|
* Returns: {any} The return value of the given function
|
|
|
|
|
2023-12-08 22:01:23 +01:00
|
|
|
Trace a callback-receiving function call. The callback is expected to follow
|
|
|
|
the error as first arg convention typically used. This will always produce a
|
2023-03-31 10:40:30 -07:00
|
|
|
[`start` event][] and [`end` event][] around the synchronous portion of the
|
|
|
|
function execution, and will produce a [`asyncStart` event][] and
|
|
|
|
[`asyncEnd` event][] around the callback execution. It may also produce an
|
2023-12-08 22:01:23 +01:00
|
|
|
[`error` event][] if the given function throws or the first argument passed to
|
|
|
|
the callback is set. This will run the given function using
|
2023-03-31 10:40:30 -07:00
|
|
|
[`channel.runStores(context, ...)`][] on the `start` channel which ensures all
|
|
|
|
events should have any bound stores set to match this trace context.
|
|
|
|
|
2024-03-06 19:03:32 -08:00
|
|
|
To ensure only correct trace graphs are formed, events will only be published
|
|
|
|
if subscribers are present prior to starting the trace. Subscriptions which are
|
|
|
|
added after the trace begins will not receive future events from that trace,
|
|
|
|
only future traces will be seen.
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.traceCallback((arg1, callback) => {
|
|
|
|
// Do something
|
|
|
|
callback(null, 'result');
|
|
|
|
}, 1, {
|
|
|
|
some: 'thing',
|
|
|
|
}, thisArg, arg1, callback);
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
channels.traceCallback((arg1, callback) => {
|
|
|
|
// Do something
|
|
|
|
callback(null, 'result');
|
|
|
|
}, {
|
|
|
|
some: 'thing',
|
|
|
|
}, thisArg, arg1, callback);
|
|
|
|
```
|
|
|
|
|
|
|
|
The callback will also be run with [`channel.runStores(context, ...)`][] which
|
|
|
|
enables context loss recovery in some cases.
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
const myStore = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
// The start channel sets the initial store data to something
|
|
|
|
// and stores that store data value on the trace context object
|
|
|
|
channels.start.bindStore(myStore, (data) => {
|
|
|
|
const span = new Span(data);
|
|
|
|
data.span = span;
|
|
|
|
return span;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Then asyncStart can restore from that data it stored previously
|
|
|
|
channels.asyncStart.bindStore(myStore, (data) => {
|
|
|
|
return data.span;
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
const { AsyncLocalStorage } = require('node:async_hooks');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
const myStore = new AsyncLocalStorage();
|
|
|
|
|
|
|
|
// The start channel sets the initial store data to something
|
|
|
|
// and stores that store data value on the trace context object
|
|
|
|
channels.start.bindStore(myStore, (data) => {
|
|
|
|
const span = new Span(data);
|
|
|
|
data.span = span;
|
|
|
|
return span;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Then asyncStart can restore from that data it stored previously
|
|
|
|
channels.asyncStart.bindStore(myStore, (data) => {
|
|
|
|
return data.span;
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2024-07-24 09:48:40 -07:00
|
|
|
#### `tracingChannel.hasSubscribers`
|
|
|
|
|
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v22.0.0
|
|
|
|
- v20.13.0
|
|
|
|
-->
|
|
|
|
|
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
* Returns: {boolean} `true` if any of the individual channels has a subscriber,
|
|
|
|
`false` if not.
|
|
|
|
|
|
|
|
This is a helper method available on a [`TracingChannel`][] instance to check if
|
|
|
|
any of the [TracingChannel Channels][] have subscribers. A `true` is returned if
|
|
|
|
any of them have at least one subscriber, a `false` is returned otherwise.
|
|
|
|
|
|
|
|
```mjs
|
|
|
|
import diagnostics_channel from 'node:diagnostics_channel';
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
if (channels.hasSubscribers) {
|
|
|
|
// Do something
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```cjs
|
|
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
|
|
|
|
|
|
const channels = diagnostics_channel.tracingChannel('my-channel');
|
|
|
|
|
|
|
|
if (channels.hasSubscribers) {
|
|
|
|
// Do something
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
### TracingChannel Channels
|
|
|
|
|
|
|
|
A TracingChannel is a collection of several diagnostics\_channels representing
|
|
|
|
specific points in the execution lifecycle of a single traceable action. The
|
2023-04-23 17:04:08 +03:30
|
|
|
behavior is split into five diagnostics\_channels consisting of `start`,
|
2023-03-31 10:40:30 -07:00
|
|
|
`end`, `asyncStart`, `asyncEnd`, and `error`. A single traceable action will
|
|
|
|
share the same event object between all events, this can be helpful for
|
|
|
|
managing correlation through a weakmap.
|
|
|
|
|
|
|
|
These event objects will be extended with `result` or `error` values when
|
|
|
|
the task "completes". In the case of a synchronous task the `result` will be
|
|
|
|
the return value and the `error` will be anything thrown from the function.
|
|
|
|
With callback-based async functions the `result` will be the second argument
|
|
|
|
of the callback while the `error` will either be a thrown error visible in the
|
|
|
|
`end` event or the first callback argument in either of the `asyncStart` or
|
|
|
|
`asyncEnd` events.
|
|
|
|
|
2024-03-06 19:03:32 -08:00
|
|
|
To ensure only correct trace graphs are formed, events should only be published
|
|
|
|
if subscribers are present prior to starting the trace. Subscriptions which are
|
|
|
|
added after the trace begins should not receive future events from that trace,
|
|
|
|
only future traces will be seen.
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
Tracing channels should follow a naming pattern of:
|
|
|
|
|
|
|
|
* `tracing:module.class.method:start` or `tracing:module.function:start`
|
|
|
|
* `tracing:module.class.method:end` or `tracing:module.function:end`
|
|
|
|
* `tracing:module.class.method:asyncStart` or `tracing:module.function:asyncStart`
|
|
|
|
* `tracing:module.class.method:asyncEnd` or `tracing:module.function:asyncEnd`
|
|
|
|
* `tracing:module.class.method:error` or `tracing:module.function:error`
|
|
|
|
|
|
|
|
#### `start(event)`
|
|
|
|
|
|
|
|
* Name: `tracing:${name}:start`
|
|
|
|
|
|
|
|
The `start` event represents the point at which a function is called. At this
|
|
|
|
point the event data may contain function arguments or anything else available
|
|
|
|
at the very start of the execution of the function.
|
|
|
|
|
|
|
|
#### `end(event)`
|
|
|
|
|
|
|
|
* Name: `tracing:${name}:end`
|
|
|
|
|
|
|
|
The `end` event represents the point at which a function call returns a value.
|
|
|
|
In the case of an async function this is when the promise returned not when the
|
|
|
|
function itself makes a return statement internally. At this point, if the
|
|
|
|
traced function was synchronous the `result` field will be set to the return
|
|
|
|
value of the function. Alternatively, the `error` field may be present to
|
|
|
|
represent any thrown errors.
|
|
|
|
|
|
|
|
It is recommended to listen specifically to the `error` event to track errors
|
|
|
|
as it may be possible for a traceable action to produce multiple errors. For
|
|
|
|
example, an async task which fails may be started internally before the sync
|
|
|
|
part of the task then throws an error.
|
|
|
|
|
|
|
|
#### `asyncStart(event)`
|
|
|
|
|
|
|
|
* Name: `tracing:${name}:asyncStart`
|
|
|
|
|
|
|
|
The `asyncStart` event represents the callback or continuation of a traceable
|
|
|
|
function being reached. At this point things like callback arguments may be
|
|
|
|
available, or anything else expressing the "result" of the action.
|
|
|
|
|
|
|
|
For callbacks-based functions, the first argument of the callback will be
|
|
|
|
assigned to the `error` field, if not `undefined` or `null`, and the second
|
|
|
|
argument will be assigned to the `result` field.
|
|
|
|
|
|
|
|
For promises, the argument to the `resolve` path will be assigned to `result`
|
|
|
|
or the argument to the `reject` path will be assign to `error`.
|
|
|
|
|
|
|
|
It is recommended to listen specifically to the `error` event to track errors
|
|
|
|
as it may be possible for a traceable action to produce multiple errors. For
|
|
|
|
example, an async task which fails may be started internally before the sync
|
|
|
|
part of the task then throws an error.
|
|
|
|
|
|
|
|
#### `asyncEnd(event)`
|
|
|
|
|
|
|
|
* Name: `tracing:${name}:asyncEnd`
|
|
|
|
|
|
|
|
The `asyncEnd` event represents the callback of an asynchronous function
|
|
|
|
returning. It's not likely event data will change after the `asyncStart` event,
|
|
|
|
however it may be useful to see the point where the callback completes.
|
|
|
|
|
|
|
|
#### `error(event)`
|
|
|
|
|
|
|
|
* Name: `tracing:${name}:error`
|
|
|
|
|
|
|
|
The `error` event represents any error produced by the traceable function
|
|
|
|
either synchronously or asynchronously. If an error is thrown in the
|
|
|
|
synchronous portion of the traced function the error will be assigned to the
|
|
|
|
`error` field of the event and the `error` event will be triggered. If an error
|
|
|
|
is received asynchronously through a callback or promise rejection it will also
|
|
|
|
be assigned to the `error` field of the event and trigger the `error` event.
|
|
|
|
|
|
|
|
It is possible for a single traceable function call to produce errors multiple
|
|
|
|
times so this should be considered when consuming this event. For example, if
|
|
|
|
another async task is triggered internally which fails and then the sync part
|
|
|
|
of the function then throws and error two `error` events will be emitted, one
|
|
|
|
for the sync error and one for the async error.
|
|
|
|
|
2022-07-10 20:50:24 +08:00
|
|
|
### Built-in Channels
|
|
|
|
|
2022-11-15 11:35:10 -08:00
|
|
|
> Stability: 1 - Experimental
|
|
|
|
|
|
|
|
While the diagnostics\_channel API is now considered stable, the built-in
|
|
|
|
channels currently available are not. Each channel must be declared stable
|
|
|
|
independently.
|
|
|
|
|
2022-07-10 20:50:24 +08:00
|
|
|
#### HTTP
|
|
|
|
|
|
|
|
`http.client.request.start`
|
|
|
|
|
|
|
|
* `request` {http.ClientRequest}
|
|
|
|
|
|
|
|
Emitted when client starts a request.
|
|
|
|
|
|
|
|
`http.client.response.finish`
|
|
|
|
|
|
|
|
* `request` {http.ClientRequest}
|
|
|
|
* `response` {http.IncomingMessage}
|
|
|
|
|
|
|
|
Emitted when client receives a response.
|
|
|
|
|
|
|
|
`http.server.request.start`
|
|
|
|
|
|
|
|
* `request` {http.IncomingMessage}
|
|
|
|
* `response` {http.ServerResponse}
|
|
|
|
* `socket` {net.Socket}
|
|
|
|
* `server` {http.Server}
|
|
|
|
|
|
|
|
Emitted when server receives a request.
|
|
|
|
|
|
|
|
`http.server.response.finish`
|
|
|
|
|
|
|
|
* `request` {http.IncomingMessage}
|
|
|
|
* `response` {http.ServerResponse}
|
|
|
|
* `socket` {net.Socket}
|
|
|
|
* `server` {http.Server}
|
|
|
|
|
|
|
|
Emitted when server sends a response.
|
|
|
|
|
2024-06-19 11:12:59 -03:00
|
|
|
#### Modules
|
|
|
|
|
|
|
|
`module.require.start`
|
|
|
|
|
|
|
|
* `event` {Object} containing the following properties
|
|
|
|
* `id` - Argument passed to `require()`. Module name.
|
|
|
|
* `parentFilename` - Name of the module that attempted to require(id).
|
|
|
|
|
|
|
|
Emitted when `require()` is executed. See [`start` event][].
|
|
|
|
|
|
|
|
`module.require.end`
|
|
|
|
|
|
|
|
* `event` {Object} containing the following properties
|
|
|
|
* `id` - Argument passed to `require()`. Module name.
|
|
|
|
* `parentFilename` - Name of the module that attempted to require(id).
|
|
|
|
|
|
|
|
Emitted when a `require()` call returns. See [`end` event][].
|
|
|
|
|
|
|
|
`module.require.error`
|
|
|
|
|
|
|
|
* `event` {Object} containing the following properties
|
|
|
|
* `id` - Argument passed to `require()`. Module name.
|
|
|
|
* `parentFilename` - Name of the module that attempted to require(id).
|
|
|
|
* `error` {Error}
|
|
|
|
|
|
|
|
Emitted when a `require()` throws an error. See [`error` event][].
|
|
|
|
|
|
|
|
`module.import.asyncStart`
|
|
|
|
|
|
|
|
* `event` {Object} containing the following properties
|
|
|
|
* `id` - Argument passed to `import()`. Module name.
|
|
|
|
* `parentURL` - URL object of the module that attempted to import(id).
|
|
|
|
|
|
|
|
Emitted when `import()` is invoked. See [`asyncStart` event][].
|
|
|
|
|
|
|
|
`module.import.asyncEnd`
|
|
|
|
|
|
|
|
* `event` {Object} containing the following properties
|
|
|
|
* `id` - Argument passed to `import()`. Module name.
|
|
|
|
* `parentURL` - URL object of the module that attempted to import(id).
|
|
|
|
|
|
|
|
Emitted when `import()` has completed. See [`asyncEnd` event][].
|
|
|
|
|
|
|
|
`module.import.error`
|
|
|
|
|
|
|
|
* `event` {Object} containing the following properties
|
|
|
|
* `id` - Argument passed to `import()`. Module name.
|
|
|
|
* `parentURL` - URL object of the module that attempted to import(id).
|
|
|
|
* `error` {Error}
|
|
|
|
|
|
|
|
Emitted when a `import()` throws an error. See [`error` event][].
|
|
|
|
|
2022-08-31 01:08:33 +08:00
|
|
|
#### NET
|
|
|
|
|
2022-07-29 21:27:16 +08:00
|
|
|
`net.client.socket`
|
|
|
|
|
|
|
|
* `socket` {net.Socket}
|
|
|
|
|
|
|
|
Emitted when a new TCP or pipe client socket is created.
|
|
|
|
|
|
|
|
`net.server.socket`
|
|
|
|
|
|
|
|
* `socket` {net.Socket}
|
|
|
|
|
|
|
|
Emitted when a new TCP or pipe connection is received.
|
|
|
|
|
2024-05-30 10:40:19 +02:00
|
|
|
`tracing:net.server.listen:asyncStart`
|
|
|
|
|
|
|
|
* `server` {net.Server}
|
|
|
|
* `options` {Object}
|
|
|
|
|
|
|
|
Emitted when [`net.Server.listen()`][] is invoked, before the port or pipe is actually setup.
|
|
|
|
|
|
|
|
`tracing:net.server.listen:asyncEnd`
|
|
|
|
|
|
|
|
* `server` {net.Server}
|
|
|
|
|
|
|
|
Emitted when [`net.Server.listen()`][] has completed and thus the server is ready to accept connection.
|
|
|
|
|
|
|
|
`tracing:net.server.listen:error`
|
|
|
|
|
|
|
|
* `server` {net.Server}
|
|
|
|
* `error` {Error}
|
|
|
|
|
|
|
|
Emitted when [`net.Server.listen()`][] is returning an error.
|
|
|
|
|
2022-08-31 01:08:33 +08:00
|
|
|
#### UDP
|
|
|
|
|
2022-07-29 21:27:16 +08:00
|
|
|
`udp.socket`
|
|
|
|
|
|
|
|
* `socket` {dgram.Socket}
|
|
|
|
|
|
|
|
Emitted when a new UDP socket is created.
|
|
|
|
|
2022-08-31 01:08:33 +08:00
|
|
|
#### Process
|
|
|
|
|
|
|
|
<!-- YAML
|
2022-10-11 14:54:19 -05:00
|
|
|
added: v16.18.0
|
2022-08-31 01:08:33 +08:00
|
|
|
-->
|
|
|
|
|
|
|
|
`child_process`
|
|
|
|
|
|
|
|
* `process` {ChildProcess}
|
|
|
|
|
|
|
|
Emitted when a new process is created.
|
|
|
|
|
|
|
|
#### Worker Thread
|
|
|
|
|
|
|
|
<!-- YAML
|
2022-10-11 14:54:19 -05:00
|
|
|
added: v16.18.0
|
2022-08-31 01:08:33 +08:00
|
|
|
-->
|
|
|
|
|
|
|
|
`worker_threads`
|
|
|
|
|
|
|
|
* `worker` [`Worker`][]
|
|
|
|
|
|
|
|
Emitted when a new thread is created.
|
|
|
|
|
2023-03-31 10:40:30 -07:00
|
|
|
[TracingChannel Channels]: #tracingchannel-channels
|
2021-07-04 20:39:17 -07:00
|
|
|
[`'uncaughtException'`]: process.md#event-uncaughtexception
|
2023-03-31 10:40:30 -07:00
|
|
|
[`TracingChannel`]: #class-tracingchannel
|
2022-08-31 01:08:33 +08:00
|
|
|
[`Worker`]: worker_threads.md#class-worker
|
2023-03-31 10:40:30 -07:00
|
|
|
[`asyncEnd` event]: #asyncendevent
|
|
|
|
[`asyncStart` event]: #asyncstartevent
|
|
|
|
[`channel.bindStore(store)`]: #channelbindstorestore-transform
|
|
|
|
[`channel.runStores(context, ...)`]: #channelrunstorescontext-fn-thisarg-args
|
2021-07-04 20:39:17 -07:00
|
|
|
[`channel.subscribe(onMessage)`]: #channelsubscribeonmessage
|
2023-03-31 10:40:30 -07:00
|
|
|
[`channel.unsubscribe(onMessage)`]: #channelunsubscribeonmessage
|
2021-07-04 20:39:17 -07:00
|
|
|
[`diagnostics_channel.channel(name)`]: #diagnostics_channelchannelname
|
2022-05-31 10:52:09 -07:00
|
|
|
[`diagnostics_channel.subscribe(name, onMessage)`]: #diagnostics_channelsubscribename-onmessage
|
2023-03-31 10:40:30 -07:00
|
|
|
[`diagnostics_channel.tracingChannel()`]: #diagnostics_channeltracingchannelnameorchannels
|
2022-05-31 10:52:09 -07:00
|
|
|
[`diagnostics_channel.unsubscribe(name, onMessage)`]: #diagnostics_channelunsubscribename-onmessage
|
2023-03-31 10:40:30 -07:00
|
|
|
[`end` event]: #endevent
|
|
|
|
[`error` event]: #errorevent
|
2024-05-30 10:40:19 +02:00
|
|
|
[`net.Server.listen()`]: net.md#serverlisten
|
2023-03-31 10:40:30 -07:00
|
|
|
[`start` event]: #startevent
|
|
|
|
[context loss]: async_context.md#troubleshooting-context-loss
|