9
9
useExtendContext ,
10
10
useMaskedErrors ,
11
11
} from '@envelop/core' ;
12
- import { chain , getInstrumented } from '@envelop/instruments ' ;
12
+ import { chain , getInstrumented } from '@envelop/instrumentation ' ;
13
13
import { normalizedExecutor } from '@graphql-tools/executor' ;
14
14
import { mapAsyncIterator } from '@graphql-tools/utils' ;
15
15
import { createLogger , LogLevel , YogaLogger } from '@graphql-yoga/logger' ;
@@ -51,7 +51,7 @@ import { useHTTPValidationError } from './plugins/request-validation/use-http-va
51
51
import { useLimitBatching } from './plugins/request-validation/use-limit-batching.js' ;
52
52
import { usePreventMutationViaGET } from './plugins/request-validation/use-prevent-mutation-via-get.js' ;
53
53
import {
54
- Instruments ,
54
+ Instrumentation ,
55
55
OnExecutionResultHook ,
56
56
OnParamsHook ,
57
57
OnRequestParseDoneHook ,
@@ -224,7 +224,9 @@ export class YogaServer<
224
224
protected plugins : Array <
225
225
Plugin < TUserContext & TServerContext & YogaInitialContext , TServerContext , TUserContext >
226
226
> ;
227
- private instruments : Instruments < TUserContext & TServerContext & YogaInitialContext > | undefined ;
227
+ private instrumentation :
228
+ | Instrumentation < TUserContext & TServerContext & YogaInitialContext >
229
+ | undefined ;
228
230
private onRequestParseHooks : OnRequestParseHook < TServerContext > [ ] ;
229
231
private onParamsHooks : OnParamsHook < TServerContext > [ ] ;
230
232
private onExecutionResultHooks : OnExecutionResultHook < TServerContext > [ ] ;
@@ -468,10 +470,10 @@ export class YogaServer<
468
470
if ( plugin . onResultProcess ) {
469
471
this . onResultProcessHooks . push ( plugin . onResultProcess ) ;
470
472
}
471
- if ( plugin . instruments ) {
472
- this . instruments = this . instruments
473
- ? chain ( this . instruments , plugin . instruments )
474
- : plugin . instruments ;
473
+ if ( plugin . instrumentation ) {
474
+ this . instrumentation = this . instrumentation
475
+ ? chain ( this . instrumentation , plugin . instrumentation )
476
+ : plugin . instrumentation ;
475
477
}
476
478
}
477
479
}
@@ -674,10 +676,10 @@ export class YogaServer<
674
676
request : Request ,
675
677
serverContext : TServerContext & ServerAdapterInitialContext ,
676
678
) => {
677
- const instrumented = this . instruments && getInstrumented ( { request } ) ;
679
+ const instrumented = this . instrumentation && getInstrumented ( { request } ) ;
678
680
679
- const parseRequest = this . instruments ?. requestParse
680
- ? instrumented ! . asyncFn ( this . instruments ?. requestParse , this . parseRequest )
681
+ const parseRequest = this . instrumentation ?. requestParse
682
+ ? instrumented ! . asyncFn ( this . instrumentation ?. requestParse , this . parseRequest )
681
683
: this . parseRequest ;
682
684
683
685
return handleMaybePromise (
@@ -686,11 +688,11 @@ export class YogaServer<
686
688
if ( response ) {
687
689
return response ;
688
690
}
689
- const getResultForParams = this . instruments ?. operation
691
+ const getResultForParams = this . instrumentation ?. operation
690
692
? ( payload : { request : Request ; params : GraphQLParams } , context : any ) => {
691
693
const instrumented = getInstrumented ( { context } ) ;
692
694
const tracedHandler = instrumented . asyncFn (
693
- this . instruments ?. operation ,
695
+ this . instrumentation ?. operation ,
694
696
this . getResultForParams ,
695
697
) ;
696
698
return tracedHandler ( payload , context ) ;
@@ -718,8 +720,11 @@ export class YogaServer<
718
720
serverContext ,
719
721
) ) as ResultProcessorInput ,
720
722
result => {
721
- const tracedProcessResult = this . instruments ?. resultProcess
722
- ? instrumented ! . asyncFn ( this . instruments . resultProcess , processResult < TServerContext > )
723
+ const tracedProcessResult = this . instrumentation ?. resultProcess
724
+ ? instrumented ! . asyncFn (
725
+ this . instrumentation . resultProcess ,
726
+ processResult < TServerContext > ,
727
+ )
723
728
: processResult < TServerContext > ;
724
729
725
730
return tracedProcessResult ( {
0 commit comments