autotel-plugins 0.19.2 → 0.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var api = require('@opentelemetry/api');
4
- var traceHelpers = require('autotel/trace-helpers');
5
3
  var autotel = require('autotel');
4
+ var traceHelpers = require('autotel/trace-helpers');
5
+ var api = require('@opentelemetry/api');
6
6
 
7
7
  // src/common/constants.ts
8
8
  var SEMATTRS_DB_SYSTEM = "db.system";
@@ -15,7 +15,6 @@ var SEMATTRS_DB_COLLECTION_NAME = "db.collection.name";
15
15
  var SEMATTRS_DB_OPERATION_NAME = "db.operation.name";
16
16
  var SEMATTRS_DB_QUERY_TEXT = "db.query.text";
17
17
  var SEMATTRS_DB_QUERY_SUMMARY = "db.query.summary";
18
- var SEMATTRS_DB_MONGODB_COLLECTION = "db.mongodb.collection";
19
18
  var SEMATTRS_NET_PEER_NAME = "net.peer.name";
20
19
  var SEMATTRS_NET_PEER_PORT = "net.peer.port";
21
20
  var SEMATTRS_MESSAGING_SYSTEM = "messaging.system";
@@ -52,847 +51,9 @@ var SEMATTRS_MESSAGING_KAFKA_BATCH_LAST_OFFSET = "messaging.kafka.batch.last_off
52
51
  var SEMATTRS_MESSAGING_KAFKA_BATCH_MESSAGES_PROCESSED = "messaging.kafka.batch.messages_processed";
53
52
  var SEMATTRS_MESSAGING_KAFKA_BATCH_MESSAGES_FAILED = "messaging.kafka.batch.messages_failed";
54
53
  var SEMATTRS_MESSAGING_KAFKA_BATCH_PROCESSING_TIME_MS = "messaging.kafka.batch.processing_time_ms";
55
- var DEFAULT_TRACER_NAME = "autotel-plugins/drizzle";
56
- var DEFAULT_DB_SYSTEM = "postgresql";
57
- var INSTRUMENTED_FLAG = "__autotelDrizzleInstrumented";
58
- function extractQueryText(queryArg) {
59
- if (typeof queryArg === "string") {
60
- return queryArg;
61
- }
62
- if (queryArg && typeof queryArg === "object") {
63
- if (typeof queryArg.sql === "string") {
64
- return queryArg.sql;
65
- }
66
- if (typeof queryArg.text === "string") {
67
- return queryArg.text;
68
- }
69
- if (typeof queryArg.queryChunks === "object") {
70
- const drizzleQuery = queryArg;
71
- if (typeof drizzleQuery.sql === "string") {
72
- return drizzleQuery.sql;
73
- }
74
- }
75
- }
76
- return void 0;
77
- }
78
- function sanitizeQueryText(queryText, maxLength) {
79
- if (queryText.length <= maxLength) {
80
- return queryText;
81
- }
82
- return `${queryText.slice(0, Math.max(0, maxLength))}...`;
83
- }
84
- function extractOperation(queryText) {
85
- const trimmed = queryText.trimStart();
86
- const match = /^(?<op>\w+)/u.exec(trimmed);
87
- return match?.groups?.op?.toUpperCase();
88
- }
89
- function instrumentDrizzle(client, config) {
90
- if (!client) {
91
- return client;
92
- }
93
- const hasQuery = typeof client.query === "function";
94
- const hasExecute = typeof client.execute === "function";
95
- if (!hasQuery && !hasExecute) {
96
- return client;
97
- }
98
- if (client[INSTRUMENTED_FLAG]) {
99
- return client;
100
- }
101
- const {
102
- tracerName = DEFAULT_TRACER_NAME,
103
- dbSystem = DEFAULT_DB_SYSTEM,
104
- dbName,
105
- captureQueryText = true,
106
- maxQueryTextLength = 1e3,
107
- peerName,
108
- peerPort
109
- } = config ?? {};
110
- const tracer = api.trace.getTracer(tracerName);
111
- const originalMethod = hasQuery ? client.query : client.execute;
112
- if (!originalMethod) {
113
- return client;
114
- }
115
- const instrumentedMethod = function instrumented(...incomingArgs) {
116
- const args = [...incomingArgs];
117
- let callback;
118
- if (typeof args.at(-1) === "function") {
119
- callback = args.pop();
120
- }
121
- const queryText = extractQueryText(args[0]);
122
- const operation = queryText ? extractOperation(queryText) : void 0;
123
- const spanName = operation ? `drizzle.${operation.toLowerCase()}` : "drizzle.query";
124
- const span = tracer.startSpan(spanName, { kind: api.SpanKind.CLIENT });
125
- span.setAttribute(SEMATTRS_DB_SYSTEM, dbSystem);
126
- if (operation) {
127
- span.setAttribute(SEMATTRS_DB_OPERATION, operation);
128
- }
129
- if (dbName) {
130
- span.setAttribute(SEMATTRS_DB_NAME, dbName);
131
- }
132
- if (captureQueryText && queryText !== void 0) {
133
- const sanitized = sanitizeQueryText(queryText, maxQueryTextLength);
134
- span.setAttribute(SEMATTRS_DB_STATEMENT, sanitized);
135
- }
136
- if (peerName) {
137
- span.setAttribute(SEMATTRS_NET_PEER_NAME, peerName);
138
- }
139
- if (peerPort) {
140
- span.setAttribute(SEMATTRS_NET_PEER_PORT, peerPort);
141
- }
142
- if (callback) {
143
- return traceHelpers.runWithSpan(span, () => {
144
- const wrappedCallback = (err, result) => {
145
- traceHelpers.finalizeSpan(span, err);
146
- if (callback) {
147
- callback(err, result);
148
- }
149
- };
150
- try {
151
- return Reflect.apply(originalMethod, this, [
152
- ...args,
153
- wrappedCallback
154
- ]);
155
- } catch (error) {
156
- traceHelpers.finalizeSpan(span, error);
157
- throw error;
158
- }
159
- });
160
- }
161
- return traceHelpers.runWithSpan(span, () => {
162
- try {
163
- const result = originalMethod.apply(this, args);
164
- return Promise.resolve(result).then((value) => {
165
- traceHelpers.finalizeSpan(span);
166
- return value;
167
- }).catch((error) => {
168
- traceHelpers.finalizeSpan(span, error);
169
- throw error;
170
- });
171
- } catch (error) {
172
- traceHelpers.finalizeSpan(span, error);
173
- throw error;
174
- }
175
- });
176
- };
177
- client[INSTRUMENTED_FLAG] = true;
178
- if (hasQuery) {
179
- client.query = instrumentedMethod;
180
- } else {
181
- client.execute = instrumentedMethod;
182
- }
183
- return client;
184
- }
185
- function instrumentDrizzleClient(db, config) {
186
- if (!db) {
187
- return db;
188
- }
189
- if (db[INSTRUMENTED_FLAG]) {
190
- return db;
191
- }
192
- const {
193
- tracerName = DEFAULT_TRACER_NAME,
194
- dbSystem = DEFAULT_DB_SYSTEM,
195
- dbName,
196
- captureQueryText = true,
197
- maxQueryTextLength = 1e3,
198
- peerName,
199
- peerPort
200
- } = config ?? {};
201
- const tracer = api.trace.getTracer(tracerName);
202
- let instrumented = false;
203
- if (db.session && !instrumented) {
204
- const session = db.session;
205
- if (typeof session.prepareQuery === "function" && !session[INSTRUMENTED_FLAG]) {
206
- const originalPrepareQuery = session.prepareQuery;
207
- session.prepareQuery = function(...args) {
208
- const prepared = originalPrepareQuery.apply(this, args);
209
- if (prepared && typeof prepared.execute === "function") {
210
- const originalPreparedExecute = prepared.execute;
211
- prepared.execute = function(...executeArgs) {
212
- const queryObj = args[0];
213
- const queryText = queryObj?.sql || queryObj?.queryString || extractQueryText(queryObj);
214
- const operation = queryText ? extractOperation(queryText) : void 0;
215
- const spanName = operation ? `drizzle.${operation.toLowerCase()}` : "drizzle.query";
216
- const span = tracer.startSpan(spanName, { kind: api.SpanKind.CLIENT });
217
- span.setAttribute(SEMATTRS_DB_SYSTEM, dbSystem);
218
- if (operation) {
219
- span.setAttribute(SEMATTRS_DB_OPERATION, operation);
220
- }
221
- if (dbName) {
222
- span.setAttribute(SEMATTRS_DB_NAME, dbName);
223
- }
224
- if (captureQueryText && queryText !== void 0) {
225
- const sanitized = sanitizeQueryText(
226
- queryText,
227
- maxQueryTextLength
228
- );
229
- span.setAttribute(SEMATTRS_DB_STATEMENT, sanitized);
230
- }
231
- if (peerName) {
232
- span.setAttribute(SEMATTRS_NET_PEER_NAME, peerName);
233
- }
234
- if (peerPort) {
235
- span.setAttribute(SEMATTRS_NET_PEER_PORT, peerPort);
236
- }
237
- return traceHelpers.runWithSpan(span, () => {
238
- try {
239
- const result = originalPreparedExecute.apply(this, executeArgs);
240
- return Promise.resolve(result).then((value) => {
241
- traceHelpers.finalizeSpan(span);
242
- return value;
243
- }).catch((error) => {
244
- traceHelpers.finalizeSpan(span, error);
245
- throw error;
246
- });
247
- } catch (error) {
248
- traceHelpers.finalizeSpan(span, error);
249
- throw error;
250
- }
251
- });
252
- };
253
- }
254
- return prepared;
255
- };
256
- session[INSTRUMENTED_FLAG] = true;
257
- instrumented = true;
258
- }
259
- if (typeof session.query === "function" && !session[INSTRUMENTED_FLAG + "_query"]) {
260
- const originalQuery = session.query;
261
- session.query = function(queryString, params) {
262
- const operation = queryString ? extractOperation(queryString) : void 0;
263
- const spanName = operation ? `drizzle.${operation.toLowerCase()}` : "drizzle.query";
264
- const span = tracer.startSpan(spanName, { kind: api.SpanKind.CLIENT });
265
- span.setAttribute(SEMATTRS_DB_SYSTEM, dbSystem);
266
- if (operation) {
267
- span.setAttribute(SEMATTRS_DB_OPERATION, operation);
268
- }
269
- if (dbName) {
270
- span.setAttribute(SEMATTRS_DB_NAME, dbName);
271
- }
272
- if (captureQueryText && queryString !== void 0) {
273
- const sanitized = sanitizeQueryText(queryString, maxQueryTextLength);
274
- span.setAttribute(SEMATTRS_DB_STATEMENT, sanitized);
275
- }
276
- if (peerName) {
277
- span.setAttribute(SEMATTRS_NET_PEER_NAME, peerName);
278
- }
279
- if (peerPort) {
280
- span.setAttribute(SEMATTRS_NET_PEER_PORT, peerPort);
281
- }
282
- return traceHelpers.runWithSpan(span, () => {
283
- try {
284
- const result = Reflect.apply(originalQuery, this, [
285
- queryString,
286
- params
287
- ]);
288
- return Promise.resolve(result).then((value) => {
289
- traceHelpers.finalizeSpan(span);
290
- return value;
291
- }).catch((error) => {
292
- traceHelpers.finalizeSpan(span, error);
293
- throw error;
294
- });
295
- } catch (error) {
296
- traceHelpers.finalizeSpan(span, error);
297
- throw error;
298
- }
299
- });
300
- };
301
- session[INSTRUMENTED_FLAG + "_query"] = true;
302
- instrumented = true;
303
- }
304
- if (typeof session.transaction === "function" && !session[INSTRUMENTED_FLAG + "_transaction"]) {
305
- const originalTransaction = session.transaction;
306
- session.transaction = function(transactionCallback, ...restArgs) {
307
- const wrappedCallback = async function(tx) {
308
- if (tx && (tx.session || tx._?.session || tx)) {
309
- const txSession = tx.session || tx._?.session || tx;
310
- if (typeof tx.execute === "function" && !tx[INSTRUMENTED_FLAG + "_execute"]) {
311
- const originalTxExecute = tx.execute;
312
- tx.execute = function(...executeArgs) {
313
- const queryText = extractQueryText(executeArgs[0]);
314
- const operation = queryText ? extractOperation(queryText) : void 0;
315
- const spanName = operation ? `drizzle.${operation.toLowerCase()}` : "drizzle.query";
316
- const span = tracer.startSpan(spanName, {
317
- kind: api.SpanKind.CLIENT
318
- });
319
- span.setAttribute(SEMATTRS_DB_SYSTEM, dbSystem);
320
- span.setAttribute("db.transaction", true);
321
- if (operation) {
322
- span.setAttribute(SEMATTRS_DB_OPERATION, operation);
323
- }
324
- if (dbName) {
325
- span.setAttribute(SEMATTRS_DB_NAME, dbName);
326
- }
327
- if (captureQueryText && queryText !== void 0) {
328
- const sanitized = sanitizeQueryText(
329
- queryText,
330
- maxQueryTextLength
331
- );
332
- span.setAttribute(SEMATTRS_DB_STATEMENT, sanitized);
333
- }
334
- if (peerName) {
335
- span.setAttribute(SEMATTRS_NET_PEER_NAME, peerName);
336
- }
337
- if (peerPort) {
338
- span.setAttribute(SEMATTRS_NET_PEER_PORT, peerPort);
339
- }
340
- return traceHelpers.runWithSpan(span, () => {
341
- try {
342
- const result = originalTxExecute.apply(this, executeArgs);
343
- return Promise.resolve(result).then((value) => {
344
- traceHelpers.finalizeSpan(span);
345
- return value;
346
- }).catch((error) => {
347
- traceHelpers.finalizeSpan(span, error);
348
- throw error;
349
- });
350
- } catch (error) {
351
- traceHelpers.finalizeSpan(span, error);
352
- throw error;
353
- }
354
- });
355
- };
356
- tx[INSTRUMENTED_FLAG + "_execute"] = true;
357
- }
358
- if (typeof txSession.prepareQuery === "function" && !txSession[INSTRUMENTED_FLAG + "_tx"]) {
359
- const originalTxPrepareQuery = txSession.prepareQuery;
360
- txSession.prepareQuery = function(...prepareArgs) {
361
- const prepared = originalTxPrepareQuery.apply(
362
- this,
363
- prepareArgs
364
- );
365
- if (prepared && typeof prepared.execute === "function") {
366
- const originalPreparedExecute = prepared.execute;
367
- prepared.execute = function(...executeArgs) {
368
- const queryObj = prepareArgs[0];
369
- const queryText = queryObj?.sql || queryObj?.queryString || extractQueryText(queryObj);
370
- const operation = queryText ? extractOperation(queryText) : void 0;
371
- const spanName = operation ? `drizzle.${operation.toLowerCase()}` : "drizzle.query";
372
- const span = tracer.startSpan(spanName, {
373
- kind: api.SpanKind.CLIENT
374
- });
375
- span.setAttribute(SEMATTRS_DB_SYSTEM, dbSystem);
376
- span.setAttribute("db.transaction", true);
377
- if (operation) {
378
- span.setAttribute(SEMATTRS_DB_OPERATION, operation);
379
- }
380
- if (dbName) {
381
- span.setAttribute(SEMATTRS_DB_NAME, dbName);
382
- }
383
- if (captureQueryText && queryText !== void 0) {
384
- const sanitized = sanitizeQueryText(
385
- queryText,
386
- maxQueryTextLength
387
- );
388
- span.setAttribute(SEMATTRS_DB_STATEMENT, sanitized);
389
- }
390
- if (peerName) {
391
- span.setAttribute(SEMATTRS_NET_PEER_NAME, peerName);
392
- }
393
- if (peerPort) {
394
- span.setAttribute(SEMATTRS_NET_PEER_PORT, peerPort);
395
- }
396
- return traceHelpers.runWithSpan(span, () => {
397
- try {
398
- const result = originalPreparedExecute.apply(
399
- this,
400
- executeArgs
401
- );
402
- return Promise.resolve(result).then((value) => {
403
- traceHelpers.finalizeSpan(span);
404
- return value;
405
- }).catch((error) => {
406
- traceHelpers.finalizeSpan(span, error);
407
- throw error;
408
- });
409
- } catch (error) {
410
- traceHelpers.finalizeSpan(span, error);
411
- throw error;
412
- }
413
- });
414
- };
415
- }
416
- return prepared;
417
- };
418
- txSession[INSTRUMENTED_FLAG + "_tx"] = true;
419
- }
420
- }
421
- return transactionCallback(tx);
422
- };
423
- return Reflect.apply(originalTransaction, this, [
424
- wrappedCallback,
425
- ...restArgs
426
- ]);
427
- };
428
- session[INSTRUMENTED_FLAG + "_transaction"] = true;
429
- instrumented = true;
430
- }
431
- }
432
- if (db.$client && !instrumented) {
433
- const client = db.$client;
434
- if (typeof client.query === "function" || typeof client.execute === "function") {
435
- instrumentDrizzle(client, config);
436
- instrumented = true;
437
- }
438
- }
439
- if (db._ && db._.session && typeof db._.session.execute === "function" && !instrumented) {
440
- const session = db._.session;
441
- if (session[INSTRUMENTED_FLAG]) {
442
- return db;
443
- }
444
- const {
445
- tracerName: tracerName2 = DEFAULT_TRACER_NAME,
446
- dbSystem: dbSystem2 = DEFAULT_DB_SYSTEM,
447
- dbName: dbName2,
448
- captureQueryText: captureQueryText2 = true,
449
- maxQueryTextLength: maxQueryTextLength2 = 1e3,
450
- peerName: peerName2,
451
- peerPort: peerPort2
452
- } = config ?? {};
453
- const tracer2 = api.trace.getTracer(tracerName2);
454
- const originalExecute = session.execute;
455
- if (!originalExecute) {
456
- return db;
457
- }
458
- const instrumentedExecute = function instrumented2(...args) {
459
- const queryText = extractQueryText(args[0]);
460
- const operation = queryText ? extractOperation(queryText) : void 0;
461
- const spanName = operation ? `drizzle.${operation.toLowerCase()}` : "drizzle.query";
462
- const span = tracer2.startSpan(spanName, { kind: api.SpanKind.CLIENT });
463
- span.setAttribute(SEMATTRS_DB_SYSTEM, dbSystem2);
464
- if (operation) {
465
- span.setAttribute(SEMATTRS_DB_OPERATION, operation);
466
- }
467
- if (dbName2) {
468
- span.setAttribute(SEMATTRS_DB_NAME, dbName2);
469
- }
470
- if (captureQueryText2 && queryText !== void 0) {
471
- const sanitized = sanitizeQueryText(queryText, maxQueryTextLength2);
472
- span.setAttribute(SEMATTRS_DB_STATEMENT, sanitized);
473
- }
474
- if (peerName2) {
475
- span.setAttribute(SEMATTRS_NET_PEER_NAME, peerName2);
476
- }
477
- if (peerPort2) {
478
- span.setAttribute(SEMATTRS_NET_PEER_PORT, peerPort2);
479
- }
480
- return traceHelpers.runWithSpan(span, () => {
481
- try {
482
- const result = originalExecute.apply(this, args);
483
- return Promise.resolve(result).then((value) => {
484
- traceHelpers.finalizeSpan(span);
485
- return value;
486
- }).catch((error) => {
487
- traceHelpers.finalizeSpan(span, error);
488
- throw error;
489
- });
490
- } catch (error) {
491
- traceHelpers.finalizeSpan(span, error);
492
- throw error;
493
- }
494
- });
495
- };
496
- session[INSTRUMENTED_FLAG] = true;
497
- session.execute = instrumentedExecute;
498
- instrumented = true;
499
- }
500
- if (instrumented) {
501
- db[INSTRUMENTED_FLAG] = true;
502
- }
503
- return db;
504
- }
505
- var DEFAULT_TRACER_NAME2 = "autotel-plugins/mongoose";
506
- var DEFAULT_DB_SYSTEM2 = "mongoose";
507
- var INSTRUMENTED_FLAG2 = "__autotelMongooseInstrumented";
508
- var WRAPPED_HOOK_FLAG = "__autotelWrappedHook";
509
- var _STORED_PARENT_SPAN = /* @__PURE__ */ Symbol("stored-parent-span");
510
- function createSpan(tracer, operation, modelName, collectionName, config) {
511
- const spanName = collectionName ? `mongoose.${collectionName}.${operation}` : modelName ? `mongoose.${modelName}.${operation}` : `mongoose.${operation}`;
512
- const attributes = {
513
- [SEMATTRS_DB_SYSTEM]: DEFAULT_DB_SYSTEM2,
514
- [SEMATTRS_DB_OPERATION]: operation
515
- };
516
- if (collectionName && config.captureCollectionName) {
517
- attributes[SEMATTRS_DB_MONGODB_COLLECTION] = collectionName;
518
- }
519
- if (config.dbName) {
520
- attributes[SEMATTRS_DB_NAME] = config.dbName;
521
- }
522
- if (config.peerName) {
523
- attributes[SEMATTRS_NET_PEER_NAME] = config.peerName;
524
- }
525
- if (config.peerPort) {
526
- attributes[SEMATTRS_NET_PEER_PORT] = config.peerPort;
527
- }
528
- return tracer.startSpan(spanName, { kind: autotel.SpanKind.CLIENT, attributes });
529
- }
530
- function wrapQueryMethod(target, methodName, operation, getCollectionName, getModelName, tracer, config) {
531
- const original = target[methodName];
532
- if (typeof original !== "function") {
533
- return;
534
- }
535
- target[methodName] = function instrumented(...args) {
536
- const collectionName = getCollectionName(this);
537
- const modelName = getModelName(this);
538
- const span = createSpan(
539
- tracer,
540
- operation,
541
- modelName,
542
- collectionName,
543
- config
544
- );
545
- return traceHelpers.runWithSpan(span, () => {
546
- try {
547
- const result = original.apply(this, args);
548
- if (result && typeof result.exec === "function") {
549
- const originalExec = result.exec.bind(result);
550
- result.exec = function wrappedExec() {
551
- try {
552
- const execPromise = originalExec();
553
- return Promise.resolve(execPromise).then((value) => {
554
- traceHelpers.finalizeSpan(span);
555
- return value;
556
- }).catch((error) => {
557
- traceHelpers.finalizeSpan(
558
- span,
559
- error instanceof Error ? error : new Error(String(error))
560
- );
561
- throw error;
562
- });
563
- } catch (error) {
564
- traceHelpers.finalizeSpan(
565
- span,
566
- error instanceof Error ? error : new Error(String(error))
567
- );
568
- throw error;
569
- }
570
- };
571
- return result;
572
- }
573
- if (result && typeof result.then === "function") {
574
- return Promise.resolve(result).then((value) => {
575
- traceHelpers.finalizeSpan(span);
576
- return value;
577
- }).catch((error) => {
578
- traceHelpers.finalizeSpan(
579
- span,
580
- error instanceof Error ? error : new Error(String(error))
581
- );
582
- throw error;
583
- });
584
- }
585
- traceHelpers.finalizeSpan(span);
586
- return result;
587
- } catch (error) {
588
- traceHelpers.finalizeSpan(
589
- span,
590
- error instanceof Error ? error : new Error(String(error))
591
- );
592
- throw error;
593
- }
594
- });
595
- };
596
- }
597
- function wrapChainableMethod(target, methodName) {
598
- const original = target[methodName];
599
- if (typeof original !== "function") {
600
- return;
601
- }
602
- target[methodName] = function captureContext(...args) {
603
- const currentSpan = traceHelpers.getActiveSpan();
604
- const result = original.apply(this, args);
605
- if (result && typeof result.exec === "function") {
606
- result[_STORED_PARENT_SPAN] = currentSpan;
607
- }
608
- return result;
609
- };
610
- }
611
- function patchSchemaHooks(Schema, tracer, config) {
612
- if (!Schema?.prototype) {
613
- return;
614
- }
615
- const HOOK_FLAG = "__autotelHookInstrumented";
616
- if (Schema.prototype[HOOK_FLAG]) {
617
- return;
618
- }
619
- const originalPre = Schema.prototype.pre;
620
- if (typeof originalPre === "function") {
621
- Schema.prototype.pre = function(hookName, ...args) {
622
- const handler = typeof args[0] === "function" ? args[0] : typeof args[1] === "function" ? args[1] : null;
623
- if (handler && !isMongooseInternalHook(handler)) {
624
- const wrapped = wrapHookHandler(
625
- handler,
626
- hookName,
627
- "pre",
628
- tracer,
629
- config
630
- );
631
- if (typeof args[0] === "function") {
632
- args[0] = wrapped;
633
- } else if (typeof args[1] === "function") {
634
- args[1] = wrapped;
635
- }
636
- }
637
- return Reflect.apply(originalPre, this, [hookName, ...args]);
638
- };
639
- }
640
- const originalPost = Schema.prototype.post;
641
- if (typeof originalPost === "function") {
642
- Schema.prototype.post = function(hookName, ...args) {
643
- const handler = typeof args[0] === "function" ? args[0] : typeof args[1] === "function" ? args[1] : null;
644
- if (handler && !isMongooseInternalHook(handler)) {
645
- const wrapped = wrapHookHandler(
646
- handler,
647
- hookName,
648
- "post",
649
- tracer,
650
- config
651
- );
652
- if (typeof args[0] === "function") {
653
- args[0] = wrapped;
654
- } else if (typeof args[1] === "function") {
655
- args[1] = wrapped;
656
- }
657
- }
658
- return Reflect.apply(originalPost, this, [hookName, ...args]);
659
- };
660
- }
661
- Schema.prototype[HOOK_FLAG] = true;
662
- }
663
- function isMongooseInternalHook(handler) {
664
- if (typeof handler !== "function") {
665
- return false;
666
- }
667
- const funcName = handler.name || "";
668
- if (funcName.startsWith("_") || funcName.startsWith("$")) {
669
- return true;
670
- }
671
- const mongooseInternalNamePatterns = [
672
- "shardingPlugin",
673
- "mongooseInternalHook",
674
- "noop",
675
- "wrapped",
676
- "bound "
677
- ];
678
- if (mongooseInternalNamePatterns.some((pattern) => funcName.includes(pattern))) {
679
- return true;
680
- }
681
- try {
682
- const source = handler.toString();
683
- const mongooseInternalSourcePatterns = [
684
- "this.$__",
685
- // Mongoose internal document methods
686
- "this.$isValid",
687
- // Mongoose validation
688
- "this.$locals",
689
- // Mongoose local properties
690
- "_this.$__",
691
- // Mongoose internal with closure
692
- "schema.s.hooks",
693
- // Mongoose hooks system
694
- "kareem"
695
- // Mongoose's hooks library
696
- ];
697
- if (mongooseInternalSourcePatterns.some((pattern) => source.includes(pattern))) {
698
- return true;
699
- }
700
- } catch {
701
- }
702
- return false;
703
- }
704
- function wrapHookHandler(handler, hookName, hookType, tracer, config) {
705
- if (typeof handler !== "function") {
706
- return handler;
707
- }
708
- if (handler[WRAPPED_HOOK_FLAG]) {
709
- return handler;
710
- }
711
- const wrappedHook = function wrappedHook2(...args) {
712
- let modelName;
713
- let collectionName;
714
- try {
715
- if (this.constructor?.modelName) {
716
- modelName = this.constructor.modelName;
717
- collectionName = this.constructor.collection?.collectionName || modelName;
718
- } else if (this.model?.modelName) {
719
- modelName = this.model.modelName;
720
- collectionName = this.model.collection?.collectionName || modelName;
721
- }
722
- } catch {
723
- }
724
- const spanName = collectionName ? `mongoose.${collectionName}.${hookType}.${hookName}` : `mongoose.hook.${hookType}.${hookName}`;
725
- const span = tracer.startSpan(spanName, { kind: autotel.SpanKind.INTERNAL });
726
- span.setAttribute("hook.type", hookType);
727
- span.setAttribute("hook.operation", hookName);
728
- if (modelName) {
729
- span.setAttribute("hook.model", modelName);
730
- }
731
- if (collectionName && config.captureCollectionName) {
732
- span.setAttribute(SEMATTRS_DB_MONGODB_COLLECTION, collectionName);
733
- }
734
- span.setAttribute(SEMATTRS_DB_SYSTEM, DEFAULT_DB_SYSTEM2);
735
- if (config.dbName) {
736
- span.setAttribute(SEMATTRS_DB_NAME, config.dbName);
737
- }
738
- return traceHelpers.runWithSpan(span, () => {
739
- try {
740
- const result = handler.apply(this, args);
741
- if (result && typeof result.then === "function") {
742
- return Promise.resolve(result).then((value) => {
743
- traceHelpers.finalizeSpan(span);
744
- return value;
745
- }).catch((error) => {
746
- traceHelpers.finalizeSpan(
747
- span,
748
- error instanceof Error ? error : new Error(String(error))
749
- );
750
- throw error;
751
- });
752
- }
753
- traceHelpers.finalizeSpan(span);
754
- return result;
755
- } catch (error) {
756
- traceHelpers.finalizeSpan(
757
- span,
758
- error instanceof Error ? error : new Error(String(error))
759
- );
760
- throw error;
761
- }
762
- });
763
- };
764
- wrappedHook[WRAPPED_HOOK_FLAG] = true;
765
- return wrappedHook;
766
- }
767
- function instrumentMongoose(mongoose, config) {
768
- if (!mongoose?.Model) {
769
- return mongoose;
770
- }
771
- const m = mongoose;
772
- if (m[INSTRUMENTED_FLAG2]) {
773
- return mongoose;
774
- }
775
- const finalConfig = {
776
- dbName: config?.dbName || "",
777
- peerName: config?.peerName || "",
778
- peerPort: config?.peerPort || 27017,
779
- tracerName: config?.tracerName || DEFAULT_TRACER_NAME2,
780
- captureCollectionName: config?.captureCollectionName ?? true,
781
- instrumentHooks: config?.instrumentHooks ?? false
782
- };
783
- const tracer = autotel.otelTrace.getTracer(finalConfig.tracerName);
784
- if (m.Schema && finalConfig.instrumentHooks) {
785
- patchSchemaHooks(m.Schema, tracer, finalConfig);
786
- }
787
- const getModelCollectionName = (model) => {
788
- try {
789
- return model.collection?.collectionName || model.modelName;
790
- } catch {
791
- return;
792
- }
793
- };
794
- const queryMethods = [
795
- { method: "find", operation: "find" },
796
- { method: "findOne", operation: "findOne" },
797
- { method: "findById", operation: "findById" },
798
- { method: "findOneAndUpdate", operation: "findOneAndUpdate" },
799
- { method: "findOneAndDelete", operation: "findOneAndDelete" },
800
- { method: "findOneAndReplace", operation: "findOneAndReplace" },
801
- { method: "deleteOne", operation: "deleteOne" },
802
- { method: "deleteMany", operation: "deleteMany" },
803
- { method: "updateOne", operation: "updateOne" },
804
- { method: "updateMany", operation: "updateMany" },
805
- { method: "countDocuments", operation: "countDocuments" },
806
- { method: "estimatedDocumentCount", operation: "estimatedDocumentCount" }
807
- ];
808
- for (const { method, operation } of queryMethods) {
809
- wrapQueryMethod(
810
- m.Model,
811
- method,
812
- operation,
813
- getModelCollectionName,
814
- (model) => model.modelName,
815
- tracer,
816
- finalConfig
817
- );
818
- if (m.Query?.prototype?.[method]) {
819
- wrapChainableMethod(m.Query.prototype, method);
820
- }
821
- }
822
- const instanceMethods = ["save", "deleteOne"];
823
- for (const method of instanceMethods) {
824
- if (m.Model.prototype[method]) {
825
- wrapQueryMethod(
826
- m.Model.prototype,
827
- method,
828
- method,
829
- (doc) => {
830
- try {
831
- return doc.constructor?.collection?.collectionName || doc.constructor?.modelName;
832
- } catch {
833
- return;
834
- }
835
- },
836
- (doc) => {
837
- try {
838
- return doc.constructor?.modelName;
839
- } catch {
840
- return;
841
- }
842
- },
843
- tracer,
844
- finalConfig
845
- );
846
- }
847
- }
848
- const staticMethods = ["create", "insertMany", "aggregate", "bulkWrite"];
849
- for (const method of staticMethods) {
850
- if (m.Model[method]) {
851
- wrapQueryMethod(
852
- m.Model,
853
- method,
854
- method,
855
- (model) => {
856
- try {
857
- return model.collection?.collectionName;
858
- } catch {
859
- return;
860
- }
861
- },
862
- (model) => model.modelName,
863
- tracer,
864
- finalConfig
865
- );
866
- }
867
- }
868
- const chainableMethods = [
869
- "populate",
870
- "select",
871
- "lean",
872
- "where",
873
- "sort",
874
- "limit",
875
- "skip"
876
- ];
877
- for (const method of chainableMethods) {
878
- if (m.Query?.prototype?.[method]) {
879
- wrapChainableMethod(m.Query.prototype, method);
880
- }
881
- }
882
- m[INSTRUMENTED_FLAG2] = true;
883
- return mongoose;
884
- }
885
- var MongooseInstrumentation = class {
886
- constructor(config) {
887
- this.config = config;
888
- }
889
- enable(mongoose) {
890
- instrumentMongoose(mongoose, this.config);
891
- }
892
- };
893
- var DEFAULT_TRACER_NAME3 = "autotel-plugins/bigquery";
54
+ var DEFAULT_TRACER_NAME = "autotel-plugins/bigquery";
894
55
  var DEFAULT_DB_SYSTEM_NAME = "gcp.bigquery";
895
- var INSTRUMENTED_FLAG3 = "__autotelBigQueryInstrumented";
56
+ var INSTRUMENTED_FLAG = "__autotelBigQueryInstrumented";
896
57
  var PROTOTYPE_INSTRUMENTED_FLAG = "__autotelBigQueryPrototypeInstrumented";
897
58
  var CONFIG_STORAGE_KEY = "__autotelBigQueryConfig";
898
59
  var TRACER_STORAGE_KEY = "__autotelBigQueryTracer";
@@ -1006,7 +167,7 @@ function extractTableReference(obj) {
1006
167
  return {};
1007
168
  }
1008
169
  }
1009
- function createSpan2(tracer, operationName, target, projectId, config = {}) {
170
+ function createSpan(tracer, operationName, target, projectId, config = {}) {
1010
171
  const spanName = target ? `${operationName} ${target}` : operationName;
1011
172
  const attributes = {
1012
173
  [SEMATTRS_DB_SYSTEM_NAME]: DEFAULT_DB_SYSTEM_NAME,
@@ -1036,7 +197,7 @@ function instrumentQueryMethod(BigQuery) {
1036
197
  const location = extractLocation(this, options);
1037
198
  const operation = queryText ? extractOperationType(queryText) : "QUERY";
1038
199
  const summary = queryText ? createQuerySummary(queryText) : "QUERY";
1039
- const span = createSpan2(
200
+ const span = createSpan(
1040
201
  tracer,
1041
202
  operation || "QUERY",
1042
203
  summary,
@@ -1148,7 +309,7 @@ function instrumentCreateQueryJob(BigQuery) {
1148
309
  const location = extractLocation(this, options);
1149
310
  const operation = queryText ? extractOperationType(queryText) : "QUERY";
1150
311
  const summary = queryText ? createQuerySummary(queryText) : "QUERY";
1151
- const span = createSpan2(
312
+ const span = createSpan(
1152
313
  tracer,
1153
314
  `${operation || "QUERY"}_JOB`,
1154
315
  summary,
@@ -1234,7 +395,7 @@ function instrumentTableInsert(Table) {
1234
395
  options
1235
396
  );
1236
397
  const target = tableRef.tableId ? tableRef.datasetId ? `${tableRef.datasetId}.${tableRef.tableId}` : tableRef.tableId : void 0;
1237
- const span = createSpan2(tracer, "INSERT", target, projectId, config);
398
+ const span = createSpan(tracer, "INSERT", target, projectId, config);
1238
399
  if (location) {
1239
400
  span.setAttribute(SEMATTRS_GCP_BIGQUERY_JOB_LOCATION, location);
1240
401
  }
@@ -1293,7 +454,7 @@ function instrumentTableGetRows(Table) {
1293
454
  options
1294
455
  );
1295
456
  const target = tableRef.tableId ? tableRef.datasetId ? `${tableRef.datasetId}.${tableRef.tableId}` : tableRef.tableId : void 0;
1296
- const span = createSpan2(tracer, "SELECT", target, projectId, config);
457
+ const span = createSpan(tracer, "SELECT", target, projectId, config);
1297
458
  if (location) {
1298
459
  span.setAttribute(SEMATTRS_GCP_BIGQUERY_JOB_LOCATION, location);
1299
460
  }
@@ -1350,7 +511,7 @@ function instrumentTableCreateLoadJob(Table) {
1350
511
  metadata
1351
512
  );
1352
513
  const target = tableRef.tableId ? tableRef.datasetId ? `${tableRef.datasetId}.${tableRef.tableId}` : tableRef.tableId : void 0;
1353
- const span = createSpan2(tracer, "LOAD", target, projectId, config);
514
+ const span = createSpan(tracer, "LOAD", target, projectId, config);
1354
515
  if (location) {
1355
516
  span.setAttribute(SEMATTRS_GCP_BIGQUERY_JOB_LOCATION, location);
1356
517
  }
@@ -1407,7 +568,7 @@ function instrumentTableCreateCopyJob(Table) {
1407
568
  metadata
1408
569
  );
1409
570
  const source = sourceRef.tableId ? sourceRef.datasetId ? `${sourceRef.datasetId}.${sourceRef.tableId}` : sourceRef.tableId : "unknown";
1410
- const span = createSpan2(tracer, "COPY", source, projectId, config);
571
+ const span = createSpan(tracer, "COPY", source, projectId, config);
1411
572
  if (location) {
1412
573
  span.setAttribute(SEMATTRS_GCP_BIGQUERY_JOB_LOCATION, location);
1413
574
  }
@@ -1462,7 +623,7 @@ function instrumentTableCreateExtractJob(Table) {
1462
623
  metadata
1463
624
  );
1464
625
  const source = sourceRef.tableId ? sourceRef.datasetId ? `${sourceRef.datasetId}.${sourceRef.tableId}` : sourceRef.tableId : "unknown";
1465
- const span = createSpan2(tracer, "EXTRACT", source, projectId, config);
626
+ const span = createSpan(tracer, "EXTRACT", source, projectId, config);
1466
627
  if (location) {
1467
628
  span.setAttribute(SEMATTRS_GCP_BIGQUERY_JOB_LOCATION, location);
1468
629
  }
@@ -1525,7 +686,7 @@ function instrumentJobGetQueryResults(Job) {
1525
686
  const jobId = this.id || this.metadata?.jobReference?.jobId;
1526
687
  const projectId = this.parent?.projectId || this.projectId;
1527
688
  const location = this.location || options?.location;
1528
- const span = createSpan2(
689
+ const span = createSpan(
1529
690
  tracer,
1530
691
  "GET_QUERY_RESULTS",
1531
692
  void 0,
@@ -1581,7 +742,7 @@ function instrumentDatasetCreate(Dataset) {
1581
742
  const datasetId = this.id;
1582
743
  const projectId = extractProjectId(this.parent);
1583
744
  const location = extractLocation(this.parent, options);
1584
- const span = createSpan2(
745
+ const span = createSpan(
1585
746
  tracer,
1586
747
  "CREATE_DATASET",
1587
748
  datasetId,
@@ -1630,7 +791,7 @@ function instrumentDatasetDelete(Dataset) {
1630
791
  }
1631
792
  const datasetId = this.id;
1632
793
  const projectId = extractProjectId(this.parent);
1633
- const span = createSpan2(
794
+ const span = createSpan(
1634
795
  tracer,
1635
796
  "DELETE_DATASET",
1636
797
  datasetId,
@@ -1677,7 +838,7 @@ function instrumentBigQueryCreateDataset(BigQuery) {
1677
838
  const datasetId = id;
1678
839
  const projectId = extractProjectId(this);
1679
840
  const location = extractLocation(this, options);
1680
- const span = createSpan2(
841
+ const span = createSpan(
1681
842
  tracer,
1682
843
  "CREATE_DATASET",
1683
844
  datasetId,
@@ -1741,7 +902,7 @@ function instrumentTableCreate(Table) {
1741
902
  const tableRef = extractTableReference(this);
1742
903
  const projectId = extractProjectId(this.dataset?.parent || this.parent);
1743
904
  const target = tableRef.tableId ? tableRef.datasetId ? `${tableRef.datasetId}.${tableRef.tableId}` : tableRef.tableId : void 0;
1744
- const span = createSpan2(tracer, "CREATE_TABLE", target, projectId, config);
905
+ const span = createSpan(tracer, "CREATE_TABLE", target, projectId, config);
1745
906
  if (tableRef.datasetId) {
1746
907
  span.setAttribute(SEMATTRS_DB_NAMESPACE, tableRef.datasetId);
1747
908
  }
@@ -1785,7 +946,7 @@ function instrumentTableDelete(Table) {
1785
946
  const tableRef = extractTableReference(this);
1786
947
  const projectId = extractProjectId(this.dataset?.parent || this.parent);
1787
948
  const target = tableRef.tableId ? tableRef.datasetId ? `${tableRef.datasetId}.${tableRef.tableId}` : tableRef.tableId : void 0;
1788
- const span = createSpan2(tracer, "DELETE_TABLE", target, projectId, config);
949
+ const span = createSpan(tracer, "DELETE_TABLE", target, projectId, config);
1789
950
  if (tableRef.datasetId) {
1790
951
  span.setAttribute(SEMATTRS_DB_NAMESPACE, tableRef.datasetId);
1791
952
  }
@@ -1820,13 +981,13 @@ function instrumentBigQuery(bigquery, config) {
1820
981
  return bigquery;
1821
982
  }
1822
983
  const bq = bigquery;
1823
- if (bq[INSTRUMENTED_FLAG3]) {
984
+ if (bq[INSTRUMENTED_FLAG]) {
1824
985
  return bigquery;
1825
986
  }
1826
987
  const finalConfig = {
1827
988
  projectId: config?.projectId || "",
1828
989
  location: config?.location || "",
1829
- tracerName: config?.tracerName || DEFAULT_TRACER_NAME3,
990
+ tracerName: config?.tracerName || DEFAULT_TRACER_NAME,
1830
991
  captureQueryText: config?.captureQueryText || "summary",
1831
992
  maxQueryTextLength: config?.maxQueryTextLength || 1e3,
1832
993
  includeQueryHash: config?.includeQueryHash ?? true,
@@ -1880,7 +1041,7 @@ function instrumentBigQuery(bigquery, config) {
1880
1041
  }
1881
1042
  BigQuery[PROTOTYPE_INSTRUMENTED_FLAG] = true;
1882
1043
  }
1883
- bq[INSTRUMENTED_FLAG3] = true;
1044
+ bq[INSTRUMENTED_FLAG] = true;
1884
1045
  return bigquery;
1885
1046
  }
1886
1047
  var BigQueryInstrumentation = class {
@@ -1961,7 +1122,7 @@ function injectTraceHeaders(base = {}, options = {}) {
1961
1122
  }
1962
1123
  return carrier;
1963
1124
  }
1964
- var DEFAULT_TRACER_NAME4 = "autotel-plugins/kafka";
1125
+ var DEFAULT_TRACER_NAME2 = "autotel-plugins/kafka";
1965
1126
  function isValidSpanContext(spanContext) {
1966
1127
  return !!(spanContext && spanContext.traceId && spanContext.spanId && autotel.otelTrace.isSpanContextValid(spanContext));
1967
1128
  }
@@ -1977,7 +1138,7 @@ async function withProcessingSpan(descriptor, fn) {
1977
1138
  offset,
1978
1139
  key
1979
1140
  } = descriptor;
1980
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME4);
1141
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME2);
1981
1142
  const normalizedHeaders = normalizeHeaders(headers);
1982
1143
  const extractedCtx = extractTraceContext(normalizedHeaders);
1983
1144
  const extractedSpanContext = autotel.otelTrace.getSpanContext(extractedCtx);
@@ -2081,10 +1242,10 @@ function setMessagingAttributes(span, attrs) {
2081
1242
  span.setAttribute(SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY, key);
2082
1243
  }
2083
1244
  }
2084
- var DEFAULT_TRACER_NAME5 = "autotel-plugins/kafka";
1245
+ var DEFAULT_TRACER_NAME3 = "autotel-plugins/kafka";
2085
1246
  async function withProducerSpan(descriptor, fn) {
2086
1247
  const { name, topic, messageKey, system = "kafka" } = descriptor;
2087
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME5);
1248
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME3);
2088
1249
  const span = tracer.startSpan(name, {
2089
1250
  kind: autotel.SpanKind.PRODUCER
2090
1251
  });
@@ -2195,10 +1356,10 @@ async function extractBatchLineageAsync(items, options = {}) {
2195
1356
  ...includeTraceIds && { trace_ids: traceIds }
2196
1357
  };
2197
1358
  }
2198
- var DEFAULT_TRACER_NAME6 = "autotel-plugins/kafka";
1359
+ var DEFAULT_TRACER_NAME4 = "autotel-plugins/kafka";
2199
1360
  function withBatchConsumer(config, handler) {
2200
1361
  const { name, consumerGroup, perMessageSpans = "none", onProgress } = config;
2201
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME6);
1362
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME4);
2202
1363
  return async (payload) => {
2203
1364
  const { batch } = payload;
2204
1365
  const startTime = Date.now();
@@ -2408,7 +1569,7 @@ function createWrappedPayload(original, perMessageSpans, tracer, parentContext,
2408
1569
  };
2409
1570
  }
2410
1571
  function createMessageErrorSpan(name, message, error, topic, partition) {
2411
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME6);
1572
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME4);
2412
1573
  const normalizedHeaders = normalizeHeaders(message.headers);
2413
1574
  const extractedCtx = extractTraceContext(normalizedHeaders);
2414
1575
  const span = tracer.startSpan(
@@ -2431,10 +1592,10 @@ function createMessageErrorSpan(name, message, error, topic, partition) {
2431
1592
  span.recordException(error);
2432
1593
  span.end();
2433
1594
  }
2434
- var DEFAULT_TRACER_NAME7 = "autotel-plugins/kafka";
1595
+ var DEFAULT_TRACER_NAME5 = "autotel-plugins/kafka";
2435
1596
  function createStreamProcessor(config) {
2436
1597
  const { name } = config;
2437
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME7);
1598
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME5);
2438
1599
  return {
2439
1600
  async run(message, callback) {
2440
1601
  const normalizedHeaders = normalizeHeaders(message.headers);
@@ -2704,7 +1865,7 @@ var ConsumerMetrics = class {
2704
1865
  }
2705
1866
  }
2706
1867
  };
2707
- var DEFAULT_TRACER_NAME8 = "autotel-plugins/kafka";
1868
+ var DEFAULT_TRACER_NAME6 = "autotel-plugins/kafka";
2708
1869
  var REBALANCE_EVENTS = [
2709
1870
  "consumer.group_join",
2710
1871
  "consumer.rebalancing",
@@ -2724,7 +1885,7 @@ function instrumentConsumerEvents(consumer, config = {}) {
2724
1885
  traceHeartbeats = false,
2725
1886
  lifecycleSpan
2726
1887
  } = config;
2727
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME8);
1888
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME6);
2728
1889
  const listeners = [];
2729
1890
  const addListener = (event, listener) => {
2730
1891
  consumer.on(event, listener);
@@ -2927,7 +2088,7 @@ function injectTraceHeaders2(base = {}, options = {}) {
2927
2088
  }
2928
2089
  return carrier;
2929
2090
  }
2930
- var DEFAULT_TRACER_NAME9 = "autotel-plugins/rabbitmq";
2091
+ var DEFAULT_TRACER_NAME7 = "autotel-plugins/rabbitmq";
2931
2092
  function isValidSpanContext3(spanContext) {
2932
2093
  return !!(spanContext && spanContext.traceId && spanContext.spanId && autotel.otelTrace.isSpanContextValid(spanContext));
2933
2094
  }
@@ -2952,7 +2113,7 @@ async function withConsumeSpan(descriptor, fn) {
2952
2113
  deferSpanEnd = false,
2953
2114
  ackTimeoutMs
2954
2115
  } = descriptor;
2955
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME9);
2116
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME7);
2956
2117
  const normalizedHeaders = normalizeHeaders2(headers);
2957
2118
  const extractedCtx = extractTraceContext2(normalizedHeaders);
2958
2119
  const extractedSpanContext = autotel.otelTrace.getSpanContext(extractedCtx);
@@ -3126,7 +2287,7 @@ function setMessagingAttributes2(span, attrs) {
3126
2287
  span.setAttribute(SEMATTRS_MESSAGING_CONSUMER_ID, consumerTag);
3127
2288
  }
3128
2289
  }
3129
- var DEFAULT_TRACER_NAME10 = "autotel-plugins/rabbitmq";
2290
+ var DEFAULT_TRACER_NAME8 = "autotel-plugins/rabbitmq";
3130
2291
  async function withPublishSpan(descriptor, fn) {
3131
2292
  const {
3132
2293
  name,
@@ -3136,7 +2297,7 @@ async function withPublishSpan(descriptor, fn) {
3136
2297
  correlationId,
3137
2298
  system = "rabbitmq"
3138
2299
  } = descriptor;
3139
- const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME10);
2300
+ const tracer = autotel.otelTrace.getTracer(DEFAULT_TRACER_NAME8);
3140
2301
  const span = tracer.startSpan(name, {
3141
2302
  kind: autotel.SpanKind.PRODUCER
3142
2303
  });
@@ -3226,7 +2387,6 @@ function recordAckResult(span, result, options) {
3226
2387
  exports.BigQueryInstrumentation = BigQueryInstrumentation;
3227
2388
  exports.CORRELATION_ID_HEADER = CORRELATION_ID_HEADER;
3228
2389
  exports.ConsumerMetrics = ConsumerMetrics;
3229
- exports.MongooseInstrumentation = MongooseInstrumentation;
3230
2390
  exports.SEMATTRS_DB_COLLECTION_NAME = SEMATTRS_DB_COLLECTION_NAME;
3231
2391
  exports.SEMATTRS_DB_NAME = SEMATTRS_DB_NAME;
3232
2392
  exports.SEMATTRS_DB_NAMESPACE = SEMATTRS_DB_NAMESPACE;
@@ -3287,9 +2447,6 @@ exports.injectRabbitMQTraceHeaders = injectTraceHeaders2;
3287
2447
  exports.injectTraceHeaders = injectTraceHeaders;
3288
2448
  exports.instrumentBigQuery = instrumentBigQuery;
3289
2449
  exports.instrumentConsumerEvents = instrumentConsumerEvents;
3290
- exports.instrumentDrizzle = instrumentDrizzle;
3291
- exports.instrumentDrizzleClient = instrumentDrizzleClient;
3292
- exports.instrumentMongoose = instrumentMongoose;
3293
2450
  exports.normalizeHeaders = normalizeHeaders;
3294
2451
  exports.normalizeRabbitMQHeaders = normalizeHeaders2;
3295
2452
  exports.recordAckResult = recordAckResult;