@@ -55,6 +55,19 @@ import {
55
55
AwsLambdaInstrumentation ,
56
56
AwsLambdaInstrumentationConfig ,
57
57
} 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' ;
58
71
import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray' ;
59
72
import { AWSXRayLambdaPropagator } from '@opentelemetry/propagator-aws-xray-lambda' ;
60
73
@@ -130,79 +143,42 @@ function defaultConfigureInstrumentations() {
130
143
// Use require statements for instrumentation
131
144
// to avoid having to have transitive dependencies on all the typescript definitions.
132
145
if ( activeInstrumentations . has ( 'dns' ) ) {
133
- const {
134
- DnsInstrumentation,
135
- } = require ( '@opentelemetry/instrumentation-dns' ) ;
136
146
instrumentations . push ( new DnsInstrumentation ( ) ) ;
137
147
}
138
148
if ( activeInstrumentations . has ( 'express' ) ) {
139
- const {
140
- ExpressInstrumentation,
141
- } = require ( '@opentelemetry/instrumentation-express' ) ;
142
149
instrumentations . push ( new ExpressInstrumentation ( ) ) ;
143
150
}
144
151
if ( activeInstrumentations . has ( 'graphql' ) ) {
145
- const {
146
- GraphQLInstrumentation,
147
- } = require ( '@opentelemetry/instrumentation-graphql' ) ;
148
152
instrumentations . push ( new GraphQLInstrumentation ( ) ) ;
149
153
}
150
154
if ( activeInstrumentations . has ( 'grpc' ) ) {
151
- const {
152
- GrpcInstrumentation,
153
- } = require ( '@opentelemetry/instrumentation-grpc' ) ;
154
155
instrumentations . push ( new GrpcInstrumentation ( ) ) ;
155
156
}
156
157
if ( activeInstrumentations . has ( 'hapi' ) ) {
157
- const {
158
- HapiInstrumentation,
159
- } = require ( '@opentelemetry/instrumentation-hapi' ) ;
160
158
instrumentations . push ( new HapiInstrumentation ( ) ) ;
161
159
}
162
160
if ( activeInstrumentations . has ( 'http' ) ) {
163
- const {
164
- HttpInstrumentation,
165
- } = require ( '@opentelemetry/instrumentation-http' ) ;
166
161
instrumentations . push ( new HttpInstrumentation ( ) ) ;
167
162
}
168
163
if ( activeInstrumentations . has ( 'ioredis' ) ) {
169
- const {
170
- IORedisInstrumentation,
171
- } = require ( '@opentelemetry/instrumentation-ioredis' ) ;
172
164
instrumentations . push ( new IORedisInstrumentation ( ) ) ;
173
165
}
174
166
if ( activeInstrumentations . has ( 'koa' ) ) {
175
- const {
176
- KoaInstrumentation,
177
- } = require ( '@opentelemetry/instrumentation-koa' ) ;
178
167
instrumentations . push ( new KoaInstrumentation ( ) ) ;
179
168
}
180
169
if ( activeInstrumentations . has ( 'mongodb' ) ) {
181
- const {
182
- MongoDBInstrumentation,
183
- } = require ( '@opentelemetry/instrumentation-mongodb' ) ;
184
170
instrumentations . push ( new MongoDBInstrumentation ( ) ) ;
185
171
}
186
172
if ( activeInstrumentations . has ( 'mysql' ) ) {
187
- const {
188
- MySQLInstrumentation,
189
- } = require ( '@opentelemetry/instrumentation-mysql' ) ;
190
173
instrumentations . push ( new MySQLInstrumentation ( ) ) ;
191
174
}
192
175
if ( activeInstrumentations . has ( 'net' ) ) {
193
- const {
194
- NetInstrumentation,
195
- } = require ( '@opentelemetry/instrumentation-net' ) ;
196
176
instrumentations . push ( new NetInstrumentation ( ) ) ;
197
177
}
198
178
if ( activeInstrumentations . has ( 'pg' ) ) {
199
- const { PgInstrumentation } = require ( '@opentelemetry/instrumentation-pg' ) ;
200
179
instrumentations . push ( new PgInstrumentation ( ) ) ;
201
180
}
202
181
if ( activeInstrumentations . has ( 'redis' ) ) {
203
- const {
204
- RedisInstrumentation,
205
- } = require ( '@opentelemetry/instrumentation-redis' ) ;
206
182
instrumentations . push ( new RedisInstrumentation ( ) ) ;
207
183
}
208
184
return instrumentations ;
0 commit comments