Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report: move diagnostic reports to stable #32242

Merged
merged 6 commits into from Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions configure.py
Expand Up @@ -538,12 +538,12 @@
dest='without_npm',
help='do not install the bundled npm (package manager)')

# Dummy option for backwards compatibility
parser.add_option('--without-report',
action='store_true',
dest='without_report',
help='build without report')
dest='unused_without_report',
help=optparse.SUPPRESS_HELP)

# Dummy option for backwards compatibility
parser.add_option('--with-snapshot',
action='store_true',
dest='unused_with_snapshot',
Expand Down Expand Up @@ -1004,7 +1004,6 @@ def configure_node(o):
o['variables']['OS'] = 'android'
o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_report'] = b(not options.without_report)
o['variables']['debug_node'] = b(options.debug_node)
o['default_configuration'] = 'Debug' if options.debug else 'Release'

Expand Down
41 changes: 25 additions & 16 deletions doc/api/cli.md
Expand Up @@ -199,13 +199,6 @@ added: v10.0.0

Enable experimental top-level `await` keyword support in REPL.

### `--experimental-report`
<!-- YAML
added: v11.8.0
-->

Enable experimental diagnostic report feature.

### `--experimental-specifier-resolution=mode`
<!-- YAML
added: v13.4.0
Expand Down Expand Up @@ -603,6 +596,9 @@ warning will be written to stderr instead.
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This option is no longer considered experimental.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/27312
description: Changed from `--diagnostic-report-directory` to
Expand All @@ -615,6 +611,9 @@ Location at which the report will be generated.
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This option is no longer considered experimental.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/27312
description: changed from `--diagnostic-report-filename` to
Expand All @@ -633,30 +632,38 @@ changes:
`--report-on-fatalerror`
-->

> Stability: 1 - Experimental

Enables the report to be triggered on fatal errors (internal errors within
the Node.js runtime such as out of memory) that lead to termination of the
application, if `--experimental-report` is enabled. Useful to inspect various
diagnostic data elements such as heap, stack, event loop state, resource
consumption etc. to reason about the fatal error.
application. Useful to inspect various diagnostic data elements such as heap,
stack, event loop state, resource consumption etc. to reason about the fatal
error.

### `--report-on-signal`
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This option is no longer considered experimental.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/27312
description: changed from `--diagnostic-report-on-signal` to
`--report-on-signal`
-->

Enables report to be generated upon receiving the specified (or predefined)
signal to the running Node.js process, if `--experimental-report` is enabled.
The signal to trigger the report is specified through `--report-signal`.
signal to the running Node.js process. The signal to trigger the report is
specified through `--report-signal`.

### `--report-signal=signal`
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This option is no longer considered experimental.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/27312
description: changed from `--diagnostic-report-signal` to
Expand All @@ -670,15 +677,18 @@ Default signal is `SIGUSR2`.
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This option is no longer considered experimental.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/27312
description: changed from `--diagnostic-report-uncaught-exception` to
`--report-uncaught-exception`
-->

Enables report to be generated on un-caught exceptions, if
`--experimental-report` is enabled. Useful when inspecting JavaScript stack in
conjunction with native stack and other runtime environment data.
Enables report to be generated on uncaught exceptions. Useful when inspecting
the JavaScript stack in conjunction with native stack and other runtime
environment data.

### `--throw-deprecation`
<!-- YAML
Expand Down Expand Up @@ -1098,7 +1108,6 @@ Node.js options that are allowed are:
* `--experimental-modules`
* `--experimental-policy`
* `--experimental-repl-await`
* `--experimental-report`
* `--experimental-specifier-resolution`
* `--experimental-vm-modules`
* `--experimental-wasi-unstable-preview1`
Expand Down
48 changes: 32 additions & 16 deletions doc/api/process.md
Expand Up @@ -1783,10 +1783,12 @@ relied upon to exist.
## `process.report`
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* {Object}

`process.report` is an object whose methods are used to generate diagnostic
Expand All @@ -1796,10 +1798,12 @@ reports for the current process. Additional documentation is available in the
### `process.report.directory`
<!-- YAML
added: v11.12.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* {string}

Directory where the report is written. The default value is the empty string,
Expand All @@ -1813,10 +1817,12 @@ console.log(`Report directory is ${process.report.directory}`);
### `process.report.filename`
<!-- YAML
added: v11.12.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* {string}

Filename where the report is written. If set to the empty string, the output
Expand All @@ -1830,10 +1836,12 @@ console.log(`Report filename is ${process.report.filename}`);
### `process.report.getReport([err])`
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* `err` {Error} A custom error used for reporting the JavaScript stack.
* Returns: {Object}

Expand Down Expand Up @@ -1871,10 +1879,12 @@ console.log(`Report on fatal error: ${process.report.reportOnFatalError}`);
### `process.report.reportOnSignal`
<!-- YAML
added: v11.12.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* {boolean}

If `true`, a diagnostic report is generated when the process receives the
Expand All @@ -1887,10 +1897,12 @@ console.log(`Report on signal: ${process.report.reportOnSignal}`);
### `process.report.reportOnUncaughtException`
<!-- YAML
added: v11.12.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* {boolean}

If `true`, a diagnostic report is generated on uncaught exception.
Expand All @@ -1902,10 +1914,12 @@ console.log(`Report on exception: ${process.report.reportOnUncaughtException}`);
### `process.report.signal`
<!-- YAML
added: v11.12.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* {string}

The signal used to trigger the creation of a diagnostic report. Defaults to
Expand All @@ -1918,10 +1932,12 @@ console.log(`Report signal: ${process.report.signal}`);
### `process.report.writeReport([filename][, err])`
<!-- YAML
added: v11.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/32242
description: This API is no longer considered experimental.
-->

> Stability: 1 - Experimental

* `filename` {string} Name of the file where the report is written. This
should be a relative path, that will be appended to the directory specified in
`process.report.directory`, or the current working directory of the Node.js
Expand Down
13 changes: 4 additions & 9 deletions doc/api/report.md
Expand Up @@ -3,7 +3,7 @@
<!--introduced_in=v11.8.0-->
<!-- type=misc -->

> Stability: 1 - Experimental
> Stability: 2 - Stable

<!-- name=report -->

Expand Down Expand Up @@ -32,7 +32,6 @@ is provided below for reference.
"cwd": "/home/nodeuser/project/node",
"commandLine": [
"/home/nodeuser/project/node/out/Release/node",
"--experimental-report",
"--report-uncaught-exception",
"/home/nodeuser/project/node/test/report/test-exception.js",
"child"
Expand Down Expand Up @@ -392,14 +391,10 @@ is provided below for reference.
## Usage

```bash
node --experimental-report --report-uncaught-exception \
--report-on-signal --report-on-fatalerror app.js
node --report-uncaught-exception --report-on-signal \
--report-on-fatalerror app.js
```

* `--experimental-report` Enables the diagnostic report feature.
In the absence of this flag, use of all other related options will result in
an error.

* `--report-uncaught-exception` Enables report to be generated on
un-caught exceptions. Useful when inspecting JavaScript stack in conjunction
with native stack and other runtime environment data.
Expand Down Expand Up @@ -569,7 +564,7 @@ Configuration on module initialization is also available via
environment variables:

```bash
NODE_OPTIONS="--experimental-report --report-uncaught-exception \
NODE_OPTIONS="--report-uncaught-exception \
--report-on-fatalerror --report-on-signal \
--report-signal=SIGUSR2 --report-filename=./report.json \
--report-directory=/home/nodeuser"
Expand Down
22 changes: 8 additions & 14 deletions doc/node.1
Expand Up @@ -138,11 +138,6 @@ keyword support in REPL.
.It Fl -experimental-specifier-resolution
Select extension resolution algorithm for ES Modules; either 'explicit' (default) or 'node'
.
.It Fl -experimental-report
Enable experimental
.Sy diagnostic report
feature.
.
.It Fl -experimental-vm-modules
Enable experimental ES module support in VM module.
.
Expand Down Expand Up @@ -299,16 +294,16 @@ will be written.
.It Fl -report-on-fatalerror
Enables the
.Sy diagnostic report
to be triggered on fatal errors (internal errors within the Node.js runtime such as out of memory) that leads to termination of the application, if
.Sy --experimental-report
is enabled. Useful to inspect various diagnostic data elements such as heap, stack, event loop state, resource consumption etc. to reason about the fatal error.
to be triggered on fatal errors (internal errors within the Node.js runtime such
as out of memory) that leads to termination of the application. Useful to
inspect various diagnostic data elements such as heap, stack, event loop state,
resource consumption etc. to reason about the fatal error.
.
.It Fl -report-on-signal
Enables
.Sy diagnostic report
to be generated upon receiving the specified (or predefined) signal to the running Node.js process, if
.Sy --experimental-report
is enabled. Default signal is SIGUSR2.
to be generated upon receiving the specified (or predefined) signal to the
running Node.js process. Default signal is SIGUSR2.
.
.It Fl -report-signal
Sets or resets the signal for
Expand All @@ -318,9 +313,8 @@ generation (not supported on Windows). Default signal is SIGUSR2.
.It Fl -report-uncaught-exception
Enables
.Sy diagnostic report
to be generated on un-caught exceptions, if
.Sy --experimental-report
is enabled. Useful when inspecting JavaScript stack in conjunction with native stack and other runtime environment data.
to be generated on un-caught exceptions. Useful when inspecting JavaScript
stack in conjunction with native stack and other runtime environment data.
.
.It Fl -throw-deprecation
Throw errors for deprecations.
Expand Down
9 changes: 0 additions & 9 deletions lib/internal/bootstrap/pre_execution.js
Expand Up @@ -163,16 +163,11 @@ function setupStacktracePrinterOnSigint() {
}

function initializeReport() {
if (!getOptionValue('--experimental-report')) {
return;
}
const { report } = require('internal/process/report');
const { emitExperimentalWarning } = require('internal/util');
ObjectDefineProperty(process, 'report', {
enumerable: false,
configurable: true,
get() {
emitExperimentalWarning('report');
return report;
}
});
Expand All @@ -187,10 +182,6 @@ function setupDebugEnv() {

// This has to be called after initializeReport() is called
function initializeReportSignalHandlers() {
if (!getOptionValue('--experimental-report')) {
return;
}

const { addSignalHandler } = require('internal/process/report');

addSignalHandler();
Expand Down