Skip to content

DT change PoC #1111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,44 @@ function Start-DurableOrchestration {
}

$Body = $InputObject | ConvertTo-Json -Compress

$invokeParams = @{
Uri = $Uri
Method = 'POST'
ContentType = 'application/json'
Body = $Body
}

try {
$activity = Start-FunctionsOpenTelemetrySpan -ActivityName "Starting orchestration"

$traceId = $activity.activity.TraceId
$spanId = $activity.activity.SpanId

# Construct the traceparent header
$traceParent = "00-$traceId-$spanId-01"

$traceState = $activity.activity.TraceState

$invokeParams.Headers = @{
'traceparent' = $traceParent
'tracestate' = $traceState
}
# Do whatever you need to do with the trace information using the activity here
} catch {
# Do something better - correctly handle errors when the OTel SDK is not available
# Output errors from this command in a reasonable way
# Detect if calling Stop-FunctionsOpenTelemetrySpan is necessary and change that logic too
}

$null = Invoke-RestMethod -Uri $Uri -Method 'POST' -ContentType 'application/json' -Body $Body

$null = Invoke-RestMethod @invokeParams

try {
Stop-FunctionsOpenTelemetrySpan -Activity $activity
} catch {
# Do something better here
}

return $instanceId
}

Expand Down
Loading