I’ve tried finding this in the docs but I might have missed it. I want to create a simple function that shows the number of running workers (just like in the temporal UI) but I could not find the right method. Did I miss it?
From cli / tctl you can get it by describing the task queue, for example:
tctl tq desc --tq $taskQueueName
temporal task-queue describe -t $taskQueueName
The api for this is https://github.com/temporalio/api/blob/master/temporal/api/workflowservice/v1/service.proto#L445
Note it shows worker identities that have polled on specific task queue in the last 2 minutes, so might not be always completely accurate (for example if one of your workers just went down).