Skip to content

add open-task diagnostics to orchestration execution logging#1361

Open
solankisamir wants to merge 2 commits into
Azure:mainfrom
solankisamir:sasolank/improve-logging-lost-activity
Open

add open-task diagnostics to orchestration execution logging#1361
solankisamir wants to merge 2 commits into
Azure:mainfrom
solankisamir:sasolank/improve-logging-lost-activity

Conversation

@solankisamir
Copy link
Copy Markdown
Member

Summary

This change improves diagnostics for orchestrations that appear stuck (for example, when no new durable actions are scheduled but the orchestration is still waiting on pending work). We had this problem in our Test environment, where an orchestration reached a point and then there were no logs from the application. It looks like the orchestration was hung.

What changed

  1. Added open-task diagnostics to orchestration execution flow:

    • OpenTaskCount
    • OpenTaskNames (e.g., ActivityName#12, Timer#8)
  2. Captured and propagated this data through execution objects:

    • TaskOrchestrationContext
    • OrchestratorExecutionResult (internal + [JsonIgnore])
    • OrchestrationExecutionCursor
    • TaskOrchestrationExecutor
    • TaskOrchestrationDispatcher
  3. Extended structured logging for OrchestrationExecuted:

    • LogEvents.OrchestrationExecuted now includes open-task fields
    • LogHelper.OrchestrationExecuted now passes open-task fields
    • StructuredEventSource.OrchestrationExecuted signature updated accordingly

Why

When an orchestration has 0 new decisions but still has open tasks, troubleshooting is difficult because logs only show action count. Including open-task count and names provides immediate visibility into what the orchestration is currently waiting on.

Scope

Diagnostics/logging only. No orchestration behavior changes.

Copilot AI review requested due to automatic review settings May 27, 2026 22:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds richer diagnostics to orchestration execution logging by capturing how many tasks an orchestration is currently waiting on and a short summary of those tasks.

Changes:

  • Populate OrchestratorExecutionResult and OrchestrationExecutionCursor with open-task count and a task summary.
  • Extend structured logging (OrchestrationExecuted) to include open-task diagnostics in both event source and log message.
  • Update dispatcher flow to pass these diagnostics through to logging.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/DurableTask.Core/TaskOrchestrationExecutor.cs Captures open-task diagnostics into the execution result.
src/DurableTask.Core/TaskOrchestrationDispatcher.cs Threads open-task diagnostics from execution result/cursor into logging calls.
src/DurableTask.Core/TaskOrchestrationContext.cs Adds APIs to compute open-task count and a summary string.
src/DurableTask.Core/OrchestratorExecutionResult.cs Adds non-serialized diagnostic fields for open tasks.
src/DurableTask.Core/OrchestrationExecutionCursor.cs Stores open-task diagnostics on the cursor.
src/DurableTask.Core/Logging/StructuredEventSource.cs Extends event signature/payload to include open-task diagnostics.
src/DurableTask.Core/Logging/LogHelper.cs Extends helper API to pass open-task diagnostics into structured log event.
src/DurableTask.Core/Logging/LogEvents.cs Persists new structured fields and includes them in the human-readable message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/DurableTask.Core/TaskOrchestrationDispatcher.cs
Comment thread src/DurableTask.Core/TaskOrchestrationDispatcher.cs Outdated
Comment thread src/DurableTask.Core/TaskOrchestrationContext.cs
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.

2 participants