-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Give a name to a Worker (for debugging purpose) #41589
Comments
@nodejs/workers |
I wonder why the |
@targos @benjamingr I don’t think we ever specifically thought about Worker names in the context of the inspector. #32434 also has a bunch of information about why we did not implement other kinds of APIs for naming Workers (yet). |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
I still believe adding name to the worker object rather than the worker's native thread (that suffers from portability issues) will be useful to some class of user scenarios - for example the tools (such as report, llnode etc.) can be taught to retrieve and display the worker names. Also, having a standard way of doing this such as in the worker constructor as opposed to the programmer explicitly adding it as a property makes the observability much more consistent. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
Can we not just get an optional 'WorkerPrefix' parameter that falls back to 'Worker'? That seems like a rather simple change to me? |
@flipswitchingmonkey I don't think there are any major objections, it just needs someone to do the work. Pull request welcome. I'm inclined to say it should be an |
My c++ is half a decade out of use, but I might have a look... A quick glance at the code shows me that at Line 267 in d15a6ba
WorkerThread +id), so it would probably make sense to somehow combine those into a single customisable prefix?
|
That's used for tracing. The inspector name is generated here: node/src/inspector/worker_inspector.cc Line 19 in d15a6ba
Of course it'd be good to have them be consistent. Perhaps the trace name can be computed from WorkerInfo::title or the other way around.
|
Fixes: #41589 PR-URL: #46832 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Fixes: #41589 PR-URL: #46832 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Fixes: #41589 PR-URL: #46832 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Fixes: #41589 PR-URL: #46832 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
What is the problem this feature will solve?
While debugging my Node.js app in VS Code, I've been trying to figure out which of the workers that are running is responsible for what, but found it hard to follow the flow as the workers were named
Worker ${index}
instead of having a more descriptive name. Since I'm heavily depending on workers and passing them any heavy job I encounter from time to time, I want to be able to track which of them is active at the moment during runtime.What is the feature you are proposing to solve the problem?
It would be great if you could allow passing an optional param to specify a name/title for the worker, so we can later on use to track which of the workers are running (by name and not by a random number).
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: