Skip to content

add open-task diagnostics to orchestration execution logging - #1361

Open
Samir Solanki (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
Samir Solanki (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.

CopilotAI review requested due to automatic review settings May 27, 2026 22:59

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
src/DurableTask.Core/TaskOrchestrationExecutor.csCaptures open-task diagnostics into the execution result.
src/DurableTask.Core/TaskOrchestrationDispatcher.csThreads open-task diagnostics from execution result/cursor into logging calls.
src/DurableTask.Core/TaskOrchestrationContext.csAdds APIs to compute open-task count and a summary string.
src/DurableTask.Core/OrchestratorExecutionResult.csAdds non-serialized diagnostic fields for open tasks.
src/DurableTask.Core/OrchestrationExecutionCursor.csStores open-task diagnostics on the cursor.
src/DurableTask.Core/Logging/StructuredEventSource.csExtends event signature/payload to include open-task diagnostics.
src/DurableTask.Core/Logging/LogHelper.csExtends helper API to pass open-task diagnostics into structured log event.
src/DurableTask.Core/Logging/LogEvents.csPersists 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 threadsrc/DurableTask.Core/TaskOrchestrationDispatcher.cs
Comment threadsrc/DurableTask.Core/TaskOrchestrationDispatcher.cs Outdated
Comment threadsrc/DurableTask.Core/TaskOrchestrationContext.cs
Sign up for freeto 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

@solankisamir