File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -99,19 +99,15 @@ class DynamicTracer {
9999 const endOnExit = options . endOnExit === undefined ? true : options . endOnExit ; // default true
100100 const opts : SpanOptions = { attributes : options . attributes } ;
101101
102- return new Promise ( ( resolve , reject ) => {
103- this . tracer . startActiveSpan ( options . name , opts , ctx , async ( span ) => {
104- try {
105- const result = await fn ( span ) ;
106- resolve ( result ) ;
107- } catch ( error ) {
108- reject ( error ) ;
109- } finally {
110- if ( endOnExit ) {
111- span . end ( ) ;
112- }
102+ // Directly return the tracer's startActiveSpan result - it handles async correctly
103+ return await this . tracer . startActiveSpan ( options . name , opts , ctx , async ( span ) => {
104+ try {
105+ return await fn ( span ) ;
106+ } finally {
107+ if ( endOnExit ) {
108+ span . end ( ) ;
113109 }
114- } ) ;
110+ }
115111 } ) ;
116112 }
117113
You can’t perform that action at this time.
0 commit comments