Skip to content

Commit

Permalink
2021-05-11, Version 14.17.0 'Fermium' (LTS)
Browse files Browse the repository at this point in the history
Notable Changes:

Diagnostics channel (experimental module):

`diagnostics_channel` is a new experimental module that provides an API
to create named channels to report arbitrary message data for
diagnostics purposes.

The module was initially introduced in Node.js v15.1.0 and is
backported to v14.17.0 to enable testing it at a larger scale.

With `diagnostics_channel`, Node.js core and module authors can publish
contextual data about what they are doing at a given time. This could
be the hostname and query string of a mysql query, for example. Just
create a named channel with `dc.channel(name)` and call
`channel.publish(data)` to send the data to any listeners to that
channel.

```js
const dc = require('diagnostics_channel');
const channel = dc.channel('mysql.query');

MySQL.prototype.query = function query(queryString, values, callback) {
  // Broadcast query information whenever a query is made
  channel.publish({
    query: queryString,
    host: this.hostname,
  });

  this.doQuery(queryString, values, callback);
};
```

Channels are like one big global event emitter but are split into
separate objects to ensure they get the best performance. If nothing is
listening to the channel, the publishing overhead should be as close to
zero as possible. Consuming channel data is as easy as using
`channel.subscribe(listener)` to run a function whenever a message is
published to that channel.

```js
const dc = require('diagnostics_channel');
const channel = dc.channel('mysql.query');

channel.subscribe(({ query, host }) => {
  console.log(`mysql query to ${host}: ${query}`);
});
```

The data captured can be used to provide context for what an app is
doing at a given time. This can be used for things like augmenting
tracing data, tracking network and filesystem activity, logging
queries, and many other things. It's also a very useful data source
for diagnostics tools to provide a clearer picture of exactly what the
application is doing at a given point in the data they are presenting.

Contributed by Stephen Belanger (#34895).

UUID support in the crypto module:

The new `crypto.randomUUID()` method now allows to generate random
[RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) Version 4
UUID strings:

```js
const { randomUUID } = require('crypto');

console.log(randomUUID());
// 'aa7c91a1-f8fc-4339-b9db-f93fc7233429'
```

Contributed by James M Snell (#36729).

Experimental support for `AbortController` and `AbortSignal`:

Node.js 14.17.0 adds experimental partial support for `AbortController`
and `AbortSignal`.

Both constructors can be enabled globally using the
`--experimental-abortcontroller` flag.

Additionally, several Node.js APIs have been updated to support
`AbortSignal` for cancellation.
It is not mandatory to use the built-in constructors with them. Any
spec-compliant third-party alternatives should be compatible.

`AbortSignal` support was added to the following methods:

* `child_process.exec`
* `child_process.execFile`
* `child_process.fork`
* `child_process.spawn`
* `dgram.createSocket`
* `events.on`
* `events.once`
* `fs.readFile`
* `fs.watch`
* `fs.writeFile`
* `http.request`
* `https.request`
* `http2Session.request`
* The promisified variants of `setImmediate` and `setTimeout`

Other notable changes:

* doc:
  * revoke deprecation of legacy url, change status to legacy (James M Snell) (#37784)
  * add legacy status to stability index (James M Snell) (#37784)
  * upgrade stability status of report API (Gireesh Punathil) (#35654)
* deps:
  * V8: Backport various patches for Apple Silicon support (BoHong Li) (#38051)
  * update ICU to 68.1 (Michaël Zasso) (#36187)
  * upgrade to libuv 1.41.0 (Colin Ihrig) (#37360)
* http:
  * add http.ClientRequest.getRawHeaderNames() (simov) (#37660)
  * report request start and end with diagnostics\_channel (Stephen Belanger) (#34895)
* util:
  * add getSystemErrorMap() impl (eladkeyshawn) (#38101)

PR-URL: #38507
  • Loading branch information
danielleadams committed May 11, 2021
1 parent f755fc4 commit aa15690
Show file tree
Hide file tree
Showing 22 changed files with 751 additions and 52 deletions.
4 changes: 2 additions & 2 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3114,7 +3114,7 @@ accessed using `require('buffer')`.

### `buffer.atob(data)`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `data` {any} The Base64-encoded input string.
Expand All @@ -3133,7 +3133,7 @@ and binary data should be performed using `Buffer.from(str, 'base64')` and

### `buffer.btoa(data)`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `data` {any} An ASCII (Latin1) string.
Expand Down
8 changes: 4 additions & 4 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ lsExample();
<!-- YAML
added: v0.1.91
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/36308
description: AbortSignal support was added.
- version: v8.8.0
Expand Down Expand Up @@ -351,7 +351,7 @@ controller.abort();
<!-- YAML
added: v0.5.0
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/36603
description: AbortSignal support was added.
- version:
Expand Down Expand Up @@ -431,7 +431,7 @@ The `signal` option works exactly the same way it does in
<!-- YAML
added: v0.1.90
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/36432
description: AbortSignal support was added.
- version:
Expand Down Expand Up @@ -1086,7 +1086,7 @@ See [Advanced serialization][] for more details.

### Event: `'spawn'`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

The `'spawn'` event is emitted once the child process has spawned successfully.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Currently, overriding `Error.prepareStackTrace` is ignored when the

### `--experimental-abortcontroller`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

Enable experimental `AbortController` and `AbortSignal` support.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -2843,7 +2843,7 @@ console.log(`The dice rolled: ${n}`);

### `crypto.randomUUID([options])`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `options` {Object}
Expand Down
2 changes: 1 addition & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ future release.
### DEP0116: Legacy URL API
<!-- YAML
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/37784
description: Deprecation revoked. Status changed to "Legacy".
- version: v11.0.0
Expand Down
2 changes: 1 addition & 1 deletion doc/api/diagnostics_channel.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Diagnostics Channel

<!--introduced_in=REPLACEME-->
<!--introduced_in=v14.17.0-->

> Stability: 1 - Experimental
Expand Down
8 changes: 4 additions & 4 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ callbacks will be called with an error with code `ECANCELLED`.

### `resolver.setLocalAddress([ipv4][, ipv6])`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `ipv4` {string} A string representation of an IPv4 address.
Expand Down Expand Up @@ -437,7 +437,7 @@ will contain an array of canonical name records available for the `hostname`

## `dns.resolveCaa(hostname, callback)`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `hostname` {string}
Expand Down Expand Up @@ -718,7 +718,7 @@ The following methods from the `dnsPromises` API are available:

### `resolver.cancel()`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

Cancel all outstanding DNS queries made by this resolver. The corresponding
Expand Down Expand Up @@ -946,7 +946,7 @@ Here is an example of the result object:

### `dnsPromises.resolveCaa(hostname)`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `hostname` {string}
Expand Down
2 changes: 1 addition & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
added: v8.5.0
changes:
- version:
- REPLACEME
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/35781
description: Stabilize modules implementation.
- version:
Expand Down
4 changes: 2 additions & 2 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ regular `'error'` listener is installed.

### `EventEmitter.setMaxListeners(n[, ...eventTargets])`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `n` {number} A non-negative number. The maximum number of listeners per
Expand Down Expand Up @@ -855,7 +855,7 @@ class MyClass extends EventEmitter {
## `events.getEventListeners(emitterOrTarget, eventName)`
<!-- YAML
added:
- REPLACEME
- v14.17.0
-->
* `emitterOrTarget` {EventEmitter|EventTarget}
* `eventName` {string|symbol}
Expand Down
12 changes: 6 additions & 6 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ See also: chown(2).
<!-- YAML
added: v0.0.2
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/37174
description: A default callback is now used if one is not provided.
- version: v10.0.0
Expand Down Expand Up @@ -3031,7 +3031,7 @@ If `options.withFileTypes` is set to `true`, the result will contain
<!-- YAML
added: v0.1.29
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/35911
description: The options argument may include an AbortSignal to abort an
ongoing readFile request.
Expand Down Expand Up @@ -4083,7 +4083,7 @@ this API: [`fs.utimes()`][].
<!-- YAML
added: v0.5.10
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/37190
description: Added support for closing the watcher with an AbortSignal.
- version: v7.6.0
Expand Down Expand Up @@ -4405,7 +4405,7 @@ details.
<!-- YAML
added: v0.1.29
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/35993
description: The options argument may include an AbortSignal to abort an
ongoing writeFile request.
Expand Down Expand Up @@ -5491,7 +5491,7 @@ print('./').catch(console.error);
<!-- YAML
added: v10.0.0
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/35911
description: The options argument may include an AbortSignal to abort an
ongoing readFile request.
Expand Down Expand Up @@ -5741,7 +5741,7 @@ The `atime` and `mtime` arguments follow these rules:
<!-- YAML
added: v10.0.0
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/35993
description: The options argument may include an AbortSignal to abort an
ongoing writeFile request.
Expand Down
16 changes: 8 additions & 8 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ accessible.

## Class: `AbortController`
<!--YAML
added: REPLACEME
added: v14.17.0
-->

> Stability: 1 - Experimental
Expand All @@ -44,22 +44,22 @@ console.log(ac.signal.aborted); // Prints True

### `abortController.abort()`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

Triggers the abort signal, causing the `abortController.signal` to emit
the `'abort'` event.

### `abortController.signal`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Type: {AbortSignal}

### Class: `AbortSignal`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Extends: {EventTarget}
Expand All @@ -69,7 +69,7 @@ The `AbortSignal` is used to notify observers when the

#### Static method: `AbortSignal.abort()`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Returns: {AbortSignal}
Expand All @@ -78,7 +78,7 @@ Returns a new already aborted `AbortSignal`.

#### Event: `'abort'`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

The `'abort'` event is emitted when the `abortController.abort()` method
Expand Down Expand Up @@ -112,14 +112,14 @@ result in memory leaks.

#### `abortSignal.aborted`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Type: {boolean} True after the `AbortController` has been aborted.

#### `abortSignal.onabort`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Type: {Function}
Expand Down
6 changes: 3 additions & 3 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ http.get({
<!-- YAML
added: v0.3.4
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/36685
description: Change the default scheduling from 'fifo' to 'lifo'.
- version: v14.5.0
Expand Down Expand Up @@ -758,7 +758,7 @@ const cookie = request.getHeader('Cookie');

### `request.getRawHeaderNames()`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Returns: {string[]}
Expand Down Expand Up @@ -2364,7 +2364,7 @@ This can be overridden for servers and client requests by passing the
<!-- YAML
added: v0.3.6
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/36048
description: It is possible to abort a request with an AbortSignal.
- version:
Expand Down
6 changes: 3 additions & 3 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- YAML
added: v8.4.0
changes:
- version: REPLACEME
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/36070
description: It is possible to abort a request with an AbortSignal.
- version: v10.10.0
Expand Down Expand Up @@ -1880,7 +1880,7 @@ value only affects new connections to the server, not any existing connections.

#### `server.updateSettings([settings])`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `settings` {HTTP/2 Settings Object}
Expand Down Expand Up @@ -2074,7 +2074,7 @@ value only affects new connections to the server, not any existing connections.

#### `server.updateSettings([settings])`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* `settings` {HTTP/2 Settings Object}
Expand Down
2 changes: 1 addition & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ filename.

### `module.isPreloading`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Type: {boolean} `true` if the module is running during the Node.js preload
Expand Down
2 changes: 1 addition & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1986,7 +1986,7 @@ Additional documentation is available in the [report documentation][].
added: v11.12.0
changes:
- version:
- REPLACEME
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/35654
description: This API is no longer experimental.
-->
Expand Down
2 changes: 1 addition & 1 deletion doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ whenever `rl.prompt()` is called.

### `rl.getPrompt()`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* Returns: {string} the current prompt string
Expand Down
2 changes: 1 addition & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ the status of the `highWaterMark`.

##### `writable.writableNeedDrain`
<!-- YAML
added: REPLACEME
added: v14.17.0
-->

* {boolean}
Expand Down
Loading

0 comments on commit aa15690

Please sign in to comment.