Skip to content

Commit 2d41030

Browse files
committed
set otel header value directly in update_workflow_input to avoid the extra call to payload conversion
1 parent 767228b commit 2d41030

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

temporalio/contrib/opentelemetry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,12 @@ async def start_update_with_start_workflow(
307307
input=input.start_workflow_input,
308308
kind=opentelemetry.trace.SpanKind.CLIENT,
309309
):
310-
if input.update_workflow_input:
311-
input.update_workflow_input.headers = self.root._context_to_headers(
312-
input.update_workflow_input.headers
313-
)
310+
otel_header = input.start_workflow_input.headers.get(self.root.header_key)
311+
if otel_header:
312+
input.update_workflow_input.headers = {
313+
**input.update_workflow_input.headers,
314+
self.root.header_key: otel_header,
315+
}
314316

315317
return await super().start_update_with_start_workflow(input)
316318

0 commit comments

Comments
 (0)