Skip to content

Commit 7f380da

Browse files
committed
Workflow List and History RPCs for Durable Task
* Author(s): @JoshVanL 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. Specifically, adding a `ListInstances` and `GetInstanceHistory` RPC to the durabletask gRPC service. 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. The Dapr CLI [introduced list and workflow history commands](dapr/cli#1560) to get information about running and completed workflows, however these commands rely on direct queries to the underlying storage provider. 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. Daprd can make these queries itself, and use the Actor State Store component to access the underlying storage. 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. The list RPC will be used to discover the workflow instance IDs, which their metadatda can then be fetched. The workflow history RPC will be used to fetch the full history of a given workflow instance. ```proto service TaskHubSidecarService { rpc ListInstances (ListInstancesRequest) returns (ListInstancesResponse); rpc GetInstanceHistory (GetInstanceHistoryRequest) returns (GetInstanceHistoryResponse); } // ListInstancesRequest is used to list all orchestration instances. message ListInstancesRequest { // continuationToken is the continuation token to use for pagination. This // is the index which the next page should start from. If not given, the first // page will be returned. optional uint32 continuationToken = 1; // pageSize is the maximum number of instances to return for this page. If // not given, all instances will be attempted to be returned. optional uint32 pageSize = 2; } // ListInstancesResponse is the response to executing ListInstances. message ListInstancesResponse { // instanceIds is the list of instance IDs returned. repeated string instanceIds = 1; } // GetInstanceHistoryRequest is used to get the full history of an // orchestration instance. message GetInstanceHistoryRequest { string instanceId = 1; } // GetInstanceHistoryResponse is the response to executing GetInstanceHistory. message GetInstanceHistoryResponse { repeated HistoryEvent events = 1; } ``` Signed-off-by: joshvanl <[email protected]>
1 parent 1a63d40 commit 7f380da

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

protos/backend_service.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ service BackendService {
7878

7979
// Returns the current metrics for the backend service.
8080
rpc GetMetrics (GetMetricsRequest) returns (GetMetricsResponse);
81+
82+
rpc ListInstances (ListInstancesRequest) returns (ListInstancesResponse);
83+
rpc GetInstanceHistory (GetInstanceHistoryRequest) returns (GetInstanceHistoryResponse);
8184
}
8285

8386
// Request payload for adding new orchestration events.

protos/orchestrator_service.proto

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,9 @@ service TaskHubSidecarService {
739739

740740
// Rerun a Workflow from a specific event ID of a workflow instance.
741741
rpc RerunWorkflowFromEvent(RerunWorkflowFromEventRequest) returns (RerunWorkflowFromEventResponse);
742+
743+
rpc ListInstances (ListInstancesRequest) returns (ListInstancesResponse);
744+
rpc GetInstanceHistory (GetInstanceHistoryRequest) returns (GetInstanceHistoryResponse);
742745
}
743746

744747
message GetWorkItemsRequest {
@@ -820,3 +823,32 @@ message RerunWorkflowFromEventRequest {
820823
message RerunWorkflowFromEventResponse {
821824
string newInstanceID = 1;
822825
}
826+
827+
// ListInstancesRequest is used to list all orchestration instances.
828+
message ListInstancesRequest {
829+
// continuationToken is the continuation token to use for pagination. This
830+
// is the index which the next page should start from. If not given, the first
831+
// page will be returned.
832+
optional uint32 continuationToken = 1;
833+
834+
// pageSize is the maximum number of instances to return for this page. If
835+
// not given, all instances will be attempted to be returned.
836+
optional uint32 pageSize = 2;
837+
}
838+
839+
// ListInstancesResponse is the response to executing ListInstances.
840+
message ListInstancesResponse {
841+
// instanceIds is the list of instance IDs returned.
842+
repeated string instanceIds = 1;
843+
}
844+
845+
// GetInstanceHistoryRequest is used to get the full history of an
846+
// orchestration instance.
847+
message GetInstanceHistoryRequest {
848+
string instanceId = 1;
849+
}
850+
851+
// GetInstanceHistoryResponse is the response to executing GetInstanceHistory.
852+
message GetInstanceHistoryResponse {
853+
repeated HistoryEvent events = 1;
854+
}

0 commit comments

Comments
 (0)