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: separate release metadata #25826

Merged
merged 1 commit into from
Feb 1, 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
10 changes: 6 additions & 4 deletions doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ is provided below for reference.
"glibcVersionRuntime": "2.17",
"glibcVersionCompiler": "2.17",
"wordSize": "64 bit",
"arch": "x64",
"platform": "linux",
"componentVersions": {
"node": "12.0.0-pre",
"v8": "7.1.302.28-node.5",
Expand All @@ -50,10 +52,10 @@ is provided below for reference.
"napi": "3",
"llhttp": "1.0.1",
"http_parser": "2.8.0",
"openssl": "1.1.0j",
"arch": "x64",
"platform": "linux",
"release": "node"
"openssl": "1.1.0j"
},
"release": {
"name": "node"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we document other fields for a normal release build?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but a normal release build wouldn't be: "nodejsVersion": "v12.0.0-pre",.

},
"osVersion": "Linux 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018",
"machine": "Linux 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018test_machine x86_64"
Expand Down
33 changes: 27 additions & 6 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate);
static void PrintSystemInformation(JSONWriter* writer);
static void PrintLoadedLibraries(JSONWriter* writer);
static void PrintComponentVersions(JSONWriter* writer);
static void PrintRelease(JSONWriter* writer);
static void LocalTime(TIME_TYPE* tm_struct);

// Global variables
Expand Down Expand Up @@ -341,10 +342,15 @@ static void PrintVersionInformation(JSONWriter* writer) {

// Report Process word size
writer->json_keyvalue("wordSize", sizeof(void*) * 8);
writer->json_keyvalue("arch", node::per_process::metadata.arch);
writer->json_keyvalue("platform", node::per_process::metadata.platform);

// Report deps component versions
PrintComponentVersions(writer);

// Report release metadata.
PrintRelease(writer);

// Report operating system and machine information (Windows)
#ifdef _WIN32
{
Expand Down Expand Up @@ -724,12 +730,27 @@ static void PrintComponentVersions(JSONWriter* writer) {
NODE_VERSIONS_KEYS(V)
#undef V

// Some extra information that is not present in node_metadata.
writer->json_keyvalue("arch", NODE_ARCH);
writer->json_keyvalue("platform", NODE_PLATFORM);
writer->json_keyvalue("release", NODE_RELEASE);
if (NODE_VERSION_IS_LTS != 0)
writer->json_keyvalue("lts", NODE_VERSION_LTS_CODENAME);
writer->json_objectend();
}

// Report runtime release information.
static void PrintRelease(JSONWriter* writer) {
writer->json_objectstart("release");
writer->json_keyvalue("name", node::per_process::metadata.release.name);
#if NODE_VERSION_IS_LTS
writer->json_keyvalue("lts", node::per_process::metadata.release.lts);
#endif

#ifdef NODE_HAS_RELEASE_URLS
writer->json_keyvalue("headersUrl",
node::per_process::metadata.release.headers_url);
writer->json_keyvalue("sourceUrl",
node::per_process::metadata.release.source_url);
#ifdef _WIN32
writer->json_keyvalue("libUrl", node::per_process::metadata.release.lib_url);
#endif // _WIN32
#endif // NODE_HAS_RELEASE_URLS

writer->json_objectend();
}

Expand Down
3 changes: 3 additions & 0 deletions test/common/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function validateContent(data) {
'libuv', 'environmentVariables', 'sharedObjects'].forEach((section) => {
assert(report.hasOwnProperty(section));
});

assert.deepStrictEqual(report.header.componentVersions, process.versions);
assert.deepStrictEqual(report.header.release, process.release);
}

module.exports = { findReports, validate, validateContent };