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: add report versioning #28121

Merged
merged 1 commit into from
Jun 20, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ is provided below for reference.
```json
{
"header": {
"reportVersion": 1,
"event": "exception",
"trigger": "Exception",
"filename": "report.20181221.005011.8974.0.001.json",
Expand Down
3 changes: 2 additions & 1 deletion src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
extern char** environ;
#endif

constexpr int NODE_REPORT_VERSION = 1;
constexpr int NANOS_PER_SEC = 1000 * 1000 * 1000;
constexpr double SEC_PER_MICROS = 1e-6;

Expand Down Expand Up @@ -172,7 +173,7 @@ static void WriteNodeReport(Isolate* isolate,
JSONWriter writer(out);
writer.json_start();
writer.json_objectstart("header");

writer.json_keyvalue("reportVersion", NODE_REPORT_VERSION);
writer.json_keyvalue("event", message);
writer.json_keyvalue("trigger", trigger);
if (!filename.empty())
Expand Down
4 changes: 3 additions & 1 deletion test/common/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ function _validateContent(data) {
'nodejsVersion', 'wordSize', 'arch', 'platform',
'componentVersions', 'release', 'osName', 'osRelease',
'osVersion', 'osMachine', 'cpus', 'host',
'glibcVersionRuntime', 'glibcVersionCompiler', 'cwd'];
'glibcVersionRuntime', 'glibcVersionCompiler', 'cwd',
'reportVersion'];
checkForUnknownFields(header, headerFields);
assert.strictEqual(header.reportVersion, 1); // Increment as needed.
assert.strictEqual(typeof header.event, 'string');
assert.strictEqual(typeof header.trigger, 'string');
assert(typeof header.filename === 'string' || header.filename === null);
Expand Down