DurableOrchestrationClient.GetStatusAsync() to get count of instances per RunTimeStatus.
See original GitHub issueI want to retrieve the count of all orchestration instances that are currently Completed / Pending / Running / etc. so that I can show it on my health dashboard. Currently, the only way to do this is to call DurableOrchestrationClient.GetStatusAsync() without parameters and then analyze the result, e.g. with a Linq query:
var instances = await orchestrationClient.GetStatusAsync();
var stats = instances.GroupBy(x => x.RuntimeStatus).Select(group => new
{
Status = group.Key.ToString(),
Count = group.Count(),
}).ToList();
This takes up a lot of time and memory. In my case there are thousands of completed instances, so this take multiple minutes or doesn’t even finish before Functions times out.
To speed things up, is there a way to run the grouping and counting server-side, so that the client doesn’t have to pull the whole instance history?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Manage instances in Durable Functions - Azure
The durable get-runtime-status command takes the following parameters: id (required): ID of the orchestration instance. show-input (optional): ...
Read more >DurableOrchestrationClient.GetStatusAsync() returns that ...
I'm using the durable function singleton pattern on consumption plan . I want to execute only one instance of the function for the...
Read more >How To Pass Data to a Durable Functions Orchestrator ...
Currently the client function is starting a new orchestration instance with the code: string instanceId = await starter.StartNewAsync("OrchestratorFunction", ...
Read more >Managing Durable Functions Orchestration History
You can access the status of an orchestrator by calling the Get Instance Status API or using DurableOrchestrationClient.GetStatusAsync.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

[Thinking out loud] A server-side implementation would have the same potential issue with using a lot of memory… Internally I think the way we would create a summary function like this would be to use paging and count instances as we go through the pages. In theory, if we supported paging, you could do the same thing on the client, though it might actually be more efficient to implement on the server.
FYI @TsuyoshiUshio this seems like it would be a generally useful feature if you are interested.
One improvement that we’ve added is the ability to filter based on runtime status (amongst other things) via this GetStatus() overload. It won’t allow you to do aggregation, but it may reduce the overall overhead of counting instances.