Skip to content

Commit d6f6cce

Browse files
committed
DT change PoC
1 parent bd1bfa6 commit d6f6cce

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/Modules/Microsoft.Azure.Functions.PowerShellWorker/Microsoft.Azure.Functions.PowerShellWorker.psm1

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,25 @@ function Start-DurableOrchestration {
132132
}
133133

134134
$Body = $InputObject | ConvertTo-Json -Compress
135+
136+
try {
137+
$activity = Start-FunctionsOpenTelemetrySpan
138+
$traceID = $activity.activity.TraceId
139+
# Do whatever you need to do with the trace information using the activity here
140+
} catch {
141+
# Do something better - correctly handle errors when the OTel SDK is not available
142+
# Output errors from this command in a reasonable way
143+
# Detect if calling Stop-FunctionsOpenTelemetrySpan is necessary and change that logic too
144+
}
135145

136146
$null = Invoke-RestMethod -Uri $Uri -Method 'POST' -ContentType 'application/json' -Body $Body
137-
147+
148+
try {
149+
Stop-FunctionsOpenTelemetrySpan -Activity $activity
150+
} catch {
151+
# Do something better here
152+
}
153+
138154
return $instanceId
139155
}
140156

0 commit comments

Comments
 (0)