Skip to content

Conversation

@sophiatev
Copy link
Collaborator

@sophiatev sophiatev commented Dec 2, 2025

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 the DurabilityProvider. 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).

Note:
The method added to the DurabilityProvider class returns an enumerable of strings. Ideally, this would be an enumerable of the proto objects that we can then just forward on to the client. However, I get a "CS0050: Return type is less accessible than the method" error if I try to do this. That being said, we now have an extra unnecessary level of serialization introduced because of this (the backend converts the protos to strings, and the TaskHubGrpcServer converts these strings back to the same protos before sending them to the client).

Issue describing the changes in this PR

resolves #issue_for_this_pr

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation PR is ready to merge and referenced in pending_docs.md
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)
  • My changes do not require any extra work to be leveraged by OutOfProc SDKs
    • Otherwise: That work is being tracked here: #issue_or_pr_in_each_sdk
  • My changes do not change the version of the WebJobs.Extensions.DurableTask package
    • Otherwise: major or minor version updates are reflected in /src/Worker.Extensions.DurableTask/AssemblyInfo.cs
  • My changes do not add EventIds to our EventSource logs
    • Otherwise: Ensure the EventIds are within the supported range in our existing Windows infrastructure. You may validate this with a deployed app's telemetry. You may also extend the range by completing a PR such as this one.
  • My changes should be added to v2.x branch.
    • Otherwise: This change applies exclusively to WebJobs.Extensions.DurableTask v3.x. It will be retained only in the dev and main branches and will not be merged into the v2.x branch.

Copy link
Collaborator

@nytian nytian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

{
return false;
}
return other.CallEntities == this.CallEntities
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the indexing here?

jsonHistory,
new JsonSerializerSettings()
{
// I had to make the HistoryEventJsonConverter public to use it here. Is this a good reason?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try InternalsVisibleTo attribute?

/// <returns>The enumerable of history chunks representing the orchestration's history.</returns>
public virtual Task<IEnumerable<string>> StreamOrchestrationHistoryAsync(string instanceId, JsonFormatter jsonFormatter, CancellationToken cancellationToken)
{
throw this.GetNotImplementedException(nameof(this.StreamOrchestrationHistoryAsync));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we would expect a PR at other backends repo? Can you link those in the PR description too when they are done?

[Trait("Python", "Skip")] // The GetOrchestrationHistory API is not implemented in Python
[Trait("PowerShell", "Skip")] // The GetOrchestrationHistory API is not implemented in PowerShell
[Trait("Node", "Skip")] // The GetOrchestrationHistory API is not implemented in Node
public async Task GetOrchestrationHistory_FailedOrchestration()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a brief description of the test coverage scenario?

/// <inheritdoc/>
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
throw new NotImplementedException();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support write because we don't need this converter to write, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants