Skip to content

Commit

Permalink
trace_events: add version metadata
Browse files Browse the repository at this point in the history
Use `TRACE_EVENT_METADATA1` to include just the node.js version for
now. Later this can be expanded to include more version and platform
details.

PR-URL: #20852
Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
jasnell committed May 31, 2018
1 parent 0baad8f commit e60eed1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4322,6 +4322,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
Environment env(isolate_data, context, v8_platform.GetTracingAgent());
env.Start(argc, argv, exec_argc, exec_argv, v8_is_profiling);

TRACE_EVENT_METADATA1("__metadata", "version", "node", NODE_VERSION_STRING);
TRACE_EVENT_METADATA1("__metadata", "thread_name", "name",
"JavaScriptMainThread");

Expand Down
6 changes: 5 additions & 1 deletion test/parallel/test-trace-events-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ tmpdir.refresh();
process.chdir(tmpdir.path);

const proc = cp.spawn(process.execPath,
[ '--trace-events-enabled', '-e', CODE ]);
[ '--trace-event-categories', 'node.perf.usertiming',
'-e', CODE ]);
proc.once('exit', common.mustCall(() => {
assert(common.fileExists(FILE_NAME));
fs.readFile(FILE_NAME, common.mustCall((err, data) => {
Expand All @@ -25,5 +26,8 @@ proc.once('exit', common.mustCall(() => {
assert(traces.some((trace) =>
trace.cat === '__metadata' && trace.name === 'thread_name' &&
trace.args.name === 'BackgroundTaskRunner'));
assert(traces.some((trace) =>
trace.cat === '__metadata' && trace.name === 'version' &&
trace.args.node === process.versions.node));
}));
}));

0 comments on commit e60eed1

Please sign in to comment.