File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed
src/Modules/Microsoft.Azure.Functions.PowerShellWorker Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -133,17 +133,36 @@ function Start-DurableOrchestration {
133
133
134
134
$Body = $InputObject | ConvertTo-Json - Compress
135
135
136
+ $invokeParams = @ {
137
+ Uri = $Uri
138
+ Method = ' POST'
139
+ ContentType = ' application/json'
140
+ Body = $Body
141
+ }
142
+
136
143
try {
137
- $activity = Start-FunctionsOpenTelemetrySpan
138
- $traceID = $activity.activity.TraceId
144
+ $activity = Start-FunctionsOpenTelemetrySpan - ActivityName " Starting orchestration"
145
+
146
+ $traceId = $activity.activity.TraceId
147
+ $spanId = $activity.activity.SpanId
148
+
149
+ # Construct the traceparent header
150
+ $traceParent = " 00-$traceId -$spanId -01"
151
+
152
+ $traceState = $activity.activity.TraceState
153
+
154
+ $invokeParams.Headers = @ {
155
+ ' traceparent' = $traceParent
156
+ ' tracestate' = $traceState
157
+ }
139
158
# Do whatever you need to do with the trace information using the activity here
140
159
} catch {
141
160
# Do something better - correctly handle errors when the OTel SDK is not available
142
161
# Output errors from this command in a reasonable way
143
162
# Detect if calling Stop-FunctionsOpenTelemetrySpan is necessary and change that logic too
144
163
}
145
164
146
- $null = Invoke-RestMethod - Uri $Uri - Method ' POST ' - ContentType ' application/json ' - Body $Body
165
+ $null = Invoke-RestMethod @invokeParams
147
166
148
167
try {
149
168
Stop-FunctionsOpenTelemetrySpan - Activity $activity
You can’t perform that action at this time.
0 commit comments