@@ -812,7 +812,7 @@ async def async_wrapper(*args, **kwargs):
812812 )
813813 return await f (* args , ** kwargs )
814814
815- span_op = _get_span_op (template )
815+ span_op = op or _get_span_op (template )
816816 function_name = name or qualname_from_function (f ) or ""
817817 span_name = _get_span_name (template , function_name , kwargs )
818818 send_pii = should_send_default_pii ()
@@ -850,7 +850,7 @@ def sync_wrapper(*args, **kwargs):
850850 )
851851 return f (* args , ** kwargs )
852852
853- span_op = _get_span_op (template )
853+ span_op = op or _get_span_op (template )
854854 function_name = name or qualname_from_function (f ) or ""
855855 span_name = _get_span_name (template , function_name , kwargs )
856856 send_pii = should_send_default_pii ()
@@ -1113,8 +1113,6 @@ def _get_output_attributes(template, send_pii, result):
11131113 attributes .update (_get_usage_attributes (result .usage ))
11141114 if hasattr (result , "metadata" ) and hasattr (result .metadata , "usage" ):
11151115 attributes .update (_get_usage_attributes (result .metadata .usage ))
1116- if isinstance (result , dict ) and "usage" in result :
1117- attributes .update (_get_usage_attributes (result ["usage" ]))
11181116 if hasattr (result , "model" ) and isinstance (result .model , str ):
11191117 attributes [SPANDATA .GEN_AI_RESPONSE_MODEL ] = result .model
11201118 if hasattr (result , "model_name" ) and isinstance (result .model_name , str ):
0 commit comments