File tree Expand file tree Collapse file tree 5 files changed +25
-25
lines changed
packages/tracing/src/integrations/node Expand file tree Collapse file tree 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 {
2828 * @inheritDoc
2929 */
3030 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+
3136 const pkg = loadModule < {
3237 ApolloServerBase : {
3338 prototype : {
@@ -41,11 +46,6 @@ export class Apollo implements Integration {
4146 return ;
4247 }
4348
44- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
45- __DEBUG_BUILD__ && logger . log ( 'Apollo Integration is skipped because of instrumenter configuration.' ) ;
46- return ;
47- }
48-
4949 /**
5050 * Iterate over resolvers of the ApolloServer instance before schemas are constructed.
5151 */
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ export class GraphQL implements Integration {
2020 * @inheritDoc
2121 */
2222 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+
2328 const pkg = loadModule < {
2429 [ method : string ] : ( ...args : unknown [ ] ) => unknown ;
2530 } > ( 'graphql/execution/execute.js' ) ;
@@ -29,11 +34,6 @@ export class GraphQL implements Integration {
2934 return ;
3035 }
3136
32- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
33- __DEBUG_BUILD__ && logger . log ( 'GraphQL Integration is skipped because of instrumenter configuration.' ) ;
34- return ;
35- }
36-
3737 fill ( pkg , 'execute' , function ( orig : ( ) => void | Promise < unknown > ) {
3838 return function ( this : unknown , ...args : unknown [ ] ) {
3939 const scope = getCurrentHub ( ) . getScope ( ) ;
Original file line number Diff line number Diff line change @@ -127,6 +127,11 @@ export class Mongo implements Integration {
127127 * @inheritDoc
128128 */
129129 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+
130135 const moduleName = this . _useMongoose ? 'mongoose' : 'mongodb' ;
131136 const pkg = loadModule < { Collection : MongoCollection } > ( moduleName ) ;
132137
@@ -135,11 +140,6 @@ export class Mongo implements Integration {
135140 return ;
136141 }
137142
138- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
139- __DEBUG_BUILD__ && logger . log ( 'Mongo Integration is skipped because of instrumenter configuration.' ) ;
140- return ;
141- }
142-
143143 this . _instrumentOperations ( pkg . Collection , this . _operations , getCurrentHub ) ;
144144 }
145145
Original file line number Diff line number Diff line change @@ -24,18 +24,18 @@ export class Mysql implements Integration {
2424 * @inheritDoc
2525 */
2626 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+
2732 const pkg = loadModule < MysqlConnection > ( 'mysql/lib/Connection.js' ) ;
2833
2934 if ( ! pkg ) {
3035 __DEBUG_BUILD__ && logger . error ( 'Mysql Integration was unable to require `mysql` package.' ) ;
3136 return ;
3237 }
3338
34- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
35- __DEBUG_BUILD__ && logger . log ( 'Mysql Integration is skipped because of instrumenter configuration.' ) ;
36- return ;
37- }
38-
3939 // The original function will have one of these signatures:
4040 // function (callback) => void
4141 // function (options, callback) => void
Original file line number Diff line number Diff line change @@ -36,18 +36,18 @@ export class Postgres implements Integration {
3636 * @inheritDoc
3737 */
3838 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+
3944 const pkg = loadModule < { Client : PgClient ; native : { Client : PgClient } } > ( 'pg' ) ;
4045
4146 if ( ! pkg ) {
4247 __DEBUG_BUILD__ && logger . error ( 'Postgres Integration was unable to require `pg` package.' ) ;
4348 return ;
4449 }
4550
46- if ( shouldDisableAutoInstrumentation ( getCurrentHub ) ) {
47- __DEBUG_BUILD__ && logger . log ( 'Postgres Integration is skipped because of instrumenter configuration.' ) ;
48- return ;
49- }
50-
5151 if ( this . _usePgNative && ! pkg . native ?. Client ) {
5252 __DEBUG_BUILD__ && logger . error ( "Postgres Integration was unable to access 'pg-native' bindings." ) ;
5353 return ;
You can’t perform that action at this time.
0 commit comments