Skip to content

Add support for assigning names to worker_threads #32434

Description

@cTn-dev

Is your feature request related to a problem? Please describe.

  1. Having the ability to easily name threads would improve/simplify looking at the resource usage while monitoring/debugging in htop (with "Show custom thread names") enabled.
  2. Commonly used process exporter https://github.com/ncabatoff/process-exporter could expose thread names for prometheus and other monitoring tools in human readable format

Describe the solution you'd like

  • accept name or customName in the options object in new Worker constructor
  • add .setName() or .setCustomName() to the worker class
  • the above format should be fully backwards compatible

Describe alternatives you've considered
Haven't considered any alternatives at the moment.
I am not sure if process.execArgv can be leveraged here to set a thread name as an alternative way of setting it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.libuvIssues and PRs related to the libuv dependency or the uv binding.workerIssues and PRs related to the worker_threads module and Worker API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions