question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DurableOrchestrationClient.GetStatusAsync() to get count of instances per RunTimeStatus.

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
cgillumcommented, Aug 24, 2018

[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.

1reaction
cgillumcommented, Mar 16, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found