From 0aee9af18314c1a3d15df03e2d91ca58801c5e9e Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Fri, 8 Nov 2024 14:49:43 -0300 Subject: [PATCH 1/3] src: add cli option to preserve env vars on dr PR-URL: https://github.com/nodejs/node/pull/55697 Backport-PR-URL: https://github.com/nodejs/node/pull/56055 Reviewed-By: James M Snell Reviewed-By: Richard Lau --- doc/api/cli.md | 10 +++ doc/api/process.md | 10 +++ doc/api/report.md | 7 ++ lib/internal/process/report.js | 7 ++ src/env-inl.h | 4 + src/env.h | 2 + src/node_options.cc | 5 ++ src/node_options.h | 1 + src/node_report.cc | 55 ++++++++++--- src/node_report_module.cc | 15 ++++ test/common/report.js | 17 ++-- .../test-report-writereport-exclude-env.js | 80 +++++++++++++++++++ 12 files changed, 199 insertions(+), 14 deletions(-) create mode 100644 test/report/test-report-writereport-exclude-env.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 1a51aa21afb18d..51db43329b0bad 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2049,6 +2049,15 @@ Enables report to be generated upon receiving the specified (or predefined) signal to the running Node.js process. The signal to trigger the report is specified through `--report-signal`. +### `--report-exclude-env` + + + +When `--report-exclude-env` is passed the diagnostic report generated will not +contain the `environmentVariables` data. + ### `--report-signal=signal` + +* {boolean} + +If `true`, a diagnostic report is generated without the environment variables. + ### `process.report.signal` + +When `--report-exclude-env` is passed the diagnostic report generated will not +contain the `environmentVariables` data. + +### `--report-exclude-network` + + + +Exclude `header.networkInterfaces` from the diagnostic report. By default +this is not set and the network interfaces are included. + ### `--report-filename=filename` - -When `--report-exclude-env` is passed the diagnostic report generated will not -contain the `environmentVariables` data. - ### `--report-signal=signal` + +New fields `ipv4` and `ipv6` are added to `tcp` and `udp` libuv handles endpoints. Examples: + +```json +{ + "libuv": [ + { + "type": "tcp", + "is_active": true, + "is_referenced": true, + "address": "0x000055e70fcb85d8", + "localEndpoint": { + "host": "localhost", + "ip4": "127.0.0.1", // new key + "port": 48986 + }, + "remoteEndpoint": { + "host": "localhost", + "ip4": "127.0.0.1", // new key + "port": 38573 + }, + "sendBufferSize": 2626560, + "recvBufferSize": 131072, + "fd": 24, + "writeQueueSize": 0, + "readable": true, + "writable": true + }, + { + "type": "tcp", + "is_active": true, + "is_referenced": true, + "address": "0x000055e70fcd68c8", + "localEndpoint": { + "host": "ip6-localhost", + "ip6": "::1", // new key + "port": 52266 + }, + "remoteEndpoint": { + "host": "ip6-localhost", + "ip6": "::1", // new key + "port": 38573 + }, + "sendBufferSize": 2626560, + "recvBufferSize": 131072, + "fd": 25, + "writeQueueSize": 0, + "readable": false, + "writable": false + } + ] +} +``` + +#### Version 3 + + + +The following memory usage keys are added to the `resourceUsage` section. + +```json +{ + "resourceUsage": { + "rss": "35766272", + "free_memory": "1598337024", + "total_memory": "17179869184", + "available_memory": "1598337024", + "constrained_memory": "36624662528" + } +} +``` + +#### Version 2 + + + +Added [`Worker`][] support. Refer to [Interaction with workers](#interaction-with-workers) section for more details. + +#### Version 1 + +This is the first version of the diagnostic report. + ## Configuration Additional runtime configuration of report generation is available via