File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
plugins/node/instrumentation-dataloader/src Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ export class DataloaderInstrumentation extends InstrumentationBase<DataloaderIns
139139 const instrumentation = this ;
140140 const prototype = constructor . prototype ;
141141
142- if ( ! instrumentation . isEnabled ( ) || ! instrumentation . shouldCreateSpans ( ) ) {
142+ if ( ! instrumentation . isEnabled ( ) ) {
143143 return constructor ;
144144 }
145145
@@ -149,13 +149,15 @@ export class DataloaderInstrumentation extends InstrumentationBase<DataloaderIns
149149 ) {
150150 // BatchLoadFn is the first constructor argument
151151 // https://github.com/graphql/dataloader/blob/77c2cd7ca97e8795242018ebc212ce2487e729d2/src/index.js#L47
152- if ( isWrapped ( args [ 0 ] ) ) {
153- instrumentation . _unwrap ( args , 0 ) ;
154- }
152+ if ( typeof args [ 0 ] === 'function' ) {
153+ if ( isWrapped ( args [ 0 ] ) ) {
154+ instrumentation . _unwrap ( args , 0 ) ;
155+ }
155156
156- args [ 0 ] = instrumentation . _wrapBatchLoadFn (
157- args [ 0 ]
158- ) as Dataloader . BatchLoadFn < unknown , unknown > ;
157+ args [ 0 ] = instrumentation . _wrapBatchLoadFn (
158+ args [ 0 ]
159+ ) as Dataloader . BatchLoadFn < unknown , unknown > ;
160+ }
159161
160162 return constructor . apply ( this , args ) ;
161163 }
You can’t perform that action at this time.
0 commit comments