-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report: add
--report-exclude-network
option
New option `--report-exclude-network`, also available as `report.excludeNetwork`, enables the user to exclude networking interfaces in their diagnostic report. On some systems, this can cause the report to take minutes to generate so this option can be used to optimize that. Fixes: #46060 PR-URL: #51645 Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
- Loading branch information
1 parent
fc9ba17
commit 29f09f0
Showing
9 changed files
with
138 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('node:assert'); | ||
const { spawnSync } = require('node:child_process'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const { describe, it, before } = require('node:test'); | ||
const fs = require('node:fs'); | ||
const helper = require('../common/report'); | ||
|
||
function validate(pid) { | ||
const reports = helper.findReports(pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
let report = fs.readFileSync(reports[0], { encoding: 'utf8' }); | ||
report = JSON.parse(report); | ||
assert.strictEqual(report.header.networkInterfaces, undefined); | ||
fs.unlinkSync(reports[0]); | ||
} | ||
|
||
describe('report exclude network option', () => { | ||
before(() => { | ||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
}); | ||
|
||
it('should be configurable with --report-exclude-network', () => { | ||
const args = ['--report-exclude-network', '-e', 'process.report.writeReport()']; | ||
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | ||
assert.strictEqual(child.status, 0); | ||
assert.strictEqual(child.signal, null); | ||
validate(child.pid); | ||
}); | ||
|
||
it('should be configurable with report.excludeNetwork', () => { | ||
process.report.excludeNetwork = true; | ||
process.report.writeReport(); | ||
validate(process.pid); | ||
|
||
const report = process.report.getReport(); | ||
assert.strictEqual(report.header.networkInterfaces, undefined); | ||
}); | ||
}); |