File tree 2 files changed +21
-3
lines changed
packages/tracing/src/integrations/node
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,33 @@ export class Apollo implements Integration {
35
35
} > ( 'apollo-server-core' ) ;
36
36
37
37
if ( ! pkg ) {
38
- logger . error ( 'Apollo Integration was unable to require apollo-server-core package.' ) ;
38
+ __DEBUG_BUILD__ && logger . error ( 'Apollo Integration was unable to require apollo-server-core package.' ) ;
39
39
return ;
40
40
}
41
41
42
42
/**
43
43
* Iterate over resolvers of the ApolloServer instance before schemas are constructed.
44
44
*/
45
45
fill ( pkg . ApolloServerBase . prototype , 'constructSchema' , function ( orig : ( ) => unknown ) {
46
- return function ( this : { config : { resolvers : ApolloModelResolvers [ ] } } ) {
46
+ return function ( this : { config : { resolvers ?: ApolloModelResolvers [ ] ; schema ?: unknown ; modules ?: unknown } } ) {
47
+ if ( ! this . config . resolvers ) {
48
+ if ( __DEBUG_BUILD__ ) {
49
+ if ( this . config . schema ) {
50
+ logger . warn (
51
+ 'Apollo integration is not able to trace `ApolloServer` instances constructed via `schema` property.' ,
52
+ ) ;
53
+ } else if ( this . config . modules ) {
54
+ logger . warn (
55
+ 'Apollo integration is not able to trace `ApolloServer` instances constructed via `modules` property.' ,
56
+ ) ;
57
+ }
58
+
59
+ logger . error ( 'Skipping tracing as no resolvers found on the `ApolloServer` instance.' ) ;
60
+ }
61
+
62
+ return orig . call ( this ) ;
63
+ }
64
+
47
65
const resolvers = arrayify ( this . config . resolvers ) ;
48
66
49
67
this . config . resolvers = resolvers . map ( model => {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export class GraphQL implements Integration {
23
23
} > ( 'graphql/execution/execute.js' ) ;
24
24
25
25
if ( ! pkg ) {
26
- logger . error ( 'GraphQL Integration was unable to require graphql/execution package.' ) ;
26
+ __DEBUG_BUILD__ && logger . error ( 'GraphQL Integration was unable to require graphql/execution package.' ) ;
27
27
return ;
28
28
}
29
29
You can’t perform that action at this time.
0 commit comments