Skip to content

Bridge Azure Durable Functions host OTel activities to Datadog spans - #8938

Draft
chemystery09 wants to merge 3 commits into
DataDog:masterfrom
chemystery09:feat/azure-durable-functions-host-trace-bridge
Draft

Bridge Azure Durable Functions host OTel activities to Datadog spans#8938
chemystery09 wants to merge 3 commits into
DataDog:masterfrom
chemystery09:feat/azure-durable-functions-host-trace-bridge

Conversation

@chemystery09

Copy link
Copy Markdown

Summary

  • Adds a DurableTaskActivityHandler that subscribes to the WebJobs.Extensions.DurableTask ActivitySource emitted by the Azure Functions host when Distributed Tracing V2 is enabled in host.json.
  • Maps host-side durable task spans (orchestration lifecycle, create-orchestration, entity, timer, etc.) into Datadog with span.type=serverless and durabletask.* tags preserved.
  • Complements worker-side trace context propagation in dd-trace-js#9394, which links activity/entity invocations to the HTTP root but intentionally does not emit orchestration spans from the worker (replay-unsafe).

Motivation

Orchestration spans are emitted by the .NET Functions host (Durable extension), not by language workers. Application Insights already receives these spans when V2 tracing is enabled; this change bridges the same host Activity events into Datadog via the existing OTel ActivityListener infrastructure (QuartzActivityHandler, AzureServiceBusActivityHandler, etc.).

Related internal tracking: SVLS-7644 / APMSVLS-332.

Requirements

  1. Host config — enable V2 distributed tracing in host.json:
    {
      "extensions": {
        "durableTask": {
          "tracing": {
            "distributedTracingEnabled": true,
            "version": "V2"
          }
        }
      }
    }
  2. Tracer config — OTel activity listener enabled (DD_TRACE_OTEL_ENABLED=true or equivalent).
  3. Worker — dd-trace worker instrumentation (e.g. dd-trace-js #9394) for activity/entity server spans linked via propagated traceContext.

Implementation notes

  • Handler registered in ActivityHandlersRegister before DefaultActivityHandler.
  • Span resource names derived from durabletask.task.name + durabletask.type when present.
  • Host activity client spans may appear alongside worker server spans for the same logical step; deduplication/filtering can be refined in a follow-up.

Test plan

  • Unit tests for resource-name mapping, tag extraction, and ActivityKind → span kind mapping
  • Integration test with Durable Functions sample app + V2 host.json (follow-up)
  • Verify end-to-end trace: HTTP trigger → host orchestration span → worker activity span

Made with Cursor

chemystery09 and others added 3 commits July 24, 2026 13:58
Subscribe to the WebJobs.Extensions.DurableTask ActivitySource emitted by
the Functions host when Distributed Tracing V2 is enabled, and map host-side
orchestration and related durable task spans into Datadog with serverless
semantics. Complements worker-side trace context propagation in dd-trace-js.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
V2 durable tracing emits orchestration execution spans from the
Microsoft.DurableTask source, not only WebJobs.Extensions.DurableTask.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant