Skip to content

Commit

Permalink
trace_events: fix getCategories
Browse files Browse the repository at this point in the history
  • Loading branch information
theanarkh committed Oct 20, 2022
1 parent 806ea92 commit c9aa695
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
27 changes: 19 additions & 8 deletions src/inspector/tracing_agent.cc
Expand Up @@ -173,14 +173,25 @@ DispatchResponse TracingAgent::stop() {
DispatchResponse TracingAgent::getCategories(
std::unique_ptr<protocol::Array<String>>* categories) {
*categories = Array<String>::create();
categories->get()->addItem("node");
categories->get()->addItem("node.async");
categories->get()->addItem("node.bootstrap");
categories->get()->addItem("node.fs.sync");
categories->get()->addItem("node.perf");
categories->get()->addItem("node.perf.usertiming");
categories->get()->addItem("node.perf.timerify");
categories->get()->addItem("v8");
protocol::Array<String>* categorie_list = categories->get();
categorie_list->addItem("node");
categorie_list->addItem("node.async_hooks");
categorie_list->addItem("node.bootstrap");
categorie_list->addItem("node.console");
categorie_list->addItem("node.dns.native");
categorie_list->addItem("node.net.native");
categorie_list->addItem("node.environment");
categorie_list->addItem("node.fs.sync");
categorie_list->addItem("node.fs_dir.sync");
categorie_list->addItem("node.fs.async");
categorie_list->addItem("node.fs_dir.async");
categorie_list->addItem("node.perf");
categorie_list->addItem("node.perf.usertiming");
categorie_list->addItem("node.perf.timerify");
categorie_list->addItem("node.promises.rejections");
categorie_list->addItem("node.vm.script");
categorie_list->addItem("v8");
categorie_list->addItem("node.http");
return DispatchResponse::OK();
}

Expand Down
25 changes: 21 additions & 4 deletions test/parallel/test-inspector-tracing-domain.js
Expand Up @@ -48,10 +48,27 @@ async function test() {
session.on('NodeTracing.dataCollected', (n) => traceNotification = n);
session.on('NodeTracing.tracingComplete', () => tracingComplete = true);
const { categories } = await post('NodeTracing.getCategories');
compareIgnoringOrder(['node', 'node.async', 'node.bootstrap', 'node.fs.sync',
'node.perf', 'node.perf.usertiming',
'node.perf.timerify', 'v8'],
categories);
compareIgnoringOrder([
"node",
"node.async_hooks",
"node.bootstrap",
"node.console",
"node.dns.native",
"node.net.native",
"node.environment",
"node.fs.sync",
"node.fs_dir.sync",
"node.fs.async",
"node.fs_dir.async",
"node.perf",
"node.perf.usertiming",
"node.perf.timerify",
"node.promises.rejections",
"node.vm.script",
"v8",
"node.http"
],
categories);

const traceConfig = { includedCategories: ['v8'] };
await post('NodeTracing.start', { traceConfig });
Expand Down

0 comments on commit c9aa695

Please sign in to comment.