@@ -1197,7 +1197,7 @@ def trace_handle_submit_tool_outputs(self, function, *args, **kwargs):
1197
1197
if span is None :
1198
1198
return function (* args , ** kwargs )
1199
1199
1200
- with span .change_context (span . span_instance ):
1200
+ with span .change_context (span ):
1201
1201
try :
1202
1202
result = function (* args , ** kwargs )
1203
1203
except Exception as exc :
@@ -1215,7 +1215,7 @@ async def trace_handle_submit_tool_outputs_async(self, function, *args, **kwargs
1215
1215
if span is None :
1216
1216
return await function (* args , ** kwargs )
1217
1217
1218
- with span .change_context (span . span_instance ):
1218
+ with span .change_context (span ):
1219
1219
try :
1220
1220
result = await function (* args , ** kwargs )
1221
1221
except Exception as exc :
@@ -1261,7 +1261,7 @@ def trace_create_stream(self, function, *args, **kwargs):
1261
1261
if span is None :
1262
1262
return function (* args , ** kwargs )
1263
1263
1264
- with span .change_context (span . span_instance ):
1264
+ with span .change_context (span ):
1265
1265
try :
1266
1266
kwargs ["event_handler" ] = self .wrap_handler (event_handler , span )
1267
1267
result = function (* args , ** kwargs )
@@ -1310,7 +1310,7 @@ async def trace_create_stream_async(self, function, *args, **kwargs):
1310
1310
1311
1311
# TODO: how to keep span active in the current context without existing?
1312
1312
# TODO: dummy span for none
1313
- with span .change_context (span . span_instance ):
1313
+ with span .change_context (span ):
1314
1314
try :
1315
1315
kwargs ["event_handler" ] = self .wrap_async_handler (event_handler , span )
1316
1316
result = await function (* args , ** kwargs )
0 commit comments