From a646a22d0f26314d44ce24b0dd200e4289297996 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 6 Mar 2023 22:04:09 +0530 Subject: [PATCH] worker: add support for worker name in inspector and trace_events Fixes: https://github.com/nodejs/node/issues/41589 PR-URL: https://github.com/nodejs/node/pull/46832 Reviewed-By: Ben Noordhuis Reviewed-By: Benjamin Gruenbaum Reviewed-By: Anna Henningsen Reviewed-By: Darshan Sen Reviewed-By: Gireesh Punathil --- doc/api/worker_threads.md | 7 +++++ lib/internal/worker.js | 12 +++++-- src/api/environment.cc | 8 ++++- src/inspector/worker_inspector.cc | 23 ++++++++------ src/inspector/worker_inspector.h | 14 ++++----- src/inspector_agent.cc | 6 ++-- src/inspector_agent.h | 2 +- src/node.h | 6 ++++ src/node_worker.cc | 21 +++++++++---- src/node_worker.h | 3 ++ test/fixtures/worker-name.js | 17 ++++++++++ ...-trace-events-worker-metadata-with-name.js | 31 +++++++++++++++++++ .../test-trace-events-worker-metadata.js | 2 +- test/parallel/test-worker-name.js | 22 +++++++++++++ 14 files changed, 144 insertions(+), 30 deletions(-) create mode 100644 test/fixtures/worker-name.js create mode 100644 test/parallel/test-trace-events-worker-metadata-with-name.js create mode 100644 test/parallel/test-worker-name.js diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 43f10ae489a9a0..674424f6f0bf90 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -906,6 +906,10 @@ if (isMainThread) {