How to watch all workflow's events inside a namespace?

I find GetWorkflowHistory can only watch one workflow. But I want to get notified when any workflow completed inside the specified namespace. So what should I do?

Thank you for your help!

Through SDK you can get per workflow type counter metrics:


You can filter those by namespace, workflow_type and task_queue attributes.

You can also emit custom metrics from your workflow code if you want. If cannot use metrics, another option could be activity that runs right before workflow completes that sends this notification.

What is your use case that requires such functionality?

Using metrics may be a way to get notification. But it seems that I have to listen to prometheus (or other stats system) to get notified, and can’t get which workflow is finished directly.

I’m trying to porting an existing DSL based workflow system to Temporal. We have a feature that the web ui can watch all running workflows and update their state in almost realtime.
Sending notification in a workflow activity is a potential solution. But I found temporal sdk can long poll a single workflow history, so ask here to get some advices.

I see. At this point periodically querying the workflows that are currently shown in the UI is the best option that doesn’t involve a separate notification subsystem.

In the future, we are planning to provide a way for workflows to post notifications that could be listened to.