Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
lib: replace --diagnostic-report-* with --report-*
In the code base the word `report` is almost only used to refer to
the diagnostic report when it's a noun, and it's programmable
interface `process.report()` it not prefixed, so `report` should be
unambiguous enough to use without `diagnostic`.
  • Loading branch information
joyeecheung committed Apr 19, 2019
commit c097d457e6ba8a3b1415b1c02a5d2c16bf040673
26 changes: 13 additions & 13 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,21 @@ should be written to. When used alone, it implies `--cpu-prof`.
$ node --cpu-prof-path /tmp/test.cpuprofile index.js
```

### `--diagnostic-report-directory=directory`
### `--report-directory=directory`
<!-- YAML
added: v11.8.0
-->

Location at which the report will be generated.

### `--diagnostic-report-filename=filename`
### `--report-filename=filename`
<!-- YAML
added: v11.8.0
-->

Name of the file to which the report will be written.

### `--diagnostic-report-on-fatalerror`
### `--report-on-fatalerror`
<!-- YAML
added: v11.8.0
-->
Expand All @@ -131,24 +131,24 @@ 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.

### `--diagnostic-report-on-signal`
### `--report-on-signal`
<!-- YAML
added: v11.8.0
-->

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 `--diagnostic-report-signal`.
The signal to trigger the report is specified through `--report-signal`.

### `--diagnostic-report-signal=signal`
### `--report-signal=signal`
<!-- YAML
added: v11.8.0
-->

Sets or resets the signal for report generation (not supported on Windows).
Default signal is `SIGUSR2`.

### `--diagnostic-report-uncaught-exception`
### `--report-uncaught-exception`
<!-- YAML
added: v11.8.0
-->
Expand Down Expand Up @@ -813,12 +813,12 @@ In case an option value happens to contain a space (for example a path listed in
```

Node.js options that are allowed are:
- `--diagnostic-report-directory`
- `--diagnostic-report-filename`
- `--diagnostic-report-on-fatalerror`
- `--diagnostic-report-on-signal`
- `--diagnostic-report-signal`
- `--diagnostic-report-uncaught-exception`
- `--report-directory`
- `--report-filename`
- `--report-on-fatalerror`
- `--report-on-signal`
- `--report-signal`
- `--report-uncaught-exception`
- `--enable-fips`
- `--experimental-modules`
- `--experimental-repl-await`
Expand Down
26 changes: 13 additions & 13 deletions doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ is provided below for reference.
"commandLine": [
"/home/nodeuser/project/node/out/Release/node",
"--experimental-report",
"--diagnostic-report-uncaught-exception",
"--report-uncaught-exception",
"/home/nodeuser/project/node/test/report/test-exception.js",
"child"
],
Expand Down Expand Up @@ -361,19 +361,19 @@ is provided below for reference.
## Usage

```bash
node --experimental-report --diagnostic-report-uncaught-exception \
--diagnostic-report-on-signal --diagnostic-report-on-fatalerror app.js
node --experimental-report --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.

* `--diagnostic-report-uncaught-exception` Enables report to be generated on
* `--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.

* `--diagnostic-report-on-signal` Enables report to be generated upon receiving
* `--report-on-signal` Enables report to be generated upon receiving
the specified (or predefined) signal to the running Node.js process. (See below
on how to modify the signal that triggers the report.) Default signal is `SIGUSR2`.
Useful when a report needs to be triggered from another program.
Expand All @@ -387,19 +387,19 @@ signal. However, if `SIGUSR2` is already used for other purposes, then this
flag helps to change the signal for report generation and preserve the original
meaning of `SIGUSR2` for the said purposes.

* `--diagnostic-report-on-fatalerror` Enables the report to be triggered on
* `--report-on-fatalerror` Enables the 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. Useful to inspect various
diagnostic data elements such as heap, stack, event loop state, resource
consumption etc. to reason about the fatal error.

* `--diagnostic-report-directory` Location at which the report will be
* `--report-directory` Location at which the report will be
generated.

* `--diagnostic-report-filename` Name of the file to which the report will be
* `--report-filename` Name of the file to which the report will be
written.

* `--diagnostic-report-signal` Sets or resets the signal for report generation
* `--report-signal` Sets or resets the signal for report generation
(not supported on Windows). Default signal is `SIGUSR2`.

A report can also be triggered via an API call from a JavaScript application:
Expand Down Expand Up @@ -534,10 +534,10 @@ Configuration on module initialization is also available via
environment variables:

```bash
NODE_OPTIONS="--experimental-report --diagnostic-report-uncaught-exception \
--diagnostic-report-on-fatalerror --diagnostic-report-on-signal \
--diagnostic-report-signal=SIGUSR2 --diagnostic-report-filename=./report.json \
--diagnostic-report-directory=/home/nodeuser"
NODE_OPTIONS="--experimental-report --report-uncaught-exception \
--report-on-fatalerror --report-on-signal \
--report-signal=SIGUSR2 --report-filename=./report.json \
--report-directory=/home/nodeuser"
```

Specific API documentation can be found under
Expand Down
12 changes: 6 additions & 6 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,36 @@ Path the V8 CPU profile generated with
will be written to. When used alone, it implies
.Fl -cpu-prof
.
.It Fl -diagnostic-report-directory
.It Fl -report-directory
Location at which the
.Sy diagnostic report
will be generated.
.
.It Fl -diagnostic-report-filename
.It Fl -report-filename
Name of the file to which the
.Sy diagnostic report
will be written.
.
.It Fl -diagnostic-report-on-fatalerror
.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.
.
.It Fl -diagnostic-report-on-signal
.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.
.
.It Fl -diagnostic-report-signal
.It Fl -report-signal
Sets or resets the signal for
.Sy diagnostic report
generation (not supported on Windows). Default signal is SIGUSR2.
.
.It Fl -diagnostic-report-uncaught-exception
.It Fl -report-uncaught-exception
Enables
.Sy diagnostic report
to be generated on un-caught exceptions, if
Expand Down
26 changes: 13 additions & 13 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,34 @@ void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors) {
}

if (!report_directory.empty()) {
errors->push_back("--diagnostic-report-directory option is valid only when "
errors->push_back("--report-directory option is valid only when "
"--experimental-report is set");
}

if (!report_filename.empty()) {
errors->push_back("--diagnostic-report-filename option is valid only when "
errors->push_back("--report-filename option is valid only when "
"--experimental-report is set");
}

if (!report_signal.empty()) {
errors->push_back("--diagnostic-report-signal option is valid only when "
errors->push_back("--report-signal option is valid only when "
"--experimental-report is set");
}

if (report_on_fatalerror) {
errors->push_back(
"--diagnostic-report-on-fatalerror option is valid only when "
"--report-on-fatalerror option is valid only when "
"--experimental-report is set");
}

if (report_on_signal) {
errors->push_back("--diagnostic-report-on-signal option is valid only when "
errors->push_back("--report-on-signal option is valid only when "
"--experimental-report is set");
}

if (report_uncaught_exception) {
errors->push_back(
"--diagnostic-report-uncaught-exception option is valid only when "
"--report-uncaught-exception option is valid only when "
"--experimental-report is set");
}
#endif // NODE_REPORT
Expand Down Expand Up @@ -457,30 +457,30 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
AddOption("--stack-trace-limit", "", V8Option{}, kAllowedInEnvironment);

#ifdef NODE_REPORT
AddOption("--diagnostic-report-uncaught-exception",
AddOption("--report-uncaught-exception",
"generate diagnostic report on uncaught exceptions",
&PerIsolateOptions::report_uncaught_exception,
kAllowedInEnvironment);
AddOption("--diagnostic-report-on-signal",
AddOption("--report-on-signal",
"generate diagnostic report upon receiving signals",
&PerIsolateOptions::report_on_signal,
kAllowedInEnvironment);
AddOption("--diagnostic-report-on-fatalerror",
AddOption("--report-on-fatalerror",
"generate diagnostic report on fatal (internal) errors",
&PerIsolateOptions::report_on_fatalerror,
kAllowedInEnvironment);
AddOption("--diagnostic-report-signal",
AddOption("--report-signal",
"causes diagnostic report to be produced on provided signal,"
" unsupported in Windows. (default: SIGUSR2)",
&PerIsolateOptions::report_signal,
kAllowedInEnvironment);
Implies("--diagnostic-report-signal", "--diagnostic-report-on-signal");
AddOption("--diagnostic-report-filename",
Implies("--report-signal", "--report-on-signal");
AddOption("--report-filename",
"define custom report file name."
" (default: YYYYMMDD.HHMMSS.PID.SEQUENCE#.txt)",
&PerIsolateOptions::report_filename,
kAllowedInEnvironment);
AddOption("--diagnostic-report-directory",
AddOption("--report-directory",
"define custom report pathname."
" (default: current working directory of Node.js process)",
&PerIsolateOptions::report_directory,
Expand Down
2 changes: 1 addition & 1 deletion test/report/test-report-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --experimental-report --diagnostic-report-on-fatalerror --diagnostic-report-on-signal --diagnostic-report-uncaught-exception
// Flags: --experimental-report --report-on-fatalerror --report-on-signal --report-uncaught-exception
'use strict';
const common = require('../common');
common.skipIfReportDisabled();
Expand Down
2 changes: 1 addition & 1 deletion test/report/test-report-fatal-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (process.argv[2] === 'child') {
tmpdir.refresh();
const spawn = require('child_process').spawn;
const args = ['--experimental-report',
'--diagnostic-report-on-fatalerror',
'--report-on-fatalerror',
'--max-old-space-size=20',
__filename,
'child'];
Expand Down
2 changes: 1 addition & 1 deletion test/report/test-report-signal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --experimental-report --diagnostic-report-on-signal
// Flags: --experimental-report --report-on-signal
'use strict';
// Test producing a report via signal.
const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion test/report/test-report-uncaught-exception.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --experimental-report --diagnostic-report-uncaught-exception
// Flags: --experimental-report --report-uncaught-exception
'use strict';
// Test producing a report on uncaught exception.
const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion test/report/test-report-writereport.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function validate() {
// Test the case where the report file cannot be opened.
const reportDir = path.join(tmpdir.path, 'does', 'not', 'exist');
const args = ['--experimental-report',
`--diagnostic-report-directory=${reportDir}`,
`--report-directory=${reportDir}`,
'-e',
'process.report.writeReport()'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
Expand Down