Repository navigation
Persist activity invocation start times in history - #1439
Open
wangbill (YunchuWang) wants to merge 1 commit into
Open
wangbill (YunchuWang) wants to merge 1 commit into
wangbill (YunchuWang) wants to merge 1 commit into
Conversation
Related to Azure/azure-functions-durable-extension#2132. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the activity invocation start-time metadata change.
No open issues 🎉
What changed in this PR
Adds activity invocation start times to Core history so consumers can distinguish queueing from invocation time. This is a prerequisite for Durable Functions support, not a complete implementation of the requested feature.
Changes:
- Adds nullable
StartedTimemetadata to activity completion and failure events, captured immediately beforeRunAsync. - Preserves existing timestamps and replay behavior, leaving start times unknown when no matching invocation was observed.
- Adds dispatcher, serialization, and Azure Storage persistence tests, plus documentation of timing semantics and provider limitations.
| File | Description |
|---|---|
test/DurableTask.Core.Tests/ActivityStartedTimeTests.cs |
Tests invocation timing, middleware handling, redelivery, and serialization. |
test/DurableTask.AzureStorage.Tests/MessageManagerTests.cs |
Tests start-time preservation in response message serialization. |
test/DurableTask.AzureStorage.Tests/AzureTableTrackingStoreTest.cs |
Tests History-table and history JSON persistence. |
src/DurableTask.Core/TaskActivityDispatcher.cs |
Captures invocation start time and attaches it to matching responses. |
src/DurableTask.Core/History/TaskFailedEvent.cs |
Adds optional start-time metadata to failed activity events. |
src/DurableTask.Core/History/TaskCompletedEvent.cs |
Adds optional start-time metadata to completed activity events. |
docs/concepts/activities.md |
Documents timing semantics, compatibility, and provider support. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related to Azure/azure-functions-durable-extension#2132. This is a Core prerequisite, not a complete resolution of the Functions feature request.
Add nullable
StartedTimemetadata toTaskCompletedEventandTaskFailedEvent, sampled in UTC immediately beforeTaskActivity.RunAsync. This lets history consumers distinguish time spent queued from the activity invocation without using sampled telemetry or changing existing timestamps, constructors, event types, or replay behavior.Semantics and compatibility
TaskScheduledId, including normal and unexpected activity failures and middleware-replaced responses for that same task.RunAsyncboundary, including conversion and host work inside it, rather than claiming the exact entry into a user function. Cross-worker clock skew still applies.Azure Storage preserves the field through response serialization, History-table persistence, and history JSON. The existing Functions JSON status-history projection can retain it once a released Core package containing this change is adopted. Functions protobuf history mappings require a separate update; other providers/protocols and an actual Functions host have not been validated here. No dependency versions are changed and the related extension issue is intentionally not closed.
Validation
DurableClient.GetStatusAsyncagainst that stored history in all four input/output projection combinations. All four retainedStartedTime,ScheduledTime, andTimestamp. This exercised the real status client, not a Functions host. The worker, task hub, and local emulator state were cleaned up.AI disclosure
The implementation, tests, documentation, and PR description were generated by GitHub Copilot. Human review is still required; no human-review attestation is made.