Get the count of currently active workflows and activities

Is there an API/command to get count of current active (running) workflows and activities in a namespace?

You can use count query if you are running with ElasticSearch integration to count number of open workflows. There is no way to count number of open activities at this point.

Are workflows that haven’t yet been scheduled considered open? Specifically, I’m thinking in terms of the schedule_to_start_latency metric. Is there a way to query for just the count of the workflows that fall into that bucket (i.e. workflows that have been scheduled but not started)?

Apologies if this should be a separate topic.

You are technically asking for task queue backlog count. It is not currently supported. The best way to monitor task queue backlog is to watch the schedule to start latency metric.

Ah ok. Are there any APIs that I can use to get programmatic access to that metric?

I think at this point it is a metric that is reported through a metric backend like Prometheus. I don’t think there is a Temporal gRPC API to get it.

Got it. Thank you for the quick reply.