File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
packages/service-library/src/servicelib Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -71,22 +71,22 @@ async def wrapper(*args: Any, **kwargs: Any) -> Any:
7171 span_name = f"{ func .__module__ } .{ func .__qualname__ } "
7272
7373 with tracer .start_as_current_span (span_name ) as span :
74+ profiler = pyinstrument .Profiler (async_mode = "enabled" )
75+ profiler .start ()
76+
7477 try :
75- profiler = pyinstrument .Profiler (async_mode = "enabled" )
76- profiler .start ()
77-
78- try :
79- return await func (* args , ** kwargs )
80- finally :
81- profiler .stop ()
82- span .set_attribute (
83- _PROFILE_ATTRIBUTE_NAME ,
84- profiler .output_text (unicode = True , color = False , show_all = True ),
85- )
78+ return await func (* args , ** kwargs )
8679
8780 except Exception as e :
8881 span .record_exception (e )
89- span .set_status (trace .Status (trace .StatusCode .ERROR , str ( e ) ))
82+ span .set_status (trace .Status (trace .StatusCode .ERROR , f" { e } " ))
9083 raise
9184
85+ finally :
86+ profiler .stop ()
87+ span .set_attribute (
88+ _PROFILE_ATTRIBUTE_NAME ,
89+ profiler .output_text (unicode = True , color = False , show_all = True ),
90+ )
91+
9292 return wrapper
You can’t perform that action at this time.
0 commit comments