@@ -55,6 +55,19 @@ import {
5555 AwsLambdaInstrumentation ,
5656 AwsLambdaInstrumentationConfig ,
5757} from '@opentelemetry/instrumentation-aws-lambda' ;
58+ import { DnsInstrumentation } from '@opentelemetry/instrumentation-dns' ;
59+ import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express' ;
60+ import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql' ;
61+ import { GrpcInstrumentation } from '@opentelemetry/instrumentation-grpc' ;
62+ import { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi' ;
63+ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http' ;
64+ import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis' ;
65+ import { KoaInstrumentation } from '@opentelemetry/instrumentation-koa' ;
66+ import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb' ;
67+ import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql' ;
68+ import { NetInstrumentation } from '@opentelemetry/instrumentation-net' ;
69+ import { PgInstrumentation } from '@opentelemetry/instrumentation-pg' ;
70+ import { RedisInstrumentation } from '@opentelemetry/instrumentation-redis' ;
5871import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray' ;
5972import { AWSXRayLambdaPropagator } from '@opentelemetry/propagator-aws-xray-lambda' ;
6073
@@ -130,79 +143,42 @@ function defaultConfigureInstrumentations() {
130143 // Use require statements for instrumentation
131144 // to avoid having to have transitive dependencies on all the typescript definitions.
132145 if ( activeInstrumentations . has ( 'dns' ) ) {
133- const {
134- DnsInstrumentation,
135- } = require ( '@opentelemetry/instrumentation-dns' ) ;
136146 instrumentations . push ( new DnsInstrumentation ( ) ) ;
137147 }
138148 if ( activeInstrumentations . has ( 'express' ) ) {
139- const {
140- ExpressInstrumentation,
141- } = require ( '@opentelemetry/instrumentation-express' ) ;
142149 instrumentations . push ( new ExpressInstrumentation ( ) ) ;
143150 }
144151 if ( activeInstrumentations . has ( 'graphql' ) ) {
145- const {
146- GraphQLInstrumentation,
147- } = require ( '@opentelemetry/instrumentation-graphql' ) ;
148152 instrumentations . push ( new GraphQLInstrumentation ( ) ) ;
149153 }
150154 if ( activeInstrumentations . has ( 'grpc' ) ) {
151- const {
152- GrpcInstrumentation,
153- } = require ( '@opentelemetry/instrumentation-grpc' ) ;
154155 instrumentations . push ( new GrpcInstrumentation ( ) ) ;
155156 }
156157 if ( activeInstrumentations . has ( 'hapi' ) ) {
157- const {
158- HapiInstrumentation,
159- } = require ( '@opentelemetry/instrumentation-hapi' ) ;
160158 instrumentations . push ( new HapiInstrumentation ( ) ) ;
161159 }
162160 if ( activeInstrumentations . has ( 'http' ) ) {
163- const {
164- HttpInstrumentation,
165- } = require ( '@opentelemetry/instrumentation-http' ) ;
166161 instrumentations . push ( new HttpInstrumentation ( ) ) ;
167162 }
168163 if ( activeInstrumentations . has ( 'ioredis' ) ) {
169- const {
170- IORedisInstrumentation,
171- } = require ( '@opentelemetry/instrumentation-ioredis' ) ;
172164 instrumentations . push ( new IORedisInstrumentation ( ) ) ;
173165 }
174166 if ( activeInstrumentations . has ( 'koa' ) ) {
175- const {
176- KoaInstrumentation,
177- } = require ( '@opentelemetry/instrumentation-koa' ) ;
178167 instrumentations . push ( new KoaInstrumentation ( ) ) ;
179168 }
180169 if ( activeInstrumentations . has ( 'mongodb' ) ) {
181- const {
182- MongoDBInstrumentation,
183- } = require ( '@opentelemetry/instrumentation-mongodb' ) ;
184170 instrumentations . push ( new MongoDBInstrumentation ( ) ) ;
185171 }
186172 if ( activeInstrumentations . has ( 'mysql' ) ) {
187- const {
188- MySQLInstrumentation,
189- } = require ( '@opentelemetry/instrumentation-mysql' ) ;
190173 instrumentations . push ( new MySQLInstrumentation ( ) ) ;
191174 }
192175 if ( activeInstrumentations . has ( 'net' ) ) {
193- const {
194- NetInstrumentation,
195- } = require ( '@opentelemetry/instrumentation-net' ) ;
196176 instrumentations . push ( new NetInstrumentation ( ) ) ;
197177 }
198178 if ( activeInstrumentations . has ( 'pg' ) ) {
199- const { PgInstrumentation } = require ( '@opentelemetry/instrumentation-pg' ) ;
200179 instrumentations . push ( new PgInstrumentation ( ) ) ;
201180 }
202181 if ( activeInstrumentations . has ( 'redis' ) ) {
203- const {
204- RedisInstrumentation,
205- } = require ( '@opentelemetry/instrumentation-redis' ) ;
206182 instrumentations . push ( new RedisInstrumentation ( ) ) ;
207183 }
208184 return instrumentations ;
0 commit comments