File tree 5 files changed +25
-25
lines changed
packages/tracing/src/integrations/node
5 files changed +25
-25
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ export class Apollo implements Integration {
28
28
* @inheritDoc
29
29
*/
30
30
public setupOnce ( _ : ( callback : EventProcessor ) => void , getCurrentHub : ( ) => Hub ) : void {
31
+ if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
32
+ __DEBUG_BUILD__ && logger . log ( 'Apollo Integration is skipped because of instrumenter configuration.' ) ;
33
+ return ;
34
+ }
35
+
31
36
const pkg = loadModule < {
32
37
ApolloServerBase : {
33
38
prototype : {
@@ -41,11 +46,6 @@ export class Apollo implements Integration {
41
46
return ;
42
47
}
43
48
44
- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
45
- __DEBUG_BUILD__ && logger . log ( 'Apollo Integration is skipped because of instrumenter configuration.' ) ;
46
- return ;
47
- }
48
-
49
49
/**
50
50
* Iterate over resolvers of the ApolloServer instance before schemas are constructed.
51
51
*/
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ export class GraphQL implements Integration {
20
20
* @inheritDoc
21
21
*/
22
22
public setupOnce ( _ : ( callback : EventProcessor ) => void , getCurrentHub : ( ) => Hub ) : void {
23
+ if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
24
+ __DEBUG_BUILD__ && logger . log ( 'GraphQL Integration is skipped because of instrumenter configuration.' ) ;
25
+ return ;
26
+ }
27
+
23
28
const pkg = loadModule < {
24
29
[ method : string ] : ( ...args : unknown [ ] ) => unknown ;
25
30
} > ( 'graphql/execution/execute.js' ) ;
@@ -29,11 +34,6 @@ export class GraphQL implements Integration {
29
34
return ;
30
35
}
31
36
32
- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
33
- __DEBUG_BUILD__ && logger . log ( 'GraphQL Integration is skipped because of instrumenter configuration.' ) ;
34
- return ;
35
- }
36
-
37
37
fill ( pkg , 'execute' , function ( orig : ( ) => void | Promise < unknown > ) {
38
38
return function ( this : unknown , ...args : unknown [ ] ) {
39
39
const scope = getCurrentHub ( ) . getScope ( ) ;
Original file line number Diff line number Diff line change @@ -127,6 +127,11 @@ export class Mongo implements Integration {
127
127
* @inheritDoc
128
128
*/
129
129
public setupOnce ( _ : ( callback : EventProcessor ) => void , getCurrentHub : ( ) => Hub ) : void {
130
+ if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
131
+ __DEBUG_BUILD__ && logger . log ( 'Mongo Integration is skipped because of instrumenter configuration.' ) ;
132
+ return ;
133
+ }
134
+
130
135
const moduleName = this . _useMongoose ? 'mongoose' : 'mongodb' ;
131
136
const pkg = loadModule < { Collection : MongoCollection } > ( moduleName ) ;
132
137
@@ -135,11 +140,6 @@ export class Mongo implements Integration {
135
140
return ;
136
141
}
137
142
138
- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
139
- __DEBUG_BUILD__ && logger . log ( 'Mongo Integration is skipped because of instrumenter configuration.' ) ;
140
- return ;
141
- }
142
-
143
143
this . _instrumentOperations ( pkg . Collection , this . _operations , getCurrentHub ) ;
144
144
}
145
145
Original file line number Diff line number Diff line change @@ -24,18 +24,18 @@ export class Mysql implements Integration {
24
24
* @inheritDoc
25
25
*/
26
26
public setupOnce ( _ : ( callback : EventProcessor ) => void , getCurrentHub : ( ) => Hub ) : void {
27
+ if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
28
+ __DEBUG_BUILD__ && logger . log ( 'Mysql Integration is skipped because of instrumenter configuration.' ) ;
29
+ return ;
30
+ }
31
+
27
32
const pkg = loadModule < MysqlConnection > ( 'mysql/lib/Connection.js' ) ;
28
33
29
34
if ( ! pkg ) {
30
35
__DEBUG_BUILD__ && logger . error ( 'Mysql Integration was unable to require `mysql` package.' ) ;
31
36
return ;
32
37
}
33
38
34
- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
35
- __DEBUG_BUILD__ && logger . log ( 'Mysql Integration is skipped because of instrumenter configuration.' ) ;
36
- return ;
37
- }
38
-
39
39
// The original function will have one of these signatures:
40
40
// function (callback) => void
41
41
// function (options, callback) => void
Original file line number Diff line number Diff line change @@ -36,18 +36,18 @@ export class Postgres implements Integration {
36
36
* @inheritDoc
37
37
*/
38
38
public setupOnce ( _ : ( callback : EventProcessor ) => void , getCurrentHub : ( ) => Hub ) : void {
39
+ if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
40
+ __DEBUG_BUILD__ && logger . log ( 'Postgres Integration is skipped because of instrumenter configuration.' ) ;
41
+ return ;
42
+ }
43
+
39
44
const pkg = loadModule < { Client : PgClient ; native : { Client : PgClient } } > ( 'pg' ) ;
40
45
41
46
if ( ! pkg ) {
42
47
__DEBUG_BUILD__ && logger . error ( 'Postgres Integration was unable to require `pg` package.' ) ;
43
48
return ;
44
49
}
45
50
46
- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
47
- __DEBUG_BUILD__ && logger . log ( 'Postgres Integration is skipped because of instrumenter configuration.' ) ;
48
- return ;
49
- }
50
-
51
51
if ( this . _usePgNative && ! pkg . native ?. Client ) {
52
52
__DEBUG_BUILD__ && logger . error ( "Postgres Integration was unable to access 'pg-native' bindings." ) ;
53
53
return ;
You can’t perform that action at this time.
0 commit comments