Skip to content

Commit afe6346

Browse files
committed
Update context
1 parent abbfb4f commit afe6346

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

code/function/wrapper/__init__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ async def main(req: func.HttpRequest, context: func.Context) -> func.HttpRespons
1616
parent_context = TraceContextTextMapPropagator().extract(
1717
carrier=functions_current_context
1818
)
19-
token = attach(parent_context)
2019

2120
# Function logic
22-
try:
23-
with tracer.start_as_current_span("wrapper") as span:
24-
response = await func.AsgiMiddleware(app).handle_async(req, context)
25-
finally:
26-
# End distributed tracing
27-
detach(token)
21+
with tracer.start_as_current_span("wrapper", context=parent_context) as span:
22+
response = await func.AsgiMiddleware(app).handle_async(req, parent_context)
23+
24+
# token = attach(parent_context)
25+
# try:
26+
# with tracer.start_as_current_span("wrapper") as span:
27+
# response = await func.AsgiMiddleware(app).handle_async(req, parent_context)
28+
# finally:
29+
# # End distributed tracing
30+
# detach(token)
2831

2932
return response

0 commit comments

Comments
 (0)