Skip to content

Commit b5b7459

Browse files
jasnelladdaleax
authored andcommitted
trace_events: add version metadata
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]>
1 parent bb8d341 commit b5b7459

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/node.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4340,6 +4340,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
43404340
Environment env(isolate_data, context, v8_platform.GetTracingAgent());
43414341
env.Start(argc, argv, exec_argc, exec_argv, v8_is_profiling);
43424342

4343+
TRACE_EVENT_METADATA1("__metadata", "version", "node", NODE_VERSION_STRING);
43434344
TRACE_EVENT_METADATA1("__metadata", "thread_name", "name",
43444345
"JavaScriptMainThread");
43454346

test/parallel/test-trace-events-metadata.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ tmpdir.refresh();
1313
process.chdir(tmpdir.path);
1414

1515
const proc = cp.spawn(process.execPath,
16-
[ '--trace-events-enabled', '-e', CODE ]);
16+
[ '--trace-event-categories', 'node.perf.usertiming',
17+
'-e', CODE ]);
1718
proc.once('exit', common.mustCall(() => {
1819
assert(common.fileExists(FILE_NAME));
1920
fs.readFile(FILE_NAME, common.mustCall((err, data) => {
@@ -25,5 +26,8 @@ proc.once('exit', common.mustCall(() => {
2526
assert(traces.some((trace) =>
2627
trace.cat === '__metadata' && trace.name === 'thread_name' &&
2728
trace.args.name === 'BackgroundTaskRunner'));
29+
assert(traces.some((trace) =>
30+
trace.cat === '__metadata' && trace.name === 'version' &&
31+
trace.args.node === process.versions.node));
2832
}));
2933
}));

0 commit comments

Comments
 (0)