|
| 1 | +# Workflow List and History RPCs for Durable Task |
| 2 | + |
| 3 | +* Author(s): @joshvanl |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This proposal adds two new RPCs to the durabletask framework which are used to support observability and discoverability of running and completed workflows in Dapr. |
| 8 | +Specifically, adding a `ListInstances` and `GetInstanceHistory` RPC to the durabletask gRPC service. |
| 9 | + |
| 10 | +## Background |
| 11 | + |
| 12 | +Today, there is no ways of discovering the list of workflow instances that are currently running or have completed in the past without using external storage queries. |
| 13 | +The Dapr CLI [introduced list and workflow history commands](https://github.com/dapr/cli/pull/1560) to get information about running and completed workflows, however these commands rely on direct queries to the underlying storage provider. |
| 14 | +By introducing this functionality into the durabletask framework itself, these commands need only talk to Daprd, removing the requirement for direct access to the storage provider as well as authentication. |
| 15 | +Daprd can make these queries itself, and use the Actor State Store component to access the underlying storage. |
| 16 | + |
| 17 | +## Related Items |
| 18 | + |
| 19 | +## Implementation Details |
| 20 | + |
| 21 | +### Design |
| 22 | + |
| 23 | +Two new RPCs will be added to the durabletask gRPC service, which will be available to both the application client, as well as the dapr CLI. |
| 24 | +The list RPC will be used to discover the workflow instance IDs, which their metadatda can then be fetched. |
| 25 | +The workflow history RPC will be used to fetch the full history of a given workflow instance. |
| 26 | + |
| 27 | +```proto |
| 28 | +service TaskHubSidecarService { |
| 29 | + rpc ListInstances (ListInstancesRequest) returns (ListInstancesResponse); |
| 30 | + rpc GetInstanceHistory (GetInstanceHistoryRequest) returns (GetInstanceHistoryResponse); |
| 31 | +} |
| 32 | +
|
| 33 | +// ListInstancesRequest is used to list all orchestration instances. |
| 34 | +message ListInstancesRequest { |
| 35 | + // continuationToken is the continuation token to use for pagination. This |
| 36 | + // is the index which the next page should start from. If not given, the first |
| 37 | + // page will be returned. |
| 38 | + optional uint32 continuationToken = 1; |
| 39 | +
|
| 40 | + // pageSize is the maximum number of instances to return for this page. If |
| 41 | + // not given, all instances will be attempted to be returned. |
| 42 | + optional uint32 pageSize = 2; |
| 43 | +} |
| 44 | +
|
| 45 | +// ListInstancesResponse is the response to executing ListInstances. |
| 46 | +message ListInstancesResponse { |
| 47 | + // instanceIds is the list of instance IDs returned. |
| 48 | + repeated string instanceIds = 1; |
| 49 | +} |
| 50 | +
|
| 51 | +// GetInstanceHistoryRequest is used to get the full history of an |
| 52 | +// orchestration instance. |
| 53 | +message GetInstanceHistoryRequest { |
| 54 | + string instanceId = 1; |
| 55 | +} |
| 56 | +
|
| 57 | +// GetInstanceHistoryResponse is the response to executing GetInstanceHistory. |
| 58 | +message GetInstanceHistoryResponse { |
| 59 | + repeated HistoryEvent events = 1; |
| 60 | +} |
| 61 | +``` |
0 commit comments