Add API to get orchestration history in .NET Isolated #3268
Conversation
nytian
left a comment
There was a problem hiding this comment.
Thanks for the PR! Overall looks good to me and I will go back here once the dotnet sdk is released. Left some small comments.
… unnecessary usings
There was a problem hiding this comment.
Pull request overview
This PR implements a new server-side API to retrieve orchestration history in .NET isolated worker processes. The implementation adds streaming support for orchestration history with automatic chunking for large histories (exceeding 2 MB), includes fallback to non-streaming methods for backends that don't support streaming, and adds comprehensive E2E tests to validate the functionality across different scenarios including failed orchestrations, large histories requiring chunking, and invalid instance IDs.
Key changes include:
- Added
StreamInstanceHistorygRPC endpoint inTaskHubGrpcServerwith automatic chunking for histories exceeding 2 MB - Enhanced history event serialization to include tags and failure details in
ProtobufUtils - Introduced
HistoryEventJsonConverterfor polymorphic deserialization of history events
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/WebJobs.Extensions.DurableTask/TaskHubGrpcServer.cs | Implements the StreamInstanceHistory gRPC method with chunking logic and fallback to non-streaming API |
| src/WebJobs.Extensions.DurableTask/ProtobufUtils.cs | Updates history event protobuf conversion to include tags for ExecutionStarted and TaskScheduled events, and failure details for ExecutionCompleted events |
| src/WebJobs.Extensions.DurableTask/HistoryEventJsonConverter.cs | New JSON converter for polymorphic deserialization of HistoryEvent types |
| src/WebJobs.Extensions.DurableTask/DurabilityProvider.cs | Adds virtual StreamOrchestrationHistoryAsync method for backends to implement streaming |
| src/Worker.Extensions.DurableTask/FunctionsDurableTaskClient.cs | Adds pass-through method for GetOrchestrationHistoryAsync to the inner client |
| test/e2e/Tests/Tests/GetOrchestrationHistoryTests.cs | Comprehensive E2E tests for failed orchestrations, large histories, and invalid instance IDs |
| test/e2e/Apps/BasicDotNetIsolated/GetOrchestrationHistory.cs | Test orchestrations and HTTP trigger for history retrieval |
| test/e2e/Tests/Tests/DistributedTracingEntitiesTests.cs | Improves JSON parsing using JsonSerializer instead of manual string manipulation |
| test/e2e/Tests/E2ETests.csproj | Adds assembly signing and project reference to WebJobs.Extensions.DurableTask |
| Directory.Packages.props | Updates package versions for Microsoft.DurableTask packages and transitive dependencies |
| samples/Directory.Packages.props | Updates transitive dependency versions |
| test/Directory.Packages.props | Updates transitive dependency versions |
| test/TimeoutTests/Python/Nuget.config | Removes durabletask package source |
| test/SmokeTests/OOProcSmokeTests/durablePy/Nuget.config | Removes durabletask package source |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/WebJobs.Extensions.DurableTask/TaskHubGrpcServer.cs:580
- The
GetFailureDetailsmethod in this class is missing recursive handling of nestedInnerFailureexceptions and theIsNonRetriableproperty. The equivalent method inProtobufUtils.cs(lines 385-410) correctly handles these. This means inner exception details will be lost when streaming orchestration history. Consider either using the existing method fromProtobufUtils.GetFailureDetailsor adding the missing recursive call and property assignment here.
private static P.TaskFailureDetails? GetFailureDetails(FailureDetails? failureDetails)
{
if (failureDetails == null)
{
return null;
}
return new P.TaskFailureDetails
{
ErrorType = failureDetails.ErrorType,
ErrorMessage = failureDetails.ErrorMessage,
StackTrace = failureDetails.StackTrace,
};
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR introduces the server-side implementation of a new API to retrieve orchestration history in .NET isolated. The client-side implementation is in this PR.
The server-side call is implemented in the
TaskHubGrpcServer. We also introduce a new method to stream the orchestration history in theDurabilityProvider. If the backend (so far only DTS) has an orchestration history streaming API implemented, then we will use that. If not, we will fall back to the "old method" (retrieving a JSON string of the orchestration history, deserializing it, converting it to protos, and sending that).PR to expose the history streaming API in the orchestration service in DTS (currently in draft-mode until the new WebJobs package is released).
Issue describing the changes in this PR
resolves #issue_for_this_pr
Pull request checklist
pending_docs.mdrelease_notes.md/src/Worker.Extensions.DurableTask/AssemblyInfo.csdevandmainbranches and will not be merged into thev2.xbranch.