@use-tusk/drift-node-sdk 0.1.0 → 0.1.2

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.d.cts CHANGED
@@ -77,7 +77,7 @@ interface TuskDriftPublicAPI {
77
77
  *
78
78
  * @example
79
79
  * ```typescript
80
- * import { TuskDrift } from 'tusk-drift-sdk';
80
+ * import { TuskDrift } from "@use-tusk/drift-node-sdk"
81
81
  *
82
82
  * TuskDrift.initialize({
83
83
  * apiKey: 'your-api-key',
package/dist/index.d.ts CHANGED
@@ -80,7 +80,7 @@ interface TuskDriftPublicAPI {
80
80
  *
81
81
  * @example
82
82
  * ```typescript
83
- * import { TuskDrift } from 'tusk-drift-sdk';
83
+ * import { TuskDrift } from "@use-tusk/drift-node-sdk"
84
84
  *
85
85
  * TuskDrift.initialize({
86
86
  * apiKey: 'your-api-key',
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import * as path$1 from "path";
6
6
  import path, { normalize } from "path";
7
7
  import { satisfies } from "semver";
8
8
  import { Hook } from "require-in-the-middle";
9
+ import { Hook as Hook$1 } from "import-in-the-middle";
9
10
  import { Struct, Value } from "@use-tusk/drift-schemas/google/protobuf/struct";
10
11
  import { SpanKind, SpanStatusCode, context, createContextKey, trace } from "@opentelemetry/api";
11
12
  import { PackageType, Span, SpanKind as SpanKind$1, StatusCode } from "@use-tusk/drift-schemas/core/span";
@@ -72,7 +73,7 @@ var TdInstrumentationAbstract = class {
72
73
 
73
74
  //#endregion
74
75
  //#region package.json
75
- var version = "0.1.0";
76
+ var version = "0.1.2";
76
77
 
77
78
  //#endregion
78
79
  //#region src/version.ts
@@ -397,10 +398,11 @@ function sendUnpatchedDependencyAlert({ method, spanId, traceId, stackTrace }) {
397
398
 
398
399
  //#endregion
399
400
  //#region src/instrumentation/core/baseClasses/TdInstrumentationBase.ts
400
- var TdInstrumentationBase = class extends TdInstrumentationAbstract {
401
+ var TdInstrumentationBase = class TdInstrumentationBase extends TdInstrumentationAbstract {
401
402
  constructor(instrumentationName, config = {}) {
402
403
  super(instrumentationName, config);
403
404
  this._modules = [];
405
+ this._hooks = [];
404
406
  this._enabled = false;
405
407
  let modules = this.init();
406
408
  if (modules && !Array.isArray(modules)) modules = [modules];
@@ -441,12 +443,35 @@ var TdInstrumentationBase = class extends TdInstrumentationAbstract {
441
443
  const onRequire = (exports$1, name, baseDir) => {
442
444
  return this._onRequire(module$1, exports$1, name, baseDir);
443
445
  };
444
- new Hook([module$1.name], { internals: true }, onRequire);
446
+ const hookFn = (exports$1, name, baseDir) => {
447
+ if (!baseDir && path.isAbsolute(name)) {
448
+ const parsedPath = path.parse(name);
449
+ name = parsedPath.name;
450
+ baseDir = parsedPath.dir;
451
+ }
452
+ return this._onRequire(module$1, exports$1, name, baseDir || void 0);
453
+ };
454
+ const cjsHook = new Hook([module$1.name], { internals: true }, onRequire);
455
+ this._hooks.push(cjsHook);
456
+ const esmHook = new Hook$1([module$1.name], { internals: false }, hookFn);
457
+ this._hooks.push(esmHook);
445
458
  }
446
459
  }
447
460
  isEnabled() {
448
461
  return this._enabled;
449
462
  }
463
+ /**
464
+ * Mark a module as patched.
465
+ */
466
+ markModuleAsPatched(moduleExports) {
467
+ TdInstrumentationBase._patchedModules.add(moduleExports);
468
+ }
469
+ /**
470
+ * Check if a module has already been patched.
471
+ */
472
+ isModulePatched(moduleExports) {
473
+ return TdInstrumentationBase._patchedModules.has(moduleExports);
474
+ }
450
475
  _onRequire(module$1, exports$1, name, baseDir) {
451
476
  if (!baseDir) {
452
477
  if (typeof module$1.patch === "function") {
@@ -509,6 +534,7 @@ var TdInstrumentationBase = class extends TdInstrumentationAbstract {
509
534
  }, exports$1);
510
535
  }
511
536
  };
537
+ TdInstrumentationBase._patchedModules = /* @__PURE__ */ new WeakSet();
512
538
 
513
539
  //#endregion
514
540
  //#region src/instrumentation/core/baseClasses/TdInstrumentationNodeModule.ts
@@ -1913,6 +1939,7 @@ function wrap(target, propertyName, wrapper) {
1913
1939
  wrapped._original = original;
1914
1940
  wrapped._propertyName = propertyName;
1915
1941
  target[propertyName] = wrapped;
1942
+ return wrapped;
1916
1943
  }
1917
1944
 
1918
1945
  //#endregion
@@ -2195,18 +2222,25 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2195
2222
  _patchHttpModule(httpModule, protocol) {
2196
2223
  const protocolUpper = protocol.toUpperCase();
2197
2224
  logger.debug(`[HttpInstrumentation] Patching ${protocolUpper} module in ${this.mode} mode`);
2198
- if (httpModule._tdPatched) {
2225
+ if (this.isModulePatched(httpModule)) {
2199
2226
  logger.debug(`[HttpInstrumentation] ${protocolUpper} module already patched, skipping`);
2200
2227
  return httpModule;
2201
2228
  }
2202
- this._wrap(httpModule, "request", this._getRequestPatchFn(protocol));
2203
- this._wrap(httpModule, "get", this._getGetPatchFn(protocol));
2229
+ if (httpModule[Symbol.toStringTag] === "Module") {
2230
+ if (httpModule.default) {
2231
+ this._wrap(httpModule.default, "request", this._getRequestPatchFn(protocol));
2232
+ this._wrap(httpModule.default, "get", this._getGetPatchFn(protocol));
2233
+ }
2234
+ } else {
2235
+ this._wrap(httpModule, "request", this._getRequestPatchFn(protocol));
2236
+ this._wrap(httpModule, "get", this._getGetPatchFn(protocol));
2237
+ }
2204
2238
  const HttpServer = httpModule.Server;
2205
2239
  if (HttpServer && HttpServer.prototype) {
2206
2240
  this._wrap(HttpServer.prototype, "emit", this._getServerEmitPatchFn(protocol));
2207
2241
  logger.debug(`[HttpInstrumentation] Wrapped Server.prototype.emit for ${protocolUpper}`);
2208
2242
  }
2209
- httpModule._tdPatched = true;
2243
+ this.markModuleAsPatched(httpModule);
2210
2244
  logger.debug(`[HttpInstrumentation] ${protocolUpper} module patching complete`);
2211
2245
  return httpModule;
2212
2246
  }
@@ -2551,7 +2585,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2551
2585
  }
2552
2586
  });
2553
2587
  }
2554
- _captureClientRequestBody(req, spanInfo, inputValue, schemaMerges) {
2588
+ _captureClientRequestBody(req, spanInfo, inputValue, schemaMerges, onBodyCaptured) {
2555
2589
  const requestBodyChunks = [];
2556
2590
  let requestBodyCaptured = false;
2557
2591
  const originalWrite = req.write?.bind(req);
@@ -2573,6 +2607,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2573
2607
  body: encodedBody,
2574
2608
  bodySize: bodyBuffer.length
2575
2609
  };
2610
+ if (onBodyCaptured) onBodyCaptured(updatedInputValue);
2576
2611
  SpanUtils.addSpanAttributes(spanInfo.span, {
2577
2612
  inputValue: updatedInputValue,
2578
2613
  inputSchemaMerges: {
@@ -2594,7 +2629,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2594
2629
  }
2595
2630
  _handleOutboundRequestInSpan(originalRequest, args, spanInfo, inputValue, schemaMerges) {
2596
2631
  const req = originalRequest.apply(this, args);
2597
- this._captureClientRequestBody(req, spanInfo, inputValue, schemaMerges);
2632
+ let completeInputValue = inputValue;
2633
+ this._captureClientRequestBody(req, spanInfo, inputValue, schemaMerges, (updatedInputValue) => {
2634
+ completeInputValue = updatedInputValue;
2635
+ });
2598
2636
  req.on("response", (res) => {
2599
2637
  logger.debug(`[HttpInstrumentation] HTTP response received: ${res.statusCode} (${SpanUtils.getTraceInfo()})`);
2600
2638
  const outputValue = {
@@ -2634,7 +2672,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2634
2672
  },
2635
2673
  headers: { matchImportance: 0 }
2636
2674
  },
2637
- inputValue
2675
+ inputValue: completeInputValue
2638
2676
  });
2639
2677
  } catch (error) {
2640
2678
  logger.error(`[HttpInstrumentation] Error processing response body:`, error);
@@ -2652,7 +2690,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2652
2690
  },
2653
2691
  headers: { matchImportance: 0 }
2654
2692
  },
2655
- inputValue
2693
+ inputValue: completeInputValue
2656
2694
  });
2657
2695
  } catch (error) {
2658
2696
  logger.error(`[HttpInstrumentation] Error adding output attributes to span:`, error);
@@ -2895,7 +2933,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
2895
2933
  return fallback;
2896
2934
  }
2897
2935
  _wrap(target, propertyName, wrapper) {
2898
- wrap(target, propertyName, wrapper);
2936
+ return wrap(target, propertyName, wrapper);
2899
2937
  }
2900
2938
  };
2901
2939
 
@@ -3290,7 +3328,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
3290
3328
  }
3291
3329
  _patchPgModule(pgModule) {
3292
3330
  logger.debug(`[PgInstrumentation] Patching PG module in ${this.mode} mode`);
3293
- if (pgModule._tdPatched) {
3331
+ if (this.isModulePatched(pgModule)) {
3294
3332
  logger.debug(`[PgInstrumentation] PG module already patched, skipping`);
3295
3333
  return pgModule;
3296
3334
  }
@@ -3302,7 +3340,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
3302
3340
  this._wrap(pgModule.Client.prototype, "connect", this._getConnectPatchFn("client"));
3303
3341
  logger.debug(`[PgInstrumentation] Wrapped Client.prototype.connect`);
3304
3342
  }
3305
- pgModule._tdPatched = true;
3343
+ this.markModuleAsPatched(pgModule);
3306
3344
  logger.debug(`[PgInstrumentation] PG module patching complete`);
3307
3345
  return pgModule;
3308
3346
  }
@@ -3624,7 +3662,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
3624
3662
  SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
3625
3663
  }
3626
3664
  _patchPgPoolModule(pgPoolModule) {
3627
- if (pgPoolModule._tdPatched) {
3665
+ if (this.isModulePatched(pgPoolModule)) {
3628
3666
  logger.debug(`[PgInstrumentation] PG Pool module already patched, skipping`);
3629
3667
  return pgPoolModule;
3630
3668
  }
@@ -3636,7 +3674,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
3636
3674
  this._wrap(pgPoolModule.prototype, "connect", this._getPoolConnectPatchFn());
3637
3675
  logger.debug(`[PgInstrumentation] Wrapped Pool.prototype.connect`);
3638
3676
  }
3639
- pgPoolModule._tdPatched = true;
3677
+ this.markModuleAsPatched(pgPoolModule);
3640
3678
  logger.debug(`[PgInstrumentation] PG Pool module patching complete`);
3641
3679
  return pgPoolModule;
3642
3680
  }
@@ -3747,6 +3785,17 @@ var PgInstrumentation = class extends TdInstrumentationBase {
3747
3785
  }
3748
3786
  };
3749
3787
 
3788
+ //#endregion
3789
+ //#region src/instrumentation/libraries/postgres/types.ts
3790
+ function isPostgresOutputValueType(value) {
3791
+ return value !== null && value !== void 0 && typeof value === "object" && "_tdOriginalFormat" in value && Object.values(PostgresReturnType).includes(value._tdOriginalFormat);
3792
+ }
3793
+ let PostgresReturnType = /* @__PURE__ */ function(PostgresReturnType$1) {
3794
+ PostgresReturnType$1["ARRAY"] = "array";
3795
+ PostgresReturnType$1["OBJECT"] = "object";
3796
+ return PostgresReturnType$1;
3797
+ }({});
3798
+
3750
3799
  //#endregion
3751
3800
  //#region src/instrumentation/libraries/postgres/Instrumentation.ts
3752
3801
  var PostgresInstrumentation = class extends TdInstrumentationBase {
@@ -3765,25 +3814,41 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
3765
3814
  }
3766
3815
  _patchPostgresModule(postgresModule) {
3767
3816
  logger.debug(`[PostgresInstrumentation] Patching Postgres module in ${this.mode} mode`);
3768
- if (postgresModule._tdPatched) {
3817
+ if (this.isModulePatched(postgresModule)) {
3769
3818
  logger.debug(`[PostgresInstrumentation] Postgres module already patched, skipping`);
3770
3819
  return postgresModule;
3771
3820
  }
3772
- if (typeof postgresModule === "function") {
3821
+ const self$1 = this;
3822
+ if (postgresModule[Symbol.toStringTag] === "Module") {
3823
+ logger.debug(`[PostgresInstrumentation] Wrapping ESM default export`);
3824
+ this._wrap(postgresModule, "default", (originalFunction) => {
3825
+ return function(...args) {
3826
+ return self$1._handlePostgresConnection(originalFunction, args);
3827
+ };
3828
+ });
3829
+ } else {
3830
+ logger.debug(`[PostgresInstrumentation] Module is a function (CJS style)`);
3773
3831
  const originalFunction = postgresModule;
3774
- const self$1 = this;
3775
3832
  const wrappedFunction = function(...args) {
3833
+ logger.debug(`[PostgresInstrumentation] Wrapped postgres() (CJS) called with args:`, args);
3776
3834
  return self$1._handlePostgresConnection(originalFunction, args);
3777
3835
  };
3778
3836
  Object.setPrototypeOf(wrappedFunction, Object.getPrototypeOf(originalFunction));
3779
3837
  Object.defineProperty(wrappedFunction, "name", { value: originalFunction.name });
3838
+ for (const key in originalFunction) if (originalFunction.hasOwnProperty(key)) wrappedFunction[key] = originalFunction[key];
3839
+ Object.getOwnPropertyNames(originalFunction).forEach((key) => {
3840
+ if (key !== "prototype" && key !== "length" && key !== "name") {
3841
+ const descriptor = Object.getOwnPropertyDescriptor(originalFunction, key);
3842
+ if (descriptor) Object.defineProperty(wrappedFunction, key, descriptor);
3843
+ }
3844
+ });
3780
3845
  postgresModule = wrappedFunction;
3781
3846
  }
3782
3847
  if (postgresModule.sql && typeof postgresModule.sql === "function") {
3783
3848
  this._wrap(postgresModule, "sql", this._getSqlPatchFn());
3784
3849
  logger.debug(`[PostgresInstrumentation] Wrapped sql function`);
3785
3850
  }
3786
- postgresModule._tdPatched = true;
3851
+ this.markModuleAsPatched(postgresModule);
3787
3852
  logger.debug(`[PostgresInstrumentation] Postgres module patching complete`);
3788
3853
  return postgresModule;
3789
3854
  }
@@ -4245,8 +4310,8 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
4245
4310
  const isResultObject = processedResult && typeof processedResult === "object" && "rows" in processedResult;
4246
4311
  const rows = isResultObject ? processedResult.rows || [] : processedResult || [];
4247
4312
  return Object.assign(rows, {
4248
- command: isResultObject ? processedResult.command : "SELECT",
4249
- count: isResultObject ? processedResult.count : rows.length
4313
+ command: isResultObject ? processedResult.command : void 0,
4314
+ count: isResultObject ? processedResult.count : void 0
4250
4315
  });
4251
4316
  }
4252
4317
  async handleReplayUnsafeQuery({ inputValue, spanInfo, submodule, name }) {
@@ -4297,8 +4362,8 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
4297
4362
  return Object.values(row);
4298
4363
  });
4299
4364
  return Object.assign(valueArrays, {
4300
- command: isResultObject ? result.command : "SELECT",
4301
- count: isResultObject ? result.count : valueArrays.length
4365
+ command: isResultObject ? result.command : void 0,
4366
+ count: isResultObject ? result.count : void 0
4302
4367
  });
4303
4368
  });
4304
4369
  } });
@@ -4308,61 +4373,40 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
4308
4373
  * based on common PostgreSQL data patterns.
4309
4374
  */
4310
4375
  convertPostgresTypes(result) {
4311
- if (!result) return result;
4312
- if (result && typeof result === "object" && "rows" in result) {
4313
- const convertedResult = { ...result };
4314
- if (Array.isArray(result.rows)) convertedResult.rows = result.rows.map((row) => {
4315
- if (typeof row !== "object" || row === null) return row;
4316
- const convertedRow = { ...row };
4317
- Object.keys(row).forEach((fieldName) => {
4318
- const value = row[fieldName];
4319
- if (value === null || value === void 0) return;
4320
- if (typeof value === "string") {
4321
- if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(value)) {
4322
- const dateObj = new Date(value);
4323
- if (!isNaN(dateObj.getTime())) convertedRow[fieldName] = dateObj;
4324
- }
4325
- }
4326
- });
4327
- return convertedRow;
4328
- });
4329
- return convertedResult;
4376
+ if (!isPostgresOutputValueType(result)) {
4377
+ logger.error(`[PostgresInstrumentation] output value is not of type PostgresOutputValueType: ${JSON.stringify(result)}`);
4378
+ return;
4379
+ }
4380
+ if (!result) return;
4381
+ const { _tdOriginalFormat: originalFormat,...convertedResult } = result;
4382
+ if (originalFormat === PostgresReturnType.OBJECT) return convertedResult;
4383
+ else if (originalFormat === PostgresReturnType.ARRAY) return convertedResult.rows || [];
4384
+ else {
4385
+ logger.error(`[PostgresInstrumentation] Invalid result format: ${JSON.stringify(result)}`);
4386
+ return;
4330
4387
  }
4331
- if (Array.isArray(result)) return result.map((row) => {
4332
- if (typeof row !== "object" || row === null) return row;
4333
- const convertedRow = { ...row };
4334
- Object.keys(row).forEach((fieldName) => {
4335
- const value = row[fieldName];
4336
- if (value === null || value === void 0) return;
4337
- if (typeof value === "string") {
4338
- if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(value)) {
4339
- const dateObj = new Date(value);
4340
- if (!isNaN(dateObj.getTime())) convertedRow[fieldName] = dateObj;
4341
- }
4342
- }
4343
- });
4344
- return convertedRow;
4345
- });
4346
- return result;
4347
4388
  }
4348
4389
  _addOutputAttributesToSpan(spanInfo, result) {
4349
4390
  if (!result) return;
4350
4391
  let outputValue;
4351
- if (Array.isArray(result)) outputValue = {
4352
- count: result.length,
4353
- rows: result,
4354
- command: "SELECT"
4355
- };
4356
- else if (result && typeof result === "object" && "count" in result) outputValue = {
4357
- count: result.count || 0,
4358
- rows: result.rows || result,
4359
- command: result.command || "UNKNOWN"
4360
- };
4361
- else outputValue = {
4362
- count: 1,
4363
- rows: [result],
4364
- command: "UNKNOWN"
4365
- };
4392
+ if (Array.isArray(result)) {
4393
+ logger.debug(`[PostgresInstrumentation] Adding output attributes to span for array result: ${JSON.stringify(result)}`);
4394
+ outputValue = {
4395
+ _tdOriginalFormat: PostgresReturnType.ARRAY,
4396
+ rows: result
4397
+ };
4398
+ } else if (typeof result === "object") {
4399
+ logger.debug(`[PostgresInstrumentation] Adding output attributes to span for object result: ${JSON.stringify(result)}`);
4400
+ outputValue = {
4401
+ _tdOriginalFormat: PostgresReturnType.OBJECT,
4402
+ count: result.count,
4403
+ rows: result.rows,
4404
+ command: result.command
4405
+ };
4406
+ } else {
4407
+ logger.error(`[PostgresInstrumentation] Invalid result format: ${JSON.stringify(result)}`);
4408
+ return;
4409
+ }
4366
4410
  SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
4367
4411
  }
4368
4412
  _wrap(target, propertyName, wrapper) {
@@ -4396,7 +4440,7 @@ var TcpInstrumentation = class extends TdInstrumentationBase {
4396
4440
  }
4397
4441
  _patchNetModule(netModule) {
4398
4442
  logger.debug(`[TcpInstrumentation] Patching NET module in ${this.mode} mode`);
4399
- if (netModule._tdPatched) {
4443
+ if (this.isModulePatched(netModule)) {
4400
4444
  logger.debug(`[TcpInstrumentation] NET module already patched, skipping`);
4401
4445
  return netModule;
4402
4446
  }
@@ -4413,7 +4457,7 @@ var TcpInstrumentation = class extends TdInstrumentationBase {
4413
4457
  netModule.Socket.prototype.write = function(...args) {
4414
4458
  return self$1._handleTcpCall("write", originalWrite, args, this);
4415
4459
  };
4416
- netModule._tdPatched = true;
4460
+ this.markModuleAsPatched(netModule);
4417
4461
  return netModule;
4418
4462
  }
4419
4463
  _logUnpatchedDependency(methodName, currentSpanInfo, socketContext) {
@@ -4476,7 +4520,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
4476
4520
  })];
4477
4521
  }
4478
4522
  _patchJsonwebtokenModule(jwtModule) {
4479
- if (jwtModule._tdPatched) {
4523
+ if (this.isModulePatched(jwtModule)) {
4480
4524
  logger.debug(`[JsonwebtokenInstrumentation] jsonwebtoken module already patched, skipping`);
4481
4525
  return jwtModule;
4482
4526
  }
@@ -4491,7 +4535,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
4491
4535
  this._wrap(jwtModule, "sign", this._getSignPatchFn());
4492
4536
  logger.debug(`[JsonwebtokenInstrumentation] Wrapped jwt.sign`);
4493
4537
  }
4494
- jwtModule._tdPatched = true;
4538
+ this.markModuleAsPatched(jwtModule);
4495
4539
  logger.debug(`[JsonwebtokenInstrumentation] jsonwebtoken module patching complete`);
4496
4540
  return jwtModule;
4497
4541
  }
@@ -4889,7 +4933,7 @@ var JwksRsaInstrumentation = class extends TdInstrumentationBase {
4889
4933
  }
4890
4934
  _patchJwksRsaModule(jwksModule) {
4891
4935
  logger.debug(`[JwksRsaInstrumentation] Patching jwks-rsa module, current mode: ${this.tuskDrift.getMode()}`);
4892
- if (jwksModule._tdPatched) {
4936
+ if (this.isModulePatched(jwksModule)) {
4893
4937
  logger.debug(`[JwksRsaInstrumentation] jwks-rsa module already patched, skipping`);
4894
4938
  return jwksModule;
4895
4939
  }
@@ -4909,7 +4953,7 @@ var JwksRsaInstrumentation = class extends TdInstrumentationBase {
4909
4953
  };
4910
4954
  logger.debug(`[JwksRsaInstrumentation] Patched expressJwtSecret method`);
4911
4955
  }
4912
- jwksModule._tdPatched = true;
4956
+ this.markModuleAsPatched(jwksModule);
4913
4957
  logger.debug(`[JwksRsaInstrumentation] jwks-rsa module patching complete`);
4914
4958
  return jwksModule;
4915
4959
  }