Skip to content

Conversation

andystaples
Copy link
Contributor

@andystaples andystaples commented Jul 2, 2025

This PR adds support to add Invocation Id information to Module Private Data so we can use it for distributed tracing in Start-DurableOrchestration.

It is dependent on changes in the Functions PowerShell OpenTelemetry SDK: Azure/azure-functions-powershell-opentelemetry#25

Application Insights example (using the instructions in Use OpenTelemetry with Azure Functions):

image

App config:

host.json

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  },
  "managedDependency": {
    "enabled": true
  },
  "extensions": {
    "durableTask": {
      "tracing": {
        "distributedTracingEnabled": true,
        "version": "V2"
      }
    }
  },
  "telemetryMode": "OpenTelemetry"
}

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME_VERSION": "7.4",
    "FUNCTIONS_WORKER_RUNTIME": "powershell",
    "OTEL_FUNCTIONS_WORKER_ENABLED": "true",
    "APPLICATIONINSIGHTS_CONNECTION_STRING": "<connection string>"
  }
}

profile.ps1

Import-Module AzureFunctions.PowerShell.OpenTelemetry.SDK -Force -ErrorAction Stop 
Initialize-FunctionsOpenTelemetry 

requirements.psd1

@{
    'AzureFunctions.PowerShell.OpenTelemetry.SDK' = '2.*'
}

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • 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)

@bachuv bachuv marked this pull request as ready for review September 12, 2025 21:19
@bachuv bachuv changed the title DT change PoC Add Invocation Id to Set-FunctionInvocationContext and propagate trace information in HTTP requests to correlate client and orchestration functions Sep 12, 2025
@andystaples
Copy link
Contributor Author

Looks good, OK from me to merge

@bachuv bachuv merged commit aba76b7 into dev Sep 15, 2025
7 checks passed
@bachuv bachuv deleted the andystaples/distributed-tracing-poc branch September 15, 2025 17:51
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