@use-tusk/drift-node-sdk 0.1.19 → 0.1.21
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 +463 -444
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +463 -444
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -162,7 +162,8 @@ function warn(suppress, message) {
|
|
|
162
162
|
*
|
|
163
163
|
* This function automatically configures Next.js to work with Tusk Drift by:
|
|
164
164
|
* - Enabling the Next.js instrumentation hook (for Next.js < 15.0.0-rc.1)
|
|
165
|
-
* - Configuring
|
|
165
|
+
* - Configuring server external packages to prevent bundling of core instrumentation packages
|
|
166
|
+
* - Supporting both webpack and Turbopack bundlers
|
|
166
167
|
* - Preserving your existing Next.js configuration and webpack customizations
|
|
167
168
|
*
|
|
168
169
|
* @param nextConfig - Your existing Next.js configuration object (optional)
|
|
@@ -197,9 +198,12 @@ function warn(suppress, message) {
|
|
|
197
198
|
* ```
|
|
198
199
|
*
|
|
199
200
|
* @remarks
|
|
200
|
-
* The following
|
|
201
|
+
* The following packages are added as server externals for both webpack and Turbopack:
|
|
201
202
|
* - `require-in-the-middle` - Required for CommonJS module interception
|
|
202
203
|
* - `jsonpath` - Required for schema manipulation
|
|
204
|
+
* - Additional packages when TUSK_DRIFT_MODE is RECORD or REPLAY (e.g., database clients, etc.)
|
|
205
|
+
*
|
|
206
|
+
* Works with both webpack (default) and Turbopack (`next dev --turbo`).
|
|
203
207
|
*/
|
|
204
208
|
function withTuskDrift(nextConfig = {}, options = {}) {
|
|
205
209
|
const config = nextConfig;
|
|
@@ -209,33 +213,34 @@ function withTuskDrift(nextConfig = {}, options = {}) {
|
|
|
209
213
|
if (nextjsVersion) debugLog(debug, `Detected Next.js version: ${nextjsVersion}`);
|
|
210
214
|
else warn(suppressAllWarnings || false, "Could not detect Next.js version. Some features may not work correctly. If you encounter issues, please ensure Next.js is properly installed.");
|
|
211
215
|
const needsInstrumentationHook = !options.disableInstrumentationHook && shouldSetInstrumentationHook(nextjsVersion);
|
|
216
|
+
const mode = process.env.TUSK_DRIFT_MODE?.toUpperCase();
|
|
217
|
+
const coreExternals = [
|
|
218
|
+
"require-in-the-middle",
|
|
219
|
+
"jsonpath",
|
|
220
|
+
...mode === "RECORD" || mode === "REPLAY" ? [
|
|
221
|
+
"@upstash/redis",
|
|
222
|
+
"ioredis",
|
|
223
|
+
"pg",
|
|
224
|
+
"postgres",
|
|
225
|
+
"mysql2",
|
|
226
|
+
"@prisma/client",
|
|
227
|
+
"@google-cloud/firestore",
|
|
228
|
+
"@grpc/grpc-js",
|
|
229
|
+
"graphql",
|
|
230
|
+
"jsonwebtoken",
|
|
231
|
+
"jwks-rsa"
|
|
232
|
+
] : []
|
|
233
|
+
];
|
|
212
234
|
const wrappedConfig = {
|
|
213
235
|
...config,
|
|
214
236
|
...needsInstrumentationHook ? { experimental: {
|
|
215
237
|
...config.experimental,
|
|
216
238
|
instrumentationHook: true
|
|
217
239
|
} } : { experimental: config.experimental },
|
|
240
|
+
serverExternalPackages: [...config.serverExternalPackages || [], ...coreExternals],
|
|
218
241
|
webpack: (webpackConfig, webpackOptions) => {
|
|
219
242
|
if (webpackOptions.isServer) {
|
|
220
243
|
const originalExternals = webpackConfig.externals;
|
|
221
|
-
const mode = process.env.TUSK_DRIFT_MODE?.toUpperCase();
|
|
222
|
-
const coreExternals = [
|
|
223
|
-
"require-in-the-middle",
|
|
224
|
-
"jsonpath",
|
|
225
|
-
...mode === "RECORD" || mode === "REPLAY" ? [
|
|
226
|
-
"@upstash/redis",
|
|
227
|
-
"ioredis",
|
|
228
|
-
"pg",
|
|
229
|
-
"postgres",
|
|
230
|
-
"mysql2",
|
|
231
|
-
"@prisma/client",
|
|
232
|
-
"@google-cloud/firestore",
|
|
233
|
-
"@grpc/grpc-js",
|
|
234
|
-
"graphql",
|
|
235
|
-
"jsonwebtoken",
|
|
236
|
-
"jwks-rsa"
|
|
237
|
-
] : []
|
|
238
|
-
];
|
|
239
244
|
const externalsMapping = {};
|
|
240
245
|
for (const pkg of coreExternals) {
|
|
241
246
|
externalsMapping[pkg] = `commonjs ${pkg}`;
|
|
@@ -4989,31 +4994,31 @@ var require_SamplingResult = /* @__PURE__ */ __commonJS({ "node_modules/@opentel
|
|
|
4989
4994
|
var require_span_kind = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/api/build/src/trace/span_kind.js": ((exports) => {
|
|
4990
4995
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4991
4996
|
exports.SpanKind = void 0;
|
|
4992
|
-
(function(SpanKind$
|
|
4997
|
+
(function(SpanKind$27) {
|
|
4993
4998
|
/** Default value. Indicates that the span is used internally. */
|
|
4994
|
-
SpanKind$
|
|
4999
|
+
SpanKind$27[SpanKind$27["INTERNAL"] = 0] = "INTERNAL";
|
|
4995
5000
|
/**
|
|
4996
5001
|
* Indicates that the span covers server-side handling of an RPC or other
|
|
4997
5002
|
* remote request.
|
|
4998
5003
|
*/
|
|
4999
|
-
SpanKind$
|
|
5004
|
+
SpanKind$27[SpanKind$27["SERVER"] = 1] = "SERVER";
|
|
5000
5005
|
/**
|
|
5001
5006
|
* Indicates that the span covers the client-side wrapper around an RPC or
|
|
5002
5007
|
* other remote request.
|
|
5003
5008
|
*/
|
|
5004
|
-
SpanKind$
|
|
5009
|
+
SpanKind$27[SpanKind$27["CLIENT"] = 2] = "CLIENT";
|
|
5005
5010
|
/**
|
|
5006
5011
|
* Indicates that the span describes producer sending a message to a
|
|
5007
5012
|
* broker. Unlike client and server, there is no direct critical path latency
|
|
5008
5013
|
* relationship between producer and consumer spans.
|
|
5009
5014
|
*/
|
|
5010
|
-
SpanKind$
|
|
5015
|
+
SpanKind$27[SpanKind$27["PRODUCER"] = 3] = "PRODUCER";
|
|
5011
5016
|
/**
|
|
5012
5017
|
* Indicates that the span describes consumer receiving a message from a
|
|
5013
5018
|
* broker. Unlike client and server, there is no direct critical path latency
|
|
5014
5019
|
* relationship between producer and consumer spans.
|
|
5015
5020
|
*/
|
|
5016
|
-
SpanKind$
|
|
5021
|
+
SpanKind$27[SpanKind$27["CONSUMER"] = 4] = "CONSUMER";
|
|
5017
5022
|
})(exports.SpanKind || (exports.SpanKind = {}));
|
|
5018
5023
|
}) });
|
|
5019
5024
|
|
|
@@ -5022,20 +5027,20 @@ var require_span_kind = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetr
|
|
|
5022
5027
|
var require_status = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/api/build/src/trace/status.js": ((exports) => {
|
|
5023
5028
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5024
5029
|
exports.SpanStatusCode = void 0;
|
|
5025
|
-
(function(SpanStatusCode$
|
|
5030
|
+
(function(SpanStatusCode$16) {
|
|
5026
5031
|
/**
|
|
5027
5032
|
* The default status.
|
|
5028
5033
|
*/
|
|
5029
|
-
SpanStatusCode$
|
|
5034
|
+
SpanStatusCode$16[SpanStatusCode$16["UNSET"] = 0] = "UNSET";
|
|
5030
5035
|
/**
|
|
5031
5036
|
* The operation has been validated by an Application developer or
|
|
5032
5037
|
* Operator to have completed successfully.
|
|
5033
5038
|
*/
|
|
5034
|
-
SpanStatusCode$
|
|
5039
|
+
SpanStatusCode$16[SpanStatusCode$16["OK"] = 1] = "OK";
|
|
5035
5040
|
/**
|
|
5036
5041
|
* The operation contains an error.
|
|
5037
5042
|
*/
|
|
5038
|
-
SpanStatusCode$
|
|
5043
|
+
SpanStatusCode$16[SpanStatusCode$16["ERROR"] = 2] = "ERROR";
|
|
5039
5044
|
})(exports.SpanStatusCode || (exports.SpanStatusCode = {}));
|
|
5040
5045
|
}) });
|
|
5041
5046
|
|
|
@@ -5684,7 +5689,7 @@ var require_src$7 = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/ap
|
|
|
5684
5689
|
|
|
5685
5690
|
//#endregion
|
|
5686
5691
|
//#region node_modules/@use-tusk/drift-schemas/dist/duration-B3fwb4jB.js
|
|
5687
|
-
var import_src$
|
|
5692
|
+
var import_src$37 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
5688
5693
|
var import_commonjs$9 = /* @__PURE__ */ __toESM(require_commonjs$2(), 1);
|
|
5689
5694
|
var Duration$Type = class extends import_commonjs$9.MessageType {
|
|
5690
5695
|
constructor() {
|
|
@@ -6295,7 +6300,7 @@ let PackageType = /* @__PURE__ */ function(PackageType$1) {
|
|
|
6295
6300
|
*
|
|
6296
6301
|
* @generated from protobuf enum tusk.drift.core.v1.SpanKind
|
|
6297
6302
|
*/
|
|
6298
|
-
let SpanKind$
|
|
6303
|
+
let SpanKind$2 = /* @__PURE__ */ function(SpanKind$1$1) {
|
|
6299
6304
|
/**
|
|
6300
6305
|
* @generated from protobuf enum value: SPAN_KIND_UNSPECIFIED = 0;
|
|
6301
6306
|
*/
|
|
@@ -6465,7 +6470,7 @@ var Span$Type = class extends import_commonjs$6.MessageType {
|
|
|
6465
6470
|
kind: "enum",
|
|
6466
6471
|
T: () => [
|
|
6467
6472
|
"tusk.drift.core.v1.SpanKind",
|
|
6468
|
-
SpanKind$
|
|
6473
|
+
SpanKind$2,
|
|
6469
6474
|
"SPAN_KIND_"
|
|
6470
6475
|
]
|
|
6471
6476
|
},
|
|
@@ -7008,12 +7013,12 @@ const Trace = new Trace$Type();
|
|
|
7008
7013
|
const toStruct = (obj) => obj ? objectToProtobufStruct(obj) : void 0;
|
|
7009
7014
|
const mapOtToPb = (k) => {
|
|
7010
7015
|
switch (k) {
|
|
7011
|
-
case import_src$
|
|
7012
|
-
case import_src$
|
|
7013
|
-
case import_src$
|
|
7014
|
-
case import_src$
|
|
7015
|
-
case import_src$
|
|
7016
|
-
default: return SpanKind$
|
|
7016
|
+
case import_src$37.SpanKind.INTERNAL: return SpanKind$2.INTERNAL;
|
|
7017
|
+
case import_src$37.SpanKind.SERVER: return SpanKind$2.SERVER;
|
|
7018
|
+
case import_src$37.SpanKind.CLIENT: return SpanKind$2.CLIENT;
|
|
7019
|
+
case import_src$37.SpanKind.PRODUCER: return SpanKind$2.PRODUCER;
|
|
7020
|
+
case import_src$37.SpanKind.CONSUMER: return SpanKind$2.CONSUMER;
|
|
7021
|
+
default: return SpanKind$2.UNSPECIFIED;
|
|
7017
7022
|
}
|
|
7018
7023
|
};
|
|
7019
7024
|
/**
|
|
@@ -7416,13 +7421,13 @@ var TdInstrumentationNodeModule = class {
|
|
|
7416
7421
|
|
|
7417
7422
|
//#endregion
|
|
7418
7423
|
//#region src/core/types.ts
|
|
7419
|
-
var import_src$
|
|
7424
|
+
var import_src$36 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
7420
7425
|
const TD_INSTRUMENTATION_LIBRARY_NAME = "tusk-drift-sdk";
|
|
7421
|
-
const REPLAY_TRACE_ID_CONTEXT_KEY = (0, import_src$
|
|
7422
|
-
const SPAN_KIND_CONTEXT_KEY = (0, import_src$
|
|
7423
|
-
const IS_PRE_APP_START_CONTEXT_KEY = (0, import_src$
|
|
7424
|
-
const STOP_RECORDING_CHILD_SPANS_CONTEXT_KEY = (0, import_src$
|
|
7425
|
-
const CALLING_LIBRARY_CONTEXT_KEY = (0, import_src$
|
|
7426
|
+
const REPLAY_TRACE_ID_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.replayTraceId");
|
|
7427
|
+
const SPAN_KIND_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.spanKind");
|
|
7428
|
+
const IS_PRE_APP_START_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.isPreAppStart");
|
|
7429
|
+
const STOP_RECORDING_CHILD_SPANS_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.stopRecordingChildSpans");
|
|
7430
|
+
const CALLING_LIBRARY_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.callingLibrary");
|
|
7426
7431
|
let TdSpanAttributes = /* @__PURE__ */ function(TdSpanAttributes$1) {
|
|
7427
7432
|
/**
|
|
7428
7433
|
* Presentational information:
|
|
@@ -7534,7 +7539,7 @@ TraceBlockingManager.instance = null;
|
|
|
7534
7539
|
|
|
7535
7540
|
//#endregion
|
|
7536
7541
|
//#region src/core/tracing/SpanUtils.ts
|
|
7537
|
-
var import_src$
|
|
7542
|
+
var import_src$35 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
7538
7543
|
var SpanUtils = class SpanUtils {
|
|
7539
7544
|
/**
|
|
7540
7545
|
* Creates a new span and returns span info including trace ID and span ID
|
|
@@ -7542,8 +7547,8 @@ var SpanUtils = class SpanUtils {
|
|
|
7542
7547
|
static createSpan(options) {
|
|
7543
7548
|
try {
|
|
7544
7549
|
const tracer = TuskDriftCore.getInstance().getTracer();
|
|
7545
|
-
const parentContext = options.parentContext || import_src$
|
|
7546
|
-
const activeSpan = import_src$
|
|
7550
|
+
const parentContext = options.parentContext || import_src$35.context.active();
|
|
7551
|
+
const activeSpan = import_src$35.trace.getSpan(parentContext);
|
|
7547
7552
|
if (activeSpan) {
|
|
7548
7553
|
const parentTraceId = activeSpan.spanContext().traceId;
|
|
7549
7554
|
if (TraceBlockingManager.getInstance().isTraceBlocked(parentTraceId)) {
|
|
@@ -7552,11 +7557,11 @@ var SpanUtils = class SpanUtils {
|
|
|
7552
7557
|
}
|
|
7553
7558
|
}
|
|
7554
7559
|
const span = tracer.startSpan(options.name, {
|
|
7555
|
-
kind: options.kind || import_src$
|
|
7560
|
+
kind: options.kind || import_src$35.SpanKind.CLIENT,
|
|
7556
7561
|
attributes: options.attributes || {}
|
|
7557
7562
|
}, parentContext);
|
|
7558
7563
|
const spanContext = span.spanContext();
|
|
7559
|
-
const newContext = import_src$
|
|
7564
|
+
const newContext = import_src$35.trace.setSpan(parentContext, span).setValue(SPAN_KIND_CONTEXT_KEY, options.kind).setValue(IS_PRE_APP_START_CONTEXT_KEY, options.isPreAppStart);
|
|
7560
7565
|
return {
|
|
7561
7566
|
traceId: spanContext.traceId,
|
|
7562
7567
|
spanId: spanContext.spanId,
|
|
@@ -7573,7 +7578,7 @@ var SpanUtils = class SpanUtils {
|
|
|
7573
7578
|
* Executes a function within a span context
|
|
7574
7579
|
*/
|
|
7575
7580
|
static withSpan(spanInfo, fn) {
|
|
7576
|
-
return import_src$
|
|
7581
|
+
return import_src$35.context.with(spanInfo.context, fn);
|
|
7577
7582
|
}
|
|
7578
7583
|
/**
|
|
7579
7584
|
* Execute a function within a properly configured span
|
|
@@ -7590,9 +7595,9 @@ var SpanUtils = class SpanUtils {
|
|
|
7590
7595
|
* @returns The result of the function execution
|
|
7591
7596
|
*/
|
|
7592
7597
|
static createAndExecuteSpan(mode, originalFunctionCall, options, fn) {
|
|
7593
|
-
const spanContext = import_src$
|
|
7598
|
+
const spanContext = import_src$35.trace.getActiveSpan()?.spanContext();
|
|
7594
7599
|
if (spanContext) {
|
|
7595
|
-
if (import_src$
|
|
7600
|
+
if (import_src$35.context.active().getValue(STOP_RECORDING_CHILD_SPANS_CONTEXT_KEY)) {
|
|
7596
7601
|
logger.debug(`[SpanUtils] Stopping recording of child spans for span ${spanContext.spanId}, packageName: ${options.packageName}, instrumentationName: ${options.instrumentationName}`);
|
|
7597
7602
|
return originalFunctionCall();
|
|
7598
7603
|
}
|
|
@@ -7631,15 +7636,15 @@ var SpanUtils = class SpanUtils {
|
|
|
7631
7636
|
*/
|
|
7632
7637
|
static getCurrentSpanInfo() {
|
|
7633
7638
|
try {
|
|
7634
|
-
const activeSpan = import_src$
|
|
7639
|
+
const activeSpan = import_src$35.trace.getActiveSpan();
|
|
7635
7640
|
if (!activeSpan) return null;
|
|
7636
7641
|
const spanContext = activeSpan.spanContext();
|
|
7637
7642
|
return {
|
|
7638
7643
|
traceId: spanContext.traceId,
|
|
7639
7644
|
spanId: spanContext.spanId,
|
|
7640
7645
|
span: activeSpan,
|
|
7641
|
-
context: import_src$
|
|
7642
|
-
isPreAppStart: import_src$
|
|
7646
|
+
context: import_src$35.context.active(),
|
|
7647
|
+
isPreAppStart: import_src$35.context.active().getValue(IS_PRE_APP_START_CONTEXT_KEY)
|
|
7643
7648
|
};
|
|
7644
7649
|
} catch (error) {
|
|
7645
7650
|
logger.error("SpanUtils error getting current span info:", error);
|
|
@@ -7703,7 +7708,7 @@ var SpanUtils = class SpanUtils {
|
|
|
7703
7708
|
}
|
|
7704
7709
|
static setCurrentReplayTraceId(replayTraceId) {
|
|
7705
7710
|
try {
|
|
7706
|
-
return import_src$
|
|
7711
|
+
return import_src$35.context.active().setValue(REPLAY_TRACE_ID_CONTEXT_KEY, replayTraceId);
|
|
7707
7712
|
} catch (error) {
|
|
7708
7713
|
logger.error("SpanUtils error setting current replay trace id:", error);
|
|
7709
7714
|
return null;
|
|
@@ -7714,7 +7719,7 @@ var SpanUtils = class SpanUtils {
|
|
|
7714
7719
|
*/
|
|
7715
7720
|
static getCurrentReplayTraceId() {
|
|
7716
7721
|
try {
|
|
7717
|
-
return import_src$
|
|
7722
|
+
return import_src$35.context.active().getValue(REPLAY_TRACE_ID_CONTEXT_KEY);
|
|
7718
7723
|
} catch (error) {
|
|
7719
7724
|
logger.error("SpanUtils error getting current replay trace id:", error);
|
|
7720
7725
|
return null;
|
|
@@ -8363,7 +8368,7 @@ function findMockResponseSync({ mockRequestData, tuskDrift, inputValueSchemaMerg
|
|
|
8363
8368
|
|
|
8364
8369
|
//#endregion
|
|
8365
8370
|
//#region src/instrumentation/libraries/http/mocks/TdMockClientRequest.ts
|
|
8366
|
-
var import_src$
|
|
8371
|
+
var import_src$34 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
8367
8372
|
let ClientRequest;
|
|
8368
8373
|
/**
|
|
8369
8374
|
* Mock ClientRequest implementation for Tusk Drift HTTP replay
|
|
@@ -8534,7 +8539,7 @@ var TdMockClientRequest = class TdMockClientRequest extends events.EventEmitter
|
|
|
8534
8539
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
8535
8540
|
submoduleName: rawInputValue.method,
|
|
8536
8541
|
inputValue,
|
|
8537
|
-
kind: import_src$
|
|
8542
|
+
kind: import_src$34.SpanKind.CLIENT,
|
|
8538
8543
|
stackTrace: this.stackTrace
|
|
8539
8544
|
},
|
|
8540
8545
|
tuskDrift: this.tuskDrift,
|
|
@@ -8704,7 +8709,7 @@ var HttpReplayHooks = class {
|
|
|
8704
8709
|
|
|
8705
8710
|
//#endregion
|
|
8706
8711
|
//#region src/instrumentation/core/utils/modeUtils.ts
|
|
8707
|
-
var import_src$
|
|
8712
|
+
var import_src$33 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
8708
8713
|
/**
|
|
8709
8714
|
* Utility function that abstracts the common record mode pattern of checking for current span context
|
|
8710
8715
|
* and deciding whether to execute record mode logic or just call the original function.
|
|
@@ -8725,7 +8730,7 @@ function handleRecordMode({ originalFunctionCall, recordModeHandler, spanKind })
|
|
|
8725
8730
|
return originalFunctionCall();
|
|
8726
8731
|
}
|
|
8727
8732
|
if (!isAppReady) return recordModeHandler({ isPreAppStart: true });
|
|
8728
|
-
if (!currentSpanInfo && spanKind !== import_src$
|
|
8733
|
+
if (!currentSpanInfo && spanKind !== import_src$33.SpanKind.SERVER || currentSpanInfo?.isPreAppStart) return originalFunctionCall();
|
|
8729
8734
|
else return recordModeHandler({ isPreAppStart: false });
|
|
8730
8735
|
}
|
|
8731
8736
|
/**
|
|
@@ -10205,7 +10210,7 @@ function captureStackTrace(excludeClassNames = []) {
|
|
|
10205
10210
|
|
|
10206
10211
|
//#endregion
|
|
10207
10212
|
//#region src/instrumentation/libraries/http/HttpTransformEngine.ts
|
|
10208
|
-
var import_src$
|
|
10213
|
+
var import_src$32 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
10209
10214
|
/**
|
|
10210
10215
|
* Creates an empty HttpClientInputValue object for dropped spans
|
|
10211
10216
|
*/
|
|
@@ -10258,7 +10263,7 @@ var HttpTransformEngine = class {
|
|
|
10258
10263
|
const testSpan = {
|
|
10259
10264
|
traceId: "",
|
|
10260
10265
|
spanId: "",
|
|
10261
|
-
kind: import_src$
|
|
10266
|
+
kind: import_src$32.SpanKind.SERVER,
|
|
10262
10267
|
protocol: "http",
|
|
10263
10268
|
inputValue: {
|
|
10264
10269
|
method,
|
|
@@ -10281,7 +10286,7 @@ var HttpTransformEngine = class {
|
|
|
10281
10286
|
const testSpan = {
|
|
10282
10287
|
traceId: "",
|
|
10283
10288
|
spanId: "",
|
|
10284
|
-
kind: import_src$
|
|
10289
|
+
kind: import_src$32.SpanKind.CLIENT,
|
|
10285
10290
|
protocol: inputValue.protocol || "http",
|
|
10286
10291
|
inputValue: clonedInputValue
|
|
10287
10292
|
};
|
|
@@ -10308,8 +10313,8 @@ var HttpTransformEngine = class {
|
|
|
10308
10313
|
const matcherFunction = this.compileMatcher(matcher);
|
|
10309
10314
|
if (action.type === "drop") return (span) => {
|
|
10310
10315
|
if (!matcherFunction(span)) return;
|
|
10311
|
-
if (span.inputValue) span.inputValue = span.kind === import_src$
|
|
10312
|
-
if (span.outputValue) span.outputValue = span.kind === import_src$
|
|
10316
|
+
if (span.inputValue) span.inputValue = span.kind === import_src$32.SpanKind.CLIENT ? createEmptyClientInputValue(span.protocol) : createEmptyServerInputValue();
|
|
10317
|
+
if (span.outputValue) span.outputValue = span.kind === import_src$32.SpanKind.CLIENT ? createEmptyClientOutputValue() : createEmptyServerOutputValue();
|
|
10313
10318
|
return {
|
|
10314
10319
|
type: "drop",
|
|
10315
10320
|
field: "entire_span",
|
|
@@ -10339,8 +10344,8 @@ var HttpTransformEngine = class {
|
|
|
10339
10344
|
}
|
|
10340
10345
|
compileMatcher(matcher) {
|
|
10341
10346
|
const checks = [];
|
|
10342
|
-
if (matcher.direction === "outbound") checks.push((span) => span.kind === import_src$
|
|
10343
|
-
else if (matcher.direction === "inbound") checks.push((span) => span.kind === import_src$
|
|
10347
|
+
if (matcher.direction === "outbound") checks.push((span) => span.kind === import_src$32.SpanKind.CLIENT);
|
|
10348
|
+
else if (matcher.direction === "inbound") checks.push((span) => span.kind === import_src$32.SpanKind.SERVER);
|
|
10344
10349
|
if (matcher.method) if (matcher.method.length === 0) {} else {
|
|
10345
10350
|
const methods = matcher.method.map((method) => method.toUpperCase());
|
|
10346
10351
|
checks.push((span) => {
|
|
@@ -10568,7 +10573,7 @@ var HttpTransformEngine = class {
|
|
|
10568
10573
|
|
|
10569
10574
|
//#endregion
|
|
10570
10575
|
//#region src/instrumentation/libraries/http/Instrumentation.ts
|
|
10571
|
-
var import_src$
|
|
10576
|
+
var import_src$31 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
10572
10577
|
var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
10573
10578
|
constructor(config) {
|
|
10574
10579
|
super("http", config);
|
|
@@ -10655,10 +10660,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10655
10660
|
logger.debug(`[HttpInstrumentation] Setting replay trace id`, replayTraceId);
|
|
10656
10661
|
const ctxWithReplayTraceId = SpanUtils.setCurrentReplayTraceId(replayTraceId);
|
|
10657
10662
|
if (!ctxWithReplayTraceId) throw new Error("Error setting current replay trace id");
|
|
10658
|
-
return import_src$
|
|
10663
|
+
return import_src$31.context.with(ctxWithReplayTraceId, () => {
|
|
10659
10664
|
return SpanUtils.createAndExecuteSpan(this.mode, () => originalHandler.call(this), {
|
|
10660
10665
|
name: `${target}`,
|
|
10661
|
-
kind: import_src$
|
|
10666
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10662
10667
|
packageName: spanProtocol,
|
|
10663
10668
|
submodule: method,
|
|
10664
10669
|
packageType: PackageType.HTTP,
|
|
@@ -10703,7 +10708,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10703
10708
|
logger.debug(`[HttpInstrumentation] Http inbound request arriving, inputValue: ${JSON.stringify(inputValue)}`);
|
|
10704
10709
|
return SpanUtils.createAndExecuteSpan(this.mode, () => originalHandler.call(this), {
|
|
10705
10710
|
name: `${target}`,
|
|
10706
|
-
kind: import_src$
|
|
10711
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10707
10712
|
packageName: spanProtocol,
|
|
10708
10713
|
packageType: PackageType.HTTP,
|
|
10709
10714
|
submodule: method,
|
|
@@ -10723,7 +10728,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10723
10728
|
});
|
|
10724
10729
|
});
|
|
10725
10730
|
},
|
|
10726
|
-
spanKind: import_src$
|
|
10731
|
+
spanKind: import_src$31.SpanKind.SERVER
|
|
10727
10732
|
});
|
|
10728
10733
|
} else return originalHandler.call(this);
|
|
10729
10734
|
}
|
|
@@ -10740,8 +10745,8 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10740
10745
|
_handleInboundRequestInSpan({ req, res, originalHandler, spanInfo, inputValue, schemaMerges, protocol }) {
|
|
10741
10746
|
const self = this;
|
|
10742
10747
|
const spanProtocol = this._normalizeProtocol(protocol, "http");
|
|
10743
|
-
import_src$
|
|
10744
|
-
import_src$
|
|
10748
|
+
import_src$31.context.bind(spanInfo.context, req);
|
|
10749
|
+
import_src$31.context.bind(spanInfo.context, res);
|
|
10745
10750
|
let completeInputValue = inputValue;
|
|
10746
10751
|
this._captureServerRequestBody(req, spanInfo, inputValue, schemaMerges, (updatedInputValue) => {
|
|
10747
10752
|
completeInputValue = updatedInputValue;
|
|
@@ -10779,7 +10784,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10779
10784
|
const spanData = {
|
|
10780
10785
|
traceId: spanInfo.traceId,
|
|
10781
10786
|
spanId: spanInfo.spanId,
|
|
10782
|
-
kind: import_src$
|
|
10787
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10783
10788
|
protocol: spanProtocol,
|
|
10784
10789
|
inputValue: completeInputValue,
|
|
10785
10790
|
outputValue
|
|
@@ -10797,10 +10802,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10797
10802
|
},
|
|
10798
10803
|
...spanData.transformMetadata && { transformMetadata: spanData.transformMetadata }
|
|
10799
10804
|
});
|
|
10800
|
-
const status = statusCode >=
|
|
10801
|
-
code: import_src$
|
|
10805
|
+
const status = statusCode >= 300 ? {
|
|
10806
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
10802
10807
|
message: `HTTP ${statusCode}`
|
|
10803
|
-
} : { code: import_src$
|
|
10808
|
+
} : { code: import_src$31.SpanStatusCode.OK };
|
|
10804
10809
|
SpanUtils.setStatus(spanInfo.span, status);
|
|
10805
10810
|
const decodedType = getDecodedType(outputValue.headers?.["content-type"] || "");
|
|
10806
10811
|
if (decodedType && !ACCEPTABLE_CONTENT_TYPES.has(decodedType)) {
|
|
@@ -10850,11 +10855,11 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10850
10855
|
outputSchemaHash: JsonSchemaHelper.generateDeterministicHash(outputSchema),
|
|
10851
10856
|
inputValueHash,
|
|
10852
10857
|
outputValueHash,
|
|
10853
|
-
kind: import_src$
|
|
10858
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10854
10859
|
packageType: PackageType.HTTP,
|
|
10855
10860
|
status: {
|
|
10856
|
-
code: statusCode >=
|
|
10857
|
-
message: statusCode >=
|
|
10861
|
+
code: statusCode >= 300 ? StatusCode.ERROR : StatusCode.OK,
|
|
10862
|
+
message: statusCode >= 300 ? `HTTP ${statusCode}` : ""
|
|
10858
10863
|
},
|
|
10859
10864
|
timestamp: {
|
|
10860
10865
|
seconds: Math.floor(now.getTime() / 1e3),
|
|
@@ -10879,7 +10884,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10879
10884
|
try {
|
|
10880
10885
|
logger.debug(`[HttpInstrumentation] Server request error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
10881
10886
|
SpanUtils.endSpan(spanInfo.span, {
|
|
10882
|
-
code: import_src$
|
|
10887
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
10883
10888
|
message: error.message
|
|
10884
10889
|
});
|
|
10885
10890
|
} catch (error$1) {
|
|
@@ -10890,7 +10895,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10890
10895
|
try {
|
|
10891
10896
|
logger.debug(`[HttpInstrumentation] Server response error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
10892
10897
|
SpanUtils.endSpan(spanInfo.span, {
|
|
10893
|
-
code: import_src$
|
|
10898
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
10894
10899
|
message: error.message
|
|
10895
10900
|
});
|
|
10896
10901
|
} catch (error$1) {
|
|
@@ -11095,7 +11100,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11095
11100
|
inputValue: completeInputValue
|
|
11096
11101
|
});
|
|
11097
11102
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11098
|
-
code: import_src$
|
|
11103
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
11099
11104
|
message: error.message
|
|
11100
11105
|
});
|
|
11101
11106
|
} catch (error$1) {
|
|
@@ -11112,7 +11117,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11112
11117
|
const spanData = {
|
|
11113
11118
|
traceId: spanInfo.traceId,
|
|
11114
11119
|
spanId: spanInfo.spanId,
|
|
11115
|
-
kind: import_src$
|
|
11120
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11116
11121
|
protocol: normalizedProtocol,
|
|
11117
11122
|
inputValue,
|
|
11118
11123
|
outputValue
|
|
@@ -11124,10 +11129,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11124
11129
|
outputSchemaMerges,
|
|
11125
11130
|
transformMetadata: spanData.transformMetadata ? spanData.transformMetadata : void 0
|
|
11126
11131
|
});
|
|
11127
|
-
const status = statusCode >=
|
|
11128
|
-
code: import_src$
|
|
11132
|
+
const status = statusCode >= 300 ? {
|
|
11133
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
11129
11134
|
message: `HTTP ${statusCode}`
|
|
11130
|
-
} : { code: import_src$
|
|
11135
|
+
} : { code: import_src$31.SpanStatusCode.OK };
|
|
11131
11136
|
SpanUtils.endSpan(spanInfo.span, status);
|
|
11132
11137
|
}
|
|
11133
11138
|
_captureHeadersFromRawHeaders(rawHeaders) {
|
|
@@ -11181,7 +11186,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11181
11186
|
};
|
|
11182
11187
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRequest.apply(this, args), {
|
|
11183
11188
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11184
|
-
kind: import_src$
|
|
11189
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11185
11190
|
packageName: requestProtocol,
|
|
11186
11191
|
packageType: PackageType.HTTP,
|
|
11187
11192
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11216,7 +11221,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11216
11221
|
};
|
|
11217
11222
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRequest.apply(this, args), {
|
|
11218
11223
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11219
|
-
kind: import_src$
|
|
11224
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11220
11225
|
packageName: requestProtocol,
|
|
11221
11226
|
packageType: PackageType.HTTP,
|
|
11222
11227
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11228,7 +11233,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11228
11233
|
return self._handleOutboundRequestInSpan(originalRequest, args, spanInfo, inputValue, { headers: { matchImportance: 0 } });
|
|
11229
11234
|
});
|
|
11230
11235
|
},
|
|
11231
|
-
spanKind: import_src$
|
|
11236
|
+
spanKind: import_src$31.SpanKind.CLIENT
|
|
11232
11237
|
});
|
|
11233
11238
|
else return originalRequest.apply(this, args);
|
|
11234
11239
|
};
|
|
@@ -11274,7 +11279,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11274
11279
|
};
|
|
11275
11280
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.apply(this, args), {
|
|
11276
11281
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11277
|
-
kind: import_src$
|
|
11282
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11278
11283
|
packageName: requestProtocol,
|
|
11279
11284
|
packageType: PackageType.HTTP,
|
|
11280
11285
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11308,7 +11313,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11308
11313
|
};
|
|
11309
11314
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.apply(this, args), {
|
|
11310
11315
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11311
|
-
kind: import_src$
|
|
11316
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11312
11317
|
packageName: requestProtocol,
|
|
11313
11318
|
packageType: PackageType.HTTP,
|
|
11314
11319
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11320,7 +11325,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11320
11325
|
return self._handleOutboundRequestInSpan(originalGet, args, spanInfo, inputValue, { headers: { matchImportance: 0 } });
|
|
11321
11326
|
});
|
|
11322
11327
|
},
|
|
11323
|
-
spanKind: import_src$
|
|
11328
|
+
spanKind: import_src$31.SpanKind.CLIENT
|
|
11324
11329
|
});
|
|
11325
11330
|
else return originalGet.apply(this, args);
|
|
11326
11331
|
};
|
|
@@ -11365,7 +11370,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11365
11370
|
|
|
11366
11371
|
//#endregion
|
|
11367
11372
|
//#region src/instrumentation/libraries/date/Instrumentation.ts
|
|
11368
|
-
var import_src$
|
|
11373
|
+
var import_src$30 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
11369
11374
|
/**
|
|
11370
11375
|
* Date instrumentation that provides consistent dates in replay mode.
|
|
11371
11376
|
* In replay mode, new Date() calls return the latest mock response timestamp.
|
|
@@ -11404,7 +11409,7 @@ var DateInstrumentation = class DateInstrumentation extends TdInstrumentationBas
|
|
|
11404
11409
|
if (this.mode !== TuskDriftMode.REPLAY) return this._callOriginalDate(args, isConstructorCall);
|
|
11405
11410
|
const currentSpanInfo = SpanUtils.getCurrentSpanInfo();
|
|
11406
11411
|
if (!currentSpanInfo) return this._callOriginalDate(args, isConstructorCall);
|
|
11407
|
-
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) !== import_src$
|
|
11412
|
+
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) !== import_src$30.SpanKind.SERVER) return this._callOriginalDate(args, isConstructorCall);
|
|
11408
11413
|
this.isInPatchedCall = true;
|
|
11409
11414
|
try {
|
|
11410
11415
|
return this._handleReplayDate(args, isConstructorCall);
|
|
@@ -11650,7 +11655,7 @@ var TdPgClientMock = class extends events.EventEmitter {
|
|
|
11650
11655
|
|
|
11651
11656
|
//#endregion
|
|
11652
11657
|
//#region src/instrumentation/libraries/pg/Instrumentation.ts
|
|
11653
|
-
var import_src$
|
|
11658
|
+
var import_src$29 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
11654
11659
|
var PgInstrumentation = class extends TdInstrumentationBase {
|
|
11655
11660
|
constructor(config = {}) {
|
|
11656
11661
|
super("pg", config);
|
|
@@ -11723,7 +11728,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11723
11728
|
const spanName = inputValue.clientType === "pool" ? "pg-pool.query" : "pg.query";
|
|
11724
11729
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
11725
11730
|
name: spanName,
|
|
11726
|
-
kind: import_src$
|
|
11731
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11727
11732
|
submodule: "query",
|
|
11728
11733
|
packageType: PackageType.PG,
|
|
11729
11734
|
packageName,
|
|
@@ -11742,7 +11747,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11742
11747
|
const spanName = inputValue.clientType === "pool" ? "pg-pool.query" : "pg.query";
|
|
11743
11748
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
11744
11749
|
name: spanName,
|
|
11745
|
-
kind: import_src$
|
|
11750
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11746
11751
|
submodule: "query",
|
|
11747
11752
|
packageType: PackageType.PG,
|
|
11748
11753
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11753,7 +11758,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11753
11758
|
return self._handleRecordQueryInSpan(spanInfo, originalQuery, queryConfig, args, this);
|
|
11754
11759
|
});
|
|
11755
11760
|
},
|
|
11756
|
-
spanKind: import_src$
|
|
11761
|
+
spanKind: import_src$29.SpanKind.CLIENT
|
|
11757
11762
|
});
|
|
11758
11763
|
else return originalQuery.apply(this, args);
|
|
11759
11764
|
};
|
|
@@ -11775,7 +11780,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11775
11780
|
replayModeHandler: () => {
|
|
11776
11781
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
11777
11782
|
name: `pg.connect`,
|
|
11778
|
-
kind: import_src$
|
|
11783
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11779
11784
|
submodule: "connect",
|
|
11780
11785
|
packageName: "pg",
|
|
11781
11786
|
packageType: PackageType.PG,
|
|
@@ -11792,7 +11797,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11792
11797
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
11793
11798
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
11794
11799
|
name: `pg.connect`,
|
|
11795
|
-
kind: import_src$
|
|
11800
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11796
11801
|
submodule: "connect",
|
|
11797
11802
|
packageName: "pg",
|
|
11798
11803
|
packageType: PackageType.PG,
|
|
@@ -11803,7 +11808,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11803
11808
|
return self._handleRecordConnectInSpan(spanInfo, originalConnect, callback, this);
|
|
11804
11809
|
});
|
|
11805
11810
|
},
|
|
11806
|
-
spanKind: import_src$
|
|
11811
|
+
spanKind: import_src$29.SpanKind.CLIENT
|
|
11807
11812
|
});
|
|
11808
11813
|
else return originalConnect.apply(this, [callback]);
|
|
11809
11814
|
};
|
|
@@ -11843,7 +11848,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11843
11848
|
logger.debug(`[PgInstrumentation] PG query error (hasCallback): ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
11844
11849
|
try {
|
|
11845
11850
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11846
|
-
code: import_src$
|
|
11851
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
11847
11852
|
message: error.message
|
|
11848
11853
|
});
|
|
11849
11854
|
} catch (error$1) {
|
|
@@ -11853,7 +11858,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11853
11858
|
logger.debug(`[PgInstrumentation] PG query completed successfully (hasCallback) (${SpanUtils.getTraceInfo()})`);
|
|
11854
11859
|
try {
|
|
11855
11860
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
11856
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
11861
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
11857
11862
|
} catch (error$1) {
|
|
11858
11863
|
logger.error(`[PgInstrumentation] error processing response:`, error$1);
|
|
11859
11864
|
}
|
|
@@ -11880,7 +11885,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11880
11885
|
logger.debug(`[PgInstrumentation] PG query completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
11881
11886
|
try {
|
|
11882
11887
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
11883
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
11888
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
11884
11889
|
} catch (error) {
|
|
11885
11890
|
logger.error(`[PgInstrumentation] error processing response:`, error);
|
|
11886
11891
|
}
|
|
@@ -11889,7 +11894,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11889
11894
|
logger.debug(`[PgInstrumentation] PG query error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
11890
11895
|
try {
|
|
11891
11896
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11892
|
-
code: import_src$
|
|
11897
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
11893
11898
|
message: error.message
|
|
11894
11899
|
});
|
|
11895
11900
|
} catch (error$1) {
|
|
@@ -11921,7 +11926,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11921
11926
|
packageName,
|
|
11922
11927
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
11923
11928
|
submoduleName: "query",
|
|
11924
|
-
kind: import_src$
|
|
11929
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11925
11930
|
stackTrace
|
|
11926
11931
|
},
|
|
11927
11932
|
tuskDrift: this.tuskDrift
|
|
@@ -12007,7 +12012,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12007
12012
|
logger.debug(`[PgInstrumentation] PG connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12008
12013
|
try {
|
|
12009
12014
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12010
|
-
code: import_src$
|
|
12015
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12011
12016
|
message: error.message
|
|
12012
12017
|
});
|
|
12013
12018
|
} catch (error$1) {
|
|
@@ -12017,7 +12022,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12017
12022
|
logger.debug(`[PgInstrumentation] PG connect completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
12018
12023
|
try {
|
|
12019
12024
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
12020
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12025
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12021
12026
|
} catch (error$1) {
|
|
12022
12027
|
logger.error(`[PgInstrumentation] error processing connect response:`, error$1);
|
|
12023
12028
|
}
|
|
@@ -12029,7 +12034,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12029
12034
|
logger.debug(`[PgInstrumentation] PG connect completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
12030
12035
|
try {
|
|
12031
12036
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
12032
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12037
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12033
12038
|
} catch (error) {
|
|
12034
12039
|
logger.error(`[PgInstrumentation] error processing connect response:`, error);
|
|
12035
12040
|
}
|
|
@@ -12038,7 +12043,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12038
12043
|
logger.debug(`[PgInstrumentation] PG connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12039
12044
|
try {
|
|
12040
12045
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12041
|
-
code: import_src$
|
|
12046
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12042
12047
|
message: error.message
|
|
12043
12048
|
});
|
|
12044
12049
|
} catch (error$1) {
|
|
@@ -12110,7 +12115,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12110
12115
|
replayModeHandler: () => {
|
|
12111
12116
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
12112
12117
|
name: `pg-pool.connect`,
|
|
12113
|
-
kind: import_src$
|
|
12118
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
12114
12119
|
submodule: "connect",
|
|
12115
12120
|
packageName: "pg-pool",
|
|
12116
12121
|
packageType: PackageType.PG,
|
|
@@ -12127,7 +12132,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12127
12132
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12128
12133
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
12129
12134
|
name: `pg-pool.connect`,
|
|
12130
|
-
kind: import_src$
|
|
12135
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
12131
12136
|
submodule: "connect",
|
|
12132
12137
|
packageName: "pg-pool",
|
|
12133
12138
|
packageType: PackageType.PG,
|
|
@@ -12138,7 +12143,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12138
12143
|
return self._handleRecordPoolConnectInSpan(spanInfo, originalConnect, callback, this);
|
|
12139
12144
|
});
|
|
12140
12145
|
},
|
|
12141
|
-
spanKind: import_src$
|
|
12146
|
+
spanKind: import_src$29.SpanKind.CLIENT
|
|
12142
12147
|
});
|
|
12143
12148
|
else return originalConnect.apply(this, [callback]);
|
|
12144
12149
|
};
|
|
@@ -12151,7 +12156,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12151
12156
|
logger.debug(`[PgInstrumentation] PG Pool connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12152
12157
|
try {
|
|
12153
12158
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12154
|
-
code: import_src$
|
|
12159
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12155
12160
|
message: error.message
|
|
12156
12161
|
});
|
|
12157
12162
|
} catch (error$1) {
|
|
@@ -12164,7 +12169,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12164
12169
|
connected: true,
|
|
12165
12170
|
hasClient: !!client
|
|
12166
12171
|
} });
|
|
12167
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12172
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12168
12173
|
} catch (error$1) {
|
|
12169
12174
|
logger.error(`[PgInstrumentation] error processing pool connect response:`, error$1);
|
|
12170
12175
|
}
|
|
@@ -12179,7 +12184,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12179
12184
|
connected: true,
|
|
12180
12185
|
hasClient: !!client
|
|
12181
12186
|
} });
|
|
12182
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12187
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12183
12188
|
} catch (error) {
|
|
12184
12189
|
logger.error(`[PgInstrumentation] error processing pool connect response:`, error);
|
|
12185
12190
|
}
|
|
@@ -12188,7 +12193,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12188
12193
|
logger.debug(`[PgInstrumentation] PG Pool connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12189
12194
|
try {
|
|
12190
12195
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12191
|
-
code: import_src$
|
|
12196
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12192
12197
|
message: error.message
|
|
12193
12198
|
});
|
|
12194
12199
|
} catch (error$1) {
|
|
@@ -12313,7 +12318,7 @@ function reconstructQueryString(strings, values) {
|
|
|
12313
12318
|
|
|
12314
12319
|
//#endregion
|
|
12315
12320
|
//#region src/instrumentation/libraries/postgres/handlers/ConnectionHandler.ts
|
|
12316
|
-
var import_src$
|
|
12321
|
+
var import_src$28 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
12317
12322
|
var ConnectionHandler = class {
|
|
12318
12323
|
constructor(mode, instrumentationName, isAppReady, wrapSqlInstance) {
|
|
12319
12324
|
this.mode = mode;
|
|
@@ -12357,7 +12362,7 @@ var ConnectionHandler = class {
|
|
|
12357
12362
|
return this.wrapSqlInstance(sqlInstance);
|
|
12358
12363
|
}, {
|
|
12359
12364
|
name: "postgres.connect",
|
|
12360
|
-
kind: import_src$
|
|
12365
|
+
kind: import_src$28.SpanKind.CLIENT,
|
|
12361
12366
|
submodule: "connect",
|
|
12362
12367
|
packageType: PackageType.PG,
|
|
12363
12368
|
packageName: "postgres",
|
|
@@ -12380,7 +12385,7 @@ var ConnectionHandler = class {
|
|
|
12380
12385
|
return this.wrapSqlInstance(sqlInstance);
|
|
12381
12386
|
}, {
|
|
12382
12387
|
name: "postgres.connect",
|
|
12383
|
-
kind: import_src$
|
|
12388
|
+
kind: import_src$28.SpanKind.CLIENT,
|
|
12384
12389
|
submodule: "connect",
|
|
12385
12390
|
packageType: PackageType.PG,
|
|
12386
12391
|
packageName: "postgres",
|
|
@@ -12391,7 +12396,7 @@ var ConnectionHandler = class {
|
|
|
12391
12396
|
return this.handleRecordConnect(spanInfo, originalFunction, args);
|
|
12392
12397
|
});
|
|
12393
12398
|
},
|
|
12394
|
-
spanKind: import_src$
|
|
12399
|
+
spanKind: import_src$28.SpanKind.CLIENT
|
|
12395
12400
|
});
|
|
12396
12401
|
else return originalFunction(...args);
|
|
12397
12402
|
}
|
|
@@ -12401,7 +12406,7 @@ var ConnectionHandler = class {
|
|
|
12401
12406
|
try {
|
|
12402
12407
|
logger.debug(`[PostgresInstrumentation] Postgres connection created successfully (${SpanUtils.getTraceInfo()})`);
|
|
12403
12408
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
12404
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12409
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$28.SpanStatusCode.OK });
|
|
12405
12410
|
} catch (error) {
|
|
12406
12411
|
logger.error(`[PostgresInstrumentation] error adding span attributes:`, error);
|
|
12407
12412
|
}
|
|
@@ -12421,7 +12426,7 @@ var ConnectionHandler = class {
|
|
|
12421
12426
|
|
|
12422
12427
|
//#endregion
|
|
12423
12428
|
//#region src/instrumentation/libraries/postgres/Instrumentation.ts
|
|
12424
|
-
var import_src$
|
|
12429
|
+
var import_src$27 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
12425
12430
|
var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
12426
12431
|
constructor(config = {}) {
|
|
12427
12432
|
super("postgres", config);
|
|
@@ -12592,7 +12597,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12592
12597
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12593
12598
|
return SpanUtils.createAndExecuteSpan(this.mode, () => originalListen.call(sqlInstance, channelName, callback, onlisten), {
|
|
12594
12599
|
name: "postgres.listen",
|
|
12595
|
-
kind: import_src$
|
|
12600
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12596
12601
|
submodule: "listen",
|
|
12597
12602
|
packageType: PackageType.PG,
|
|
12598
12603
|
packageName: "postgres",
|
|
@@ -12619,7 +12624,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12619
12624
|
state: result.state,
|
|
12620
12625
|
payloads: receivedPayloads
|
|
12621
12626
|
} });
|
|
12622
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12627
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12623
12628
|
} catch (error) {
|
|
12624
12629
|
logger.error(`[PostgresInstrumentation] error adding span attributes:`, error);
|
|
12625
12630
|
}
|
|
@@ -12633,7 +12638,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12633
12638
|
logger.error(`[PostgresInstrumentation] RECORD listen error: ${error.message}`);
|
|
12634
12639
|
try {
|
|
12635
12640
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12636
|
-
code: import_src$
|
|
12641
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12637
12642
|
message: error.message
|
|
12638
12643
|
});
|
|
12639
12644
|
} catch (error$1) {
|
|
@@ -12643,7 +12648,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12643
12648
|
}
|
|
12644
12649
|
});
|
|
12645
12650
|
},
|
|
12646
|
-
spanKind: import_src$
|
|
12651
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
12647
12652
|
});
|
|
12648
12653
|
}
|
|
12649
12654
|
async _handleReplayListen(channelName, callback, onlisten, inputValue) {
|
|
@@ -12661,7 +12666,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12661
12666
|
unlisten: async () => {}
|
|
12662
12667
|
}), {
|
|
12663
12668
|
name: "postgres.listen",
|
|
12664
|
-
kind: import_src$
|
|
12669
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12665
12670
|
submodule: "listen",
|
|
12666
12671
|
packageType: PackageType.PG,
|
|
12667
12672
|
packageName: "postgres",
|
|
@@ -12689,7 +12694,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12689
12694
|
logger.debug(`[PostgresInstrumentation] REPLAY: Invoking callback with recorded payload: ${payload}`);
|
|
12690
12695
|
callback(payload);
|
|
12691
12696
|
}
|
|
12692
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12697
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12693
12698
|
return {
|
|
12694
12699
|
state: recordedState,
|
|
12695
12700
|
unlisten: async () => {
|
|
@@ -12699,7 +12704,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12699
12704
|
} catch (error) {
|
|
12700
12705
|
logger.error(`[PostgresInstrumentation] REPLAY listen error: ${error.message}`);
|
|
12701
12706
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12702
|
-
code: import_src$
|
|
12707
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12703
12708
|
message: error.message
|
|
12704
12709
|
});
|
|
12705
12710
|
throw error;
|
|
@@ -12718,7 +12723,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12718
12723
|
}
|
|
12719
12724
|
_handleSqlQuery(originalSql, strings, values) {
|
|
12720
12725
|
if (!strings || !Array.isArray(strings.raw)) return originalSql.call(this, strings, ...values);
|
|
12721
|
-
const creationContext = import_src$
|
|
12726
|
+
const creationContext = import_src$27.context.active();
|
|
12722
12727
|
const query = originalSql.call(this, strings, ...values);
|
|
12723
12728
|
const inputValue = {
|
|
12724
12729
|
query: reconstructQueryString(strings, values).trim(),
|
|
@@ -12741,7 +12746,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12741
12746
|
else if (parameters !== void 0) return originalUnsafe.call(sqlInstance, query, parameters);
|
|
12742
12747
|
else return originalUnsafe.call(sqlInstance, query);
|
|
12743
12748
|
})();
|
|
12744
|
-
const creationContext = import_src$
|
|
12749
|
+
const creationContext = import_src$27.context.active();
|
|
12745
12750
|
const originalThen = unsafeQuery.then.bind(unsafeQuery);
|
|
12746
12751
|
const inputValue = {
|
|
12747
12752
|
query: query.trim(),
|
|
@@ -12764,7 +12769,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12764
12769
|
else if (parameters !== void 0) return originalFile.call(sqlInstance, path$5, parameters);
|
|
12765
12770
|
else return originalFile.call(sqlInstance, path$5);
|
|
12766
12771
|
})();
|
|
12767
|
-
const creationContext = import_src$
|
|
12772
|
+
const creationContext = import_src$27.context.active();
|
|
12768
12773
|
const originalThen = fileQuery.then.bind(fileQuery);
|
|
12769
12774
|
const self = this;
|
|
12770
12775
|
const inputValue = {
|
|
@@ -12775,13 +12780,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12775
12780
|
fileQuery.then = function(onFulfilled, onRejected) {
|
|
12776
12781
|
if (fileQuery._tuskRecorded) return originalThen(onFulfilled, onRejected);
|
|
12777
12782
|
fileQuery._tuskRecorded = true;
|
|
12778
|
-
return import_src$
|
|
12783
|
+
return import_src$27.context.with(creationContext, () => {
|
|
12779
12784
|
if (self.mode === TuskDriftMode.RECORD) return handleRecordMode({
|
|
12780
12785
|
originalFunctionCall: () => originalThen(onFulfilled, onRejected),
|
|
12781
12786
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12782
12787
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
12783
12788
|
name: "postgres.file",
|
|
12784
|
-
kind: import_src$
|
|
12789
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12785
12790
|
submodule: "file",
|
|
12786
12791
|
packageType: PackageType.PG,
|
|
12787
12792
|
packageName: "postgres",
|
|
@@ -12793,7 +12798,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12793
12798
|
try {
|
|
12794
12799
|
logger.debug(`[PostgresInstrumentation] Postgres file query completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
12795
12800
|
addOutputAttributesToSpan(spanInfo, result);
|
|
12796
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12801
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12797
12802
|
} catch (error) {
|
|
12798
12803
|
logger.error(`[PostgresInstrumentation] error processing file query response:`, error);
|
|
12799
12804
|
}
|
|
@@ -12803,7 +12808,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12803
12808
|
try {
|
|
12804
12809
|
logger.debug(`[PostgresInstrumentation] Postgres file query error: ${error.message}`);
|
|
12805
12810
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12806
|
-
code: import_src$
|
|
12811
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12807
12812
|
message: error.message
|
|
12808
12813
|
});
|
|
12809
12814
|
} catch (spanError) {
|
|
@@ -12815,7 +12820,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12815
12820
|
return originalThen(wrappedOnFulfilled, wrappedOnRejected);
|
|
12816
12821
|
});
|
|
12817
12822
|
},
|
|
12818
|
-
spanKind: import_src$
|
|
12823
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
12819
12824
|
});
|
|
12820
12825
|
else if (self.mode === TuskDriftMode.REPLAY) {
|
|
12821
12826
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
@@ -12828,7 +12833,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12828
12833
|
replayModeHandler: () => {
|
|
12829
12834
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
12830
12835
|
name: "postgres.file",
|
|
12831
|
-
kind: import_src$
|
|
12836
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12832
12837
|
submodule: "file",
|
|
12833
12838
|
packageType: PackageType.PG,
|
|
12834
12839
|
packageName: "postgres",
|
|
@@ -12901,7 +12906,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12901
12906
|
replayModeHandler: () => {
|
|
12902
12907
|
return SpanUtils.createAndExecuteSpan(this.mode, () => executeBegin(), {
|
|
12903
12908
|
name: "postgres.begin",
|
|
12904
|
-
kind: import_src$
|
|
12909
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12905
12910
|
submodule: "transaction",
|
|
12906
12911
|
packageType: PackageType.PG,
|
|
12907
12912
|
packageName: "postgres",
|
|
@@ -12918,7 +12923,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12918
12923
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12919
12924
|
return SpanUtils.createAndExecuteSpan(this.mode, executeBegin, {
|
|
12920
12925
|
name: "postgres.begin",
|
|
12921
|
-
kind: import_src$
|
|
12926
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12922
12927
|
submodule: "transaction",
|
|
12923
12928
|
packageType: PackageType.PG,
|
|
12924
12929
|
packageName: "postgres",
|
|
@@ -12929,7 +12934,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12929
12934
|
return this._handleRecordBeginTransaction(spanInfo, executeBegin);
|
|
12930
12935
|
});
|
|
12931
12936
|
},
|
|
12932
|
-
spanKind: import_src$
|
|
12937
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
12933
12938
|
});
|
|
12934
12939
|
else return executeBegin();
|
|
12935
12940
|
}
|
|
@@ -12941,7 +12946,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12941
12946
|
status: "committed",
|
|
12942
12947
|
result
|
|
12943
12948
|
} });
|
|
12944
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12949
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12945
12950
|
} catch (error) {
|
|
12946
12951
|
logger.error(`[PostgresInstrumentation] error processing transaction response:`, error);
|
|
12947
12952
|
}
|
|
@@ -12954,7 +12959,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12954
12959
|
error: error.message
|
|
12955
12960
|
} });
|
|
12956
12961
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12957
|
-
code: import_src$
|
|
12962
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12958
12963
|
message: error.message
|
|
12959
12964
|
});
|
|
12960
12965
|
} catch (spanError) {
|
|
@@ -13033,7 +13038,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13033
13038
|
packageName: "postgres",
|
|
13034
13039
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
13035
13040
|
submoduleName,
|
|
13036
|
-
kind: import_src$
|
|
13041
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13037
13042
|
stackTrace
|
|
13038
13043
|
},
|
|
13039
13044
|
tuskDrift: this.tuskDrift
|
|
@@ -13050,7 +13055,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13050
13055
|
state: result?.state,
|
|
13051
13056
|
statement: result?.statement
|
|
13052
13057
|
}));
|
|
13053
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13058
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13054
13059
|
logger.debug(`[PostgresInstrumentation] ${operation} completed, recorded ${allRows.length} rows`);
|
|
13055
13060
|
}
|
|
13056
13061
|
/**
|
|
@@ -13078,13 +13083,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13078
13083
|
}
|
|
13079
13084
|
_handleCursorCallbackRecord({ originalCursor, rows, inputValue, creationContext, userCallback }) {
|
|
13080
13085
|
const self = this;
|
|
13081
|
-
return import_src$
|
|
13086
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13082
13087
|
return handleRecordMode({
|
|
13083
13088
|
originalFunctionCall: () => originalCursor(rows, userCallback),
|
|
13084
13089
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
13085
13090
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCursor(rows, userCallback), {
|
|
13086
13091
|
name: "postgres.cursor",
|
|
13087
|
-
kind: import_src$
|
|
13092
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13088
13093
|
submodule: "cursor",
|
|
13089
13094
|
packageType: PackageType.PG,
|
|
13090
13095
|
packageName: "postgres",
|
|
@@ -13100,7 +13105,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13100
13105
|
});
|
|
13101
13106
|
});
|
|
13102
13107
|
},
|
|
13103
|
-
spanKind: import_src$
|
|
13108
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
13104
13109
|
});
|
|
13105
13110
|
});
|
|
13106
13111
|
}
|
|
@@ -13123,7 +13128,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13123
13128
|
logger.debug(`[PostgresInstrumentation] Cursor callback error: ${error.message}`);
|
|
13124
13129
|
if (spanInfo) try {
|
|
13125
13130
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13126
|
-
code: import_src$
|
|
13131
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13127
13132
|
message: error.message
|
|
13128
13133
|
});
|
|
13129
13134
|
} catch (error$1) {
|
|
@@ -13135,14 +13140,14 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13135
13140
|
_handleCursorCallbackReplay({ inputValue, creationContext, cursorBatchSize, userCallback }) {
|
|
13136
13141
|
const self = this;
|
|
13137
13142
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
13138
|
-
return import_src$
|
|
13143
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13139
13144
|
return handleReplayMode({
|
|
13140
13145
|
noOpRequestHandler: () => Promise.resolve(),
|
|
13141
13146
|
isServerRequest: false,
|
|
13142
13147
|
replayModeHandler: () => {
|
|
13143
13148
|
return SpanUtils.createAndExecuteSpan(self.mode, () => Promise.resolve(), {
|
|
13144
13149
|
name: "postgres.cursor",
|
|
13145
|
-
kind: import_src$
|
|
13150
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13146
13151
|
submodule: "cursor",
|
|
13147
13152
|
packageType: PackageType.PG,
|
|
13148
13153
|
packageName: "postgres",
|
|
@@ -13167,11 +13172,11 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13167
13172
|
logger.debug(`[PostgresInstrumentation] Cursor replay calling callback with batch of ${batch.length} rows`);
|
|
13168
13173
|
await userCallback(batch);
|
|
13169
13174
|
}
|
|
13170
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13175
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13171
13176
|
} catch (error) {
|
|
13172
13177
|
logger.debug(`[PostgresInstrumentation] Cursor callback replay error: ${error.message}`);
|
|
13173
13178
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13174
|
-
code: import_src$
|
|
13179
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13175
13180
|
message: error.message
|
|
13176
13181
|
});
|
|
13177
13182
|
throw error;
|
|
@@ -13191,7 +13196,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13191
13196
|
let spanStarted = false;
|
|
13192
13197
|
return {
|
|
13193
13198
|
async next() {
|
|
13194
|
-
return import_src$
|
|
13199
|
+
return import_src$27.context.with(creationContext, async () => {
|
|
13195
13200
|
if (!spanStarted) {
|
|
13196
13201
|
spanStarted = true;
|
|
13197
13202
|
let spanInputValue;
|
|
@@ -13203,7 +13208,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13203
13208
|
}
|
|
13204
13209
|
spanInfo = SpanUtils.createSpan({
|
|
13205
13210
|
name: "postgres.cursor",
|
|
13206
|
-
kind: import_src$
|
|
13211
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13207
13212
|
isPreAppStart: self.tuskDrift.isAppReady() ? false : true,
|
|
13208
13213
|
attributes: {
|
|
13209
13214
|
[TdSpanAttributes.NAME]: "postgres.cursor",
|
|
@@ -13238,7 +13243,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13238
13243
|
} catch (error) {
|
|
13239
13244
|
if (spanInfo) try {
|
|
13240
13245
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13241
|
-
code: import_src$
|
|
13246
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13242
13247
|
message: error.message
|
|
13243
13248
|
});
|
|
13244
13249
|
} catch (error$1) {
|
|
@@ -13273,12 +13278,12 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13273
13278
|
let dataFetched = false;
|
|
13274
13279
|
return {
|
|
13275
13280
|
async next() {
|
|
13276
|
-
return import_src$
|
|
13281
|
+
return import_src$27.context.with(creationContext, async () => {
|
|
13277
13282
|
if (!dataFetched) {
|
|
13278
13283
|
dataFetched = true;
|
|
13279
13284
|
spanInfo = SpanUtils.createSpan({
|
|
13280
13285
|
name: "postgres.cursor",
|
|
13281
|
-
kind: import_src$
|
|
13286
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13282
13287
|
isPreAppStart: self.tuskDrift.isAppReady() ? false : true,
|
|
13283
13288
|
attributes: {
|
|
13284
13289
|
[TdSpanAttributes.NAME]: "postgres.cursor",
|
|
@@ -13300,7 +13305,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13300
13305
|
});
|
|
13301
13306
|
if (!mockData) {
|
|
13302
13307
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13303
|
-
code: import_src$
|
|
13308
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13304
13309
|
message: "No mock data found"
|
|
13305
13310
|
});
|
|
13306
13311
|
throw new Error(`[PostgresInstrumentation] No matching mock found for cursor query: ${inputValue.query}`);
|
|
@@ -13310,7 +13315,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13310
13315
|
mockedData = Array.isArray(processedResult) ? processedResult : [];
|
|
13311
13316
|
}
|
|
13312
13317
|
if (currentIndex >= mockedData.length) {
|
|
13313
|
-
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13318
|
+
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13314
13319
|
return {
|
|
13315
13320
|
done: true,
|
|
13316
13321
|
value: void 0
|
|
@@ -13326,7 +13331,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13326
13331
|
});
|
|
13327
13332
|
},
|
|
13328
13333
|
async return() {
|
|
13329
|
-
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13334
|
+
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13330
13335
|
return {
|
|
13331
13336
|
done: true,
|
|
13332
13337
|
value: void 0
|
|
@@ -13337,13 +13342,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13337
13342
|
}
|
|
13338
13343
|
_handleForEachRecord({ originalForEach, inputValue, creationContext, userCallback }) {
|
|
13339
13344
|
const self = this;
|
|
13340
|
-
return import_src$
|
|
13345
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13341
13346
|
return handleRecordMode({
|
|
13342
13347
|
originalFunctionCall: () => originalForEach(userCallback),
|
|
13343
13348
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
13344
13349
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalForEach(userCallback), {
|
|
13345
13350
|
name: "postgres.query",
|
|
13346
|
-
kind: import_src$
|
|
13351
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13347
13352
|
submodule: "query",
|
|
13348
13353
|
packageType: PackageType.PG,
|
|
13349
13354
|
packageName: "postgres",
|
|
@@ -13367,7 +13372,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13367
13372
|
} catch (error) {
|
|
13368
13373
|
try {
|
|
13369
13374
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13370
|
-
code: import_src$
|
|
13375
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13371
13376
|
message: error.message
|
|
13372
13377
|
});
|
|
13373
13378
|
} catch (error$1) {
|
|
@@ -13377,14 +13382,14 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13377
13382
|
}
|
|
13378
13383
|
});
|
|
13379
13384
|
},
|
|
13380
|
-
spanKind: import_src$
|
|
13385
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
13381
13386
|
});
|
|
13382
13387
|
});
|
|
13383
13388
|
}
|
|
13384
13389
|
_handleForEachReplay({ inputValue, creationContext, userCallback }) {
|
|
13385
13390
|
const self = this;
|
|
13386
13391
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
13387
|
-
return import_src$
|
|
13392
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13388
13393
|
return handleReplayMode({
|
|
13389
13394
|
noOpRequestHandler: () => Promise.resolve(Object.assign([], {
|
|
13390
13395
|
count: 0,
|
|
@@ -13397,7 +13402,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13397
13402
|
command: null
|
|
13398
13403
|
})), {
|
|
13399
13404
|
name: "postgres.query",
|
|
13400
|
-
kind: import_src$
|
|
13405
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13401
13406
|
submodule: "query",
|
|
13402
13407
|
packageType: PackageType.PG,
|
|
13403
13408
|
packageName: "postgres",
|
|
@@ -13417,7 +13422,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13417
13422
|
const mockedRows = Array.isArray(mockedResult) ? mockedResult : [];
|
|
13418
13423
|
logger.debug(`[PostgresInstrumentation] forEach replay: calling callback with ${mockedRows.length} mocked rows`);
|
|
13419
13424
|
for (const row of mockedRows) userCallback(row, mockedResult);
|
|
13420
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13425
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13421
13426
|
return Object.assign([], {
|
|
13422
13427
|
count: mockedRows.length,
|
|
13423
13428
|
command: null
|
|
@@ -13425,7 +13430,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13425
13430
|
} catch (error) {
|
|
13426
13431
|
logger.debug(`[PostgresInstrumentation] forEach replay error: ${error.message}`);
|
|
13427
13432
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13428
|
-
code: import_src$
|
|
13433
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13429
13434
|
message: error.message
|
|
13430
13435
|
});
|
|
13431
13436
|
throw error;
|
|
@@ -13445,13 +13450,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13445
13450
|
if (query._forEachCalled) return originalThen(onFulfilled, onRejected);
|
|
13446
13451
|
if (query._tuskRecorded) return originalThen(onFulfilled, onRejected);
|
|
13447
13452
|
query._tuskRecorded = true;
|
|
13448
|
-
return import_src$
|
|
13453
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13449
13454
|
if (self.mode === TuskDriftMode.RECORD) return handleRecordMode({
|
|
13450
13455
|
originalFunctionCall: () => originalThen(onFulfilled, onRejected),
|
|
13451
13456
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
13452
13457
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
13453
13458
|
name: spanConfig.name,
|
|
13454
|
-
kind: import_src$
|
|
13459
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13455
13460
|
submodule: spanConfig.submodule,
|
|
13456
13461
|
packageType: PackageType.PG,
|
|
13457
13462
|
packageName: "postgres",
|
|
@@ -13463,7 +13468,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13463
13468
|
try {
|
|
13464
13469
|
logger.debug(`[PostgresInstrumentation] Postgres ${spanConfig.operationType} query completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
13465
13470
|
addOutputAttributesToSpan(spanInfo, result);
|
|
13466
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13471
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13467
13472
|
} catch (error) {
|
|
13468
13473
|
logger.error(`[PostgresInstrumentation] error processing ${spanConfig.operationType} query response:`, error);
|
|
13469
13474
|
}
|
|
@@ -13473,7 +13478,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13473
13478
|
try {
|
|
13474
13479
|
logger.debug(`[PostgresInstrumentation] Postgres ${spanConfig.operationType} query error: ${error.message}`);
|
|
13475
13480
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13476
|
-
code: import_src$
|
|
13481
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13477
13482
|
message: error.message
|
|
13478
13483
|
});
|
|
13479
13484
|
} catch (spanError) {
|
|
@@ -13485,7 +13490,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13485
13490
|
return originalThen(wrappedOnFulfilled, wrappedOnRejected);
|
|
13486
13491
|
});
|
|
13487
13492
|
},
|
|
13488
|
-
spanKind: import_src$
|
|
13493
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
13489
13494
|
});
|
|
13490
13495
|
else if (self.mode === TuskDriftMode.REPLAY) {
|
|
13491
13496
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
@@ -13498,7 +13503,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13498
13503
|
replayModeHandler: () => {
|
|
13499
13504
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
13500
13505
|
name: spanConfig.name,
|
|
13501
|
-
kind: import_src$
|
|
13506
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13502
13507
|
submodule: spanConfig.submodule,
|
|
13503
13508
|
packageType: PackageType.PG,
|
|
13504
13509
|
packageName: "postgres",
|
|
@@ -13779,7 +13784,7 @@ var TdMysqlConnectionMock = class extends events.EventEmitter {
|
|
|
13779
13784
|
|
|
13780
13785
|
//#endregion
|
|
13781
13786
|
//#region src/instrumentation/libraries/mysql/mocks/TdMysqlQueryMock.ts
|
|
13782
|
-
var import_src$
|
|
13787
|
+
var import_src$26 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
13783
13788
|
/**
|
|
13784
13789
|
* Handles replay mode for MySQL query operations
|
|
13785
13790
|
* Returns EventEmitters synchronously to support both callback and streaming modes
|
|
@@ -13900,7 +13905,7 @@ var TdMysqlQueryMock = class {
|
|
|
13900
13905
|
packageName: "mysql",
|
|
13901
13906
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
13902
13907
|
submoduleName: "query",
|
|
13903
|
-
kind: import_src$
|
|
13908
|
+
kind: import_src$26.SpanKind.CLIENT,
|
|
13904
13909
|
stackTrace
|
|
13905
13910
|
},
|
|
13906
13911
|
tuskDrift: this.tuskDrift
|
|
@@ -13910,7 +13915,7 @@ var TdMysqlQueryMock = class {
|
|
|
13910
13915
|
|
|
13911
13916
|
//#endregion
|
|
13912
13917
|
//#region src/instrumentation/libraries/mysql/Instrumentation.ts
|
|
13913
|
-
var import_src$
|
|
13918
|
+
var import_src$25 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
13914
13919
|
var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
13915
13920
|
constructor(config = {}) {
|
|
13916
13921
|
super("mysql", config);
|
|
@@ -14153,7 +14158,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14153
14158
|
replayModeHandler: () => {
|
|
14154
14159
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
14155
14160
|
name: "mysql.query",
|
|
14156
|
-
kind: import_src$
|
|
14161
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14157
14162
|
submodule: "query",
|
|
14158
14163
|
packageType: PackageType.MYSQL,
|
|
14159
14164
|
packageName: "mysql",
|
|
@@ -14179,7 +14184,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14179
14184
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14180
14185
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
14181
14186
|
name: "mysql.query",
|
|
14182
|
-
kind: import_src$
|
|
14187
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14183
14188
|
submodule: "query",
|
|
14184
14189
|
packageType: PackageType.MYSQL,
|
|
14185
14190
|
packageName: "mysql",
|
|
@@ -14190,7 +14195,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14190
14195
|
return self._handleRecordQuery(spanInfo, originalQuery, this, args, callback, isEventEmitterMode);
|
|
14191
14196
|
});
|
|
14192
14197
|
},
|
|
14193
|
-
spanKind: import_src$
|
|
14198
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14194
14199
|
});
|
|
14195
14200
|
else return originalQuery.apply(this, args);
|
|
14196
14201
|
};
|
|
@@ -14221,7 +14226,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14221
14226
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14222
14227
|
return originalConnect.apply(this, arguments);
|
|
14223
14228
|
},
|
|
14224
|
-
spanKind: import_src$
|
|
14229
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14225
14230
|
});
|
|
14226
14231
|
else return originalConnect.apply(this, arguments);
|
|
14227
14232
|
};
|
|
@@ -14246,7 +14251,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14246
14251
|
replayModeHandler: () => {
|
|
14247
14252
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(this, arguments), {
|
|
14248
14253
|
name: "mysql.beginTransaction",
|
|
14249
|
-
kind: import_src$
|
|
14254
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14250
14255
|
submodule: "transaction",
|
|
14251
14256
|
packageType: PackageType.MYSQL,
|
|
14252
14257
|
packageName: "mysql",
|
|
@@ -14263,7 +14268,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14263
14268
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14264
14269
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(this, arguments), {
|
|
14265
14270
|
name: "mysql.beginTransaction",
|
|
14266
|
-
kind: import_src$
|
|
14271
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14267
14272
|
submodule: "transaction",
|
|
14268
14273
|
packageType: PackageType.MYSQL,
|
|
14269
14274
|
packageName: "mysql",
|
|
@@ -14274,7 +14279,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14274
14279
|
return self._handleRecordTransaction(spanInfo, originalBeginTransaction, this, arguments, actualCallback);
|
|
14275
14280
|
});
|
|
14276
14281
|
},
|
|
14277
|
-
spanKind: import_src$
|
|
14282
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14278
14283
|
});
|
|
14279
14284
|
else return originalBeginTransaction.apply(this, arguments);
|
|
14280
14285
|
};
|
|
@@ -14299,7 +14304,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14299
14304
|
replayModeHandler: () => {
|
|
14300
14305
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(this, arguments), {
|
|
14301
14306
|
name: "mysql.commit",
|
|
14302
|
-
kind: import_src$
|
|
14307
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14303
14308
|
submodule: "transaction",
|
|
14304
14309
|
packageType: PackageType.MYSQL,
|
|
14305
14310
|
packageName: "mysql",
|
|
@@ -14316,7 +14321,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14316
14321
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14317
14322
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(this, arguments), {
|
|
14318
14323
|
name: "mysql.commit",
|
|
14319
|
-
kind: import_src$
|
|
14324
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14320
14325
|
submodule: "transaction",
|
|
14321
14326
|
packageType: PackageType.MYSQL,
|
|
14322
14327
|
packageName: "mysql",
|
|
@@ -14327,7 +14332,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14327
14332
|
return self._handleRecordTransaction(spanInfo, originalCommit, this, arguments, actualCallback);
|
|
14328
14333
|
});
|
|
14329
14334
|
},
|
|
14330
|
-
spanKind: import_src$
|
|
14335
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14331
14336
|
});
|
|
14332
14337
|
else return originalCommit.apply(this, arguments);
|
|
14333
14338
|
};
|
|
@@ -14352,7 +14357,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14352
14357
|
replayModeHandler: () => {
|
|
14353
14358
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(this, arguments), {
|
|
14354
14359
|
name: "mysql.rollback",
|
|
14355
|
-
kind: import_src$
|
|
14360
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14356
14361
|
submodule: "transaction",
|
|
14357
14362
|
packageType: PackageType.MYSQL,
|
|
14358
14363
|
packageName: "mysql",
|
|
@@ -14369,7 +14374,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14369
14374
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14370
14375
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(this, arguments), {
|
|
14371
14376
|
name: "mysql.rollback",
|
|
14372
|
-
kind: import_src$
|
|
14377
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14373
14378
|
submodule: "transaction",
|
|
14374
14379
|
packageType: PackageType.MYSQL,
|
|
14375
14380
|
packageName: "mysql",
|
|
@@ -14380,7 +14385,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14380
14385
|
return self._handleRecordTransaction(spanInfo, originalRollback, this, arguments, actualCallback);
|
|
14381
14386
|
});
|
|
14382
14387
|
},
|
|
14383
|
-
spanKind: import_src$
|
|
14388
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14384
14389
|
});
|
|
14385
14390
|
else return originalRollback.apply(this, arguments);
|
|
14386
14391
|
};
|
|
@@ -14407,7 +14412,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14407
14412
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14408
14413
|
return originalPing.apply(this, arguments);
|
|
14409
14414
|
},
|
|
14410
|
-
spanKind: import_src$
|
|
14415
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14411
14416
|
});
|
|
14412
14417
|
else return originalPing.apply(this, arguments);
|
|
14413
14418
|
};
|
|
@@ -14436,7 +14441,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14436
14441
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14437
14442
|
return originalEnd.apply(this, arguments);
|
|
14438
14443
|
},
|
|
14439
|
-
spanKind: import_src$
|
|
14444
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14440
14445
|
});
|
|
14441
14446
|
else return originalEnd.apply(this, arguments);
|
|
14442
14447
|
};
|
|
@@ -14465,7 +14470,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14465
14470
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14466
14471
|
return originalChangeUser.apply(this, arguments);
|
|
14467
14472
|
},
|
|
14468
|
-
spanKind: import_src$
|
|
14473
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14469
14474
|
});
|
|
14470
14475
|
else return originalChangeUser.apply(this, arguments);
|
|
14471
14476
|
};
|
|
@@ -14531,7 +14536,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14531
14536
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14532
14537
|
return originalEnd.apply(this, arguments);
|
|
14533
14538
|
},
|
|
14534
|
-
spanKind: import_src$
|
|
14539
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14535
14540
|
});
|
|
14536
14541
|
else return originalEnd.apply(this, arguments);
|
|
14537
14542
|
};
|
|
@@ -14554,7 +14559,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14554
14559
|
replayModeHandler: () => {
|
|
14555
14560
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
14556
14561
|
name: `mysql.pool.getConnection`,
|
|
14557
|
-
kind: import_src$
|
|
14562
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14558
14563
|
submodule: "getConnection",
|
|
14559
14564
|
packageName: "mysql",
|
|
14560
14565
|
packageType: PackageType.MYSQL,
|
|
@@ -14571,7 +14576,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14571
14576
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14572
14577
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
14573
14578
|
name: `mysql.pool.getConnection`,
|
|
14574
|
-
kind: import_src$
|
|
14579
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14575
14580
|
submodule: "getConnection",
|
|
14576
14581
|
packageName: "mysql",
|
|
14577
14582
|
packageType: PackageType.MYSQL,
|
|
@@ -14582,7 +14587,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14582
14587
|
return self._handleRecordPoolGetConnectionInSpan(spanInfo, originalGetConnection, callback, this);
|
|
14583
14588
|
});
|
|
14584
14589
|
},
|
|
14585
|
-
spanKind: import_src$
|
|
14590
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14586
14591
|
});
|
|
14587
14592
|
else return originalGetConnection.apply(this, [callback]);
|
|
14588
14593
|
};
|
|
@@ -14626,7 +14631,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14626
14631
|
replayModeHandler: () => {
|
|
14627
14632
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(connection, args), {
|
|
14628
14633
|
name: "mysql.query",
|
|
14629
|
-
kind: import_src$
|
|
14634
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14630
14635
|
submodule: "query",
|
|
14631
14636
|
packageType: PackageType.MYSQL,
|
|
14632
14637
|
packageName: "mysql",
|
|
@@ -14652,7 +14657,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14652
14657
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14653
14658
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(connection, args), {
|
|
14654
14659
|
name: "mysql.query",
|
|
14655
|
-
kind: import_src$
|
|
14660
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14656
14661
|
submodule: "query",
|
|
14657
14662
|
packageType: PackageType.MYSQL,
|
|
14658
14663
|
packageName: "mysql",
|
|
@@ -14663,7 +14668,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14663
14668
|
return self._handleRecordQuery(spanInfo, originalQuery, connection, args, callback, isEventEmitterMode);
|
|
14664
14669
|
});
|
|
14665
14670
|
},
|
|
14666
|
-
spanKind: import_src$
|
|
14671
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14667
14672
|
});
|
|
14668
14673
|
else return originalQuery.apply(connection, args);
|
|
14669
14674
|
};
|
|
@@ -14701,7 +14706,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14701
14706
|
};
|
|
14702
14707
|
if (error) try {
|
|
14703
14708
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14704
|
-
code: import_src$
|
|
14709
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14705
14710
|
message: error.message
|
|
14706
14711
|
});
|
|
14707
14712
|
} catch (error$1) {
|
|
@@ -14709,7 +14714,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14709
14714
|
}
|
|
14710
14715
|
else try {
|
|
14711
14716
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
14712
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14717
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14713
14718
|
} catch (error$1) {
|
|
14714
14719
|
logger.error(`[MysqlInstrumentation] error ending span:`, error$1);
|
|
14715
14720
|
}
|
|
@@ -14723,7 +14728,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14723
14728
|
queryObject._callback = function(err, results, fields) {
|
|
14724
14729
|
if (err) try {
|
|
14725
14730
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14726
|
-
code: import_src$
|
|
14731
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14727
14732
|
message: err.message
|
|
14728
14733
|
});
|
|
14729
14734
|
} catch (error) {
|
|
@@ -14735,7 +14740,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14735
14740
|
fields
|
|
14736
14741
|
};
|
|
14737
14742
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
14738
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14743
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14739
14744
|
} catch (error) {
|
|
14740
14745
|
logger.error(`[MysqlInstrumentation] error ending span:`, error);
|
|
14741
14746
|
}
|
|
@@ -14749,7 +14754,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14749
14754
|
args[callbackIndex] = function(err, results, fields) {
|
|
14750
14755
|
if (err) try {
|
|
14751
14756
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14752
|
-
code: import_src$
|
|
14757
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14753
14758
|
message: err.message
|
|
14754
14759
|
});
|
|
14755
14760
|
} catch (error) {
|
|
@@ -14761,7 +14766,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14761
14766
|
fields
|
|
14762
14767
|
};
|
|
14763
14768
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
14764
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14769
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14765
14770
|
} catch (error) {
|
|
14766
14771
|
logger.error(`[MysqlInstrumentation] error ending span:`, error);
|
|
14767
14772
|
}
|
|
@@ -14789,7 +14794,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14789
14794
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14790
14795
|
return originalConnect.apply(connection, arguments);
|
|
14791
14796
|
},
|
|
14792
|
-
spanKind: import_src$
|
|
14797
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14793
14798
|
});
|
|
14794
14799
|
else return originalConnect.apply(connection, arguments);
|
|
14795
14800
|
};
|
|
@@ -14811,7 +14816,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14811
14816
|
replayModeHandler: () => {
|
|
14812
14817
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(connection, arguments), {
|
|
14813
14818
|
name: "mysql.beginTransaction",
|
|
14814
|
-
kind: import_src$
|
|
14819
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14815
14820
|
submodule: "transaction",
|
|
14816
14821
|
packageType: PackageType.MYSQL,
|
|
14817
14822
|
packageName: "mysql",
|
|
@@ -14828,7 +14833,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14828
14833
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14829
14834
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(connection, arguments), {
|
|
14830
14835
|
name: "mysql.beginTransaction",
|
|
14831
|
-
kind: import_src$
|
|
14836
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14832
14837
|
submodule: "transaction",
|
|
14833
14838
|
packageType: PackageType.MYSQL,
|
|
14834
14839
|
packageName: "mysql",
|
|
@@ -14839,7 +14844,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14839
14844
|
return self._handleRecordTransaction(spanInfo, originalBeginTransaction, connection, arguments, actualCallback);
|
|
14840
14845
|
});
|
|
14841
14846
|
},
|
|
14842
|
-
spanKind: import_src$
|
|
14847
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14843
14848
|
});
|
|
14844
14849
|
else return originalBeginTransaction.apply(connection, arguments);
|
|
14845
14850
|
};
|
|
@@ -14861,7 +14866,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14861
14866
|
replayModeHandler: () => {
|
|
14862
14867
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(connection, arguments), {
|
|
14863
14868
|
name: "mysql.commit",
|
|
14864
|
-
kind: import_src$
|
|
14869
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14865
14870
|
submodule: "transaction",
|
|
14866
14871
|
packageType: PackageType.MYSQL,
|
|
14867
14872
|
packageName: "mysql",
|
|
@@ -14878,7 +14883,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14878
14883
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14879
14884
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(connection, arguments), {
|
|
14880
14885
|
name: "mysql.commit",
|
|
14881
|
-
kind: import_src$
|
|
14886
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14882
14887
|
submodule: "transaction",
|
|
14883
14888
|
packageType: PackageType.MYSQL,
|
|
14884
14889
|
packageName: "mysql",
|
|
@@ -14889,7 +14894,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14889
14894
|
return self._handleRecordTransaction(spanInfo, originalCommit, connection, arguments, actualCallback);
|
|
14890
14895
|
});
|
|
14891
14896
|
},
|
|
14892
|
-
spanKind: import_src$
|
|
14897
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14893
14898
|
});
|
|
14894
14899
|
else return originalCommit.apply(connection, arguments);
|
|
14895
14900
|
};
|
|
@@ -14911,7 +14916,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14911
14916
|
replayModeHandler: () => {
|
|
14912
14917
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(connection, arguments), {
|
|
14913
14918
|
name: "mysql.rollback",
|
|
14914
|
-
kind: import_src$
|
|
14919
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14915
14920
|
submodule: "transaction",
|
|
14916
14921
|
packageType: PackageType.MYSQL,
|
|
14917
14922
|
packageName: "mysql",
|
|
@@ -14928,7 +14933,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14928
14933
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14929
14934
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(connection, arguments), {
|
|
14930
14935
|
name: "mysql.rollback",
|
|
14931
|
-
kind: import_src$
|
|
14936
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14932
14937
|
submodule: "transaction",
|
|
14933
14938
|
packageType: PackageType.MYSQL,
|
|
14934
14939
|
packageName: "mysql",
|
|
@@ -14939,7 +14944,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14939
14944
|
return self._handleRecordTransaction(spanInfo, originalRollback, connection, arguments, actualCallback);
|
|
14940
14945
|
});
|
|
14941
14946
|
},
|
|
14942
|
-
spanKind: import_src$
|
|
14947
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14943
14948
|
});
|
|
14944
14949
|
else return originalRollback.apply(connection, arguments);
|
|
14945
14950
|
};
|
|
@@ -14950,7 +14955,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14950
14955
|
const result = originalFunction.apply(connection, args);
|
|
14951
14956
|
try {
|
|
14952
14957
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { status: "success" } });
|
|
14953
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14958
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14954
14959
|
} catch (error) {
|
|
14955
14960
|
logger.error(`[MysqlInstrumentation] error adding span attributes:`, error);
|
|
14956
14961
|
}
|
|
@@ -14958,7 +14963,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14958
14963
|
} catch (error) {
|
|
14959
14964
|
try {
|
|
14960
14965
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14961
|
-
code: import_src$
|
|
14966
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14962
14967
|
message: error.message
|
|
14963
14968
|
});
|
|
14964
14969
|
} catch (error$1) {
|
|
@@ -14973,7 +14978,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14973
14978
|
argsArray[callbackIndex] = function(err) {
|
|
14974
14979
|
if (err) try {
|
|
14975
14980
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14976
|
-
code: import_src$
|
|
14981
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14977
14982
|
message: err.message
|
|
14978
14983
|
});
|
|
14979
14984
|
} catch (error) {
|
|
@@ -14981,14 +14986,14 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14981
14986
|
}
|
|
14982
14987
|
else try {
|
|
14983
14988
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { status: "success" } });
|
|
14984
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14989
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14985
14990
|
} catch (error) {
|
|
14986
14991
|
logger.error(`[MysqlInstrumentation] error ending span:`, error);
|
|
14987
14992
|
}
|
|
14988
14993
|
logger.debug(`[MysqlInstrumentation] Transaction completed`);
|
|
14989
14994
|
return originalCallback.apply(this, arguments);
|
|
14990
14995
|
};
|
|
14991
|
-
argsArray[callbackIndex] = import_src$
|
|
14996
|
+
argsArray[callbackIndex] = import_src$25.context.bind(spanInfo.context, argsArray[callbackIndex]);
|
|
14992
14997
|
}
|
|
14993
14998
|
return originalFunction.apply(connection, argsArray);
|
|
14994
14999
|
}
|
|
@@ -15005,7 +15010,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15005
15010
|
if (error) {
|
|
15006
15011
|
logger.debug(`[MysqlInstrumentation] MySQL Pool getConnection error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
15007
15012
|
SpanUtils.endSpan(spanInfo.span, {
|
|
15008
|
-
code: import_src$
|
|
15013
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
15009
15014
|
message: error.message
|
|
15010
15015
|
});
|
|
15011
15016
|
} else {
|
|
@@ -15021,9 +15026,9 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15021
15026
|
connected: true,
|
|
15022
15027
|
hasConnection: !!connection
|
|
15023
15028
|
} });
|
|
15024
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
15029
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
15025
15030
|
}
|
|
15026
|
-
return import_src$
|
|
15031
|
+
return import_src$25.context.bind(spanInfo.context, callback)(error, connection);
|
|
15027
15032
|
};
|
|
15028
15033
|
return originalGetConnection.call(poolContext, wrappedCallback);
|
|
15029
15034
|
} else try {
|
|
@@ -15032,11 +15037,11 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15032
15037
|
connected: true,
|
|
15033
15038
|
hasConnection: true
|
|
15034
15039
|
} });
|
|
15035
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
15040
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
15036
15041
|
return result;
|
|
15037
15042
|
} catch (error) {
|
|
15038
15043
|
SpanUtils.endSpan(spanInfo.span, {
|
|
15039
|
-
code: import_src$
|
|
15044
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
15040
15045
|
message: error.message
|
|
15041
15046
|
});
|
|
15042
15047
|
throw error;
|
|
@@ -15113,7 +15118,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15113
15118
|
replayModeHandler: () => {
|
|
15114
15119
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalStream.apply(queryInstance, arguments), {
|
|
15115
15120
|
name: "mysql.stream",
|
|
15116
|
-
kind: import_src$
|
|
15121
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15117
15122
|
submodule: "stream",
|
|
15118
15123
|
packageType: PackageType.MYSQL,
|
|
15119
15124
|
packageName: "mysql",
|
|
@@ -15130,7 +15135,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15130
15135
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
15131
15136
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalStream.apply(queryInstance, arguments), {
|
|
15132
15137
|
name: "mysql.stream",
|
|
15133
|
-
kind: import_src$
|
|
15138
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15134
15139
|
submodule: "stream",
|
|
15135
15140
|
packageType: PackageType.MYSQL,
|
|
15136
15141
|
packageName: "mysql",
|
|
@@ -15141,7 +15146,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15141
15146
|
return self._handleRecordStream(spanInfo, originalStream, queryInstance, streamOptions);
|
|
15142
15147
|
});
|
|
15143
15148
|
},
|
|
15144
|
-
spanKind: import_src$
|
|
15149
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
15145
15150
|
});
|
|
15146
15151
|
else return originalStream.apply(queryInstance, arguments);
|
|
15147
15152
|
};
|
|
@@ -15214,7 +15219,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15214
15219
|
const isMultiStatementQuery = queryCount > 1;
|
|
15215
15220
|
if (error) try {
|
|
15216
15221
|
SpanUtils.endSpan(spanInfo.span, {
|
|
15217
|
-
code: import_src$
|
|
15222
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
15218
15223
|
message: error.message
|
|
15219
15224
|
});
|
|
15220
15225
|
} catch (err) {
|
|
@@ -15232,7 +15237,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15232
15237
|
queryCount
|
|
15233
15238
|
};
|
|
15234
15239
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
15235
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
15240
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
15236
15241
|
} catch (err) {
|
|
15237
15242
|
logger.error(`[MysqlInstrumentation] error ending span:`, err);
|
|
15238
15243
|
}
|
|
@@ -15341,7 +15346,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15341
15346
|
replayModeHandler: () => {
|
|
15342
15347
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
15343
15348
|
name: "mysql.query",
|
|
15344
|
-
kind: import_src$
|
|
15349
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15345
15350
|
submodule: "query",
|
|
15346
15351
|
packageType: PackageType.MYSQL,
|
|
15347
15352
|
packageName: "mysql",
|
|
@@ -15390,7 +15395,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15390
15395
|
replayModeHandler: () => {
|
|
15391
15396
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(namespace, [callback]), {
|
|
15392
15397
|
name: `mysql.poolNamespace.getConnection`,
|
|
15393
|
-
kind: import_src$
|
|
15398
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15394
15399
|
submodule: "getConnection",
|
|
15395
15400
|
packageName: "mysql",
|
|
15396
15401
|
packageType: PackageType.MYSQL,
|
|
@@ -15567,7 +15572,7 @@ var TdMysql2ConnectionMock = class extends events.EventEmitter {
|
|
|
15567
15572
|
|
|
15568
15573
|
//#endregion
|
|
15569
15574
|
//#region src/instrumentation/libraries/mysql2/mocks/TdMysql2QueryMock.ts
|
|
15570
|
-
var import_src$
|
|
15575
|
+
var import_src$24 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
15571
15576
|
/**
|
|
15572
15577
|
* Handles replay mode for MySQL2 query operations
|
|
15573
15578
|
*/
|
|
@@ -15664,7 +15669,7 @@ var TdMysql2QueryMock = class {
|
|
|
15664
15669
|
packageName: "mysql2",
|
|
15665
15670
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
15666
15671
|
submoduleName,
|
|
15667
|
-
kind: import_src$
|
|
15672
|
+
kind: import_src$24.SpanKind.CLIENT,
|
|
15668
15673
|
stackTrace
|
|
15669
15674
|
},
|
|
15670
15675
|
tuskDrift: this.tuskDrift
|
|
@@ -15691,7 +15696,7 @@ var TdMysql2QueryMock = class {
|
|
|
15691
15696
|
|
|
15692
15697
|
//#endregion
|
|
15693
15698
|
//#region src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionEventMock.ts
|
|
15694
|
-
var import_src$
|
|
15699
|
+
var import_src$23 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
15695
15700
|
/**
|
|
15696
15701
|
* Mock for MySQL2 connection events (connect/error)
|
|
15697
15702
|
* Handles replay of recorded connection establishment events in REPLAY mode
|
|
@@ -15720,7 +15725,7 @@ var TdMysql2ConnectionEventMock = class {
|
|
|
15720
15725
|
packageName: "mysql2",
|
|
15721
15726
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
15722
15727
|
submoduleName: "connectEvent",
|
|
15723
|
-
kind: import_src$
|
|
15728
|
+
kind: import_src$23.SpanKind.CLIENT
|
|
15724
15729
|
},
|
|
15725
15730
|
tuskDrift: this.tuskDrift
|
|
15726
15731
|
});
|
|
@@ -15738,7 +15743,7 @@ var TdMysql2ConnectionEventMock = class {
|
|
|
15738
15743
|
|
|
15739
15744
|
//#endregion
|
|
15740
15745
|
//#region src/instrumentation/libraries/mysql2/Instrumentation.ts
|
|
15741
|
-
var import_src$
|
|
15746
|
+
var import_src$22 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
15742
15747
|
const COMPLETE_SUPPORTED_VERSIONS = ">=2.3.3 <4.0.0";
|
|
15743
15748
|
const V2_3_3_TO_3_11_4 = ">=2.3.3 <3.11.5";
|
|
15744
15749
|
const V3_11_5_TO_4_0 = ">=3.11.5 <4.0.0";
|
|
@@ -15966,7 +15971,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
15966
15971
|
const spanName = `mysql2.${clientType}.query`;
|
|
15967
15972
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
15968
15973
|
name: spanName,
|
|
15969
|
-
kind: import_src$
|
|
15974
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
15970
15975
|
submodule: "query",
|
|
15971
15976
|
packageType: PackageType.MYSQL,
|
|
15972
15977
|
packageName: "mysql2",
|
|
@@ -15984,7 +15989,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
15984
15989
|
const spanName = `mysql2.${clientType}.query`;
|
|
15985
15990
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
15986
15991
|
name: spanName,
|
|
15987
|
-
kind: import_src$
|
|
15992
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
15988
15993
|
submodule: "query",
|
|
15989
15994
|
packageType: PackageType.MYSQL,
|
|
15990
15995
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -15995,7 +16000,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
15995
16000
|
return self._handleRecordQueryInSpan(spanInfo, originalQuery, queryConfig, args, this);
|
|
15996
16001
|
});
|
|
15997
16002
|
},
|
|
15998
|
-
spanKind: import_src$
|
|
16003
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
15999
16004
|
});
|
|
16000
16005
|
else return originalQuery.apply(this, args);
|
|
16001
16006
|
};
|
|
@@ -16031,7 +16036,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16031
16036
|
const spanName = `mysql2.${clientType}.execute`;
|
|
16032
16037
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExecute.apply(this, args), {
|
|
16033
16038
|
name: spanName,
|
|
16034
|
-
kind: import_src$
|
|
16039
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16035
16040
|
submodule: "execute",
|
|
16036
16041
|
packageType: PackageType.MYSQL,
|
|
16037
16042
|
packageName: "mysql2",
|
|
@@ -16049,7 +16054,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16049
16054
|
const spanName = `mysql2.${clientType}.execute`;
|
|
16050
16055
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExecute.apply(this, args), {
|
|
16051
16056
|
name: spanName,
|
|
16052
|
-
kind: import_src$
|
|
16057
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16053
16058
|
submodule: "execute",
|
|
16054
16059
|
packageType: PackageType.MYSQL,
|
|
16055
16060
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16060,7 +16065,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16060
16065
|
return self._handleRecordQueryInSpan(spanInfo, originalExecute, queryConfig, args, this);
|
|
16061
16066
|
});
|
|
16062
16067
|
},
|
|
16063
|
-
spanKind: import_src$
|
|
16068
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16064
16069
|
});
|
|
16065
16070
|
else return originalExecute.apply(this, args);
|
|
16066
16071
|
};
|
|
@@ -16079,7 +16084,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16079
16084
|
replayModeHandler: () => {
|
|
16080
16085
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
16081
16086
|
name: `mysql2.pool.getConnection`,
|
|
16082
|
-
kind: import_src$
|
|
16087
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16083
16088
|
submodule: "getConnection",
|
|
16084
16089
|
packageName: "mysql2",
|
|
16085
16090
|
packageType: PackageType.MYSQL,
|
|
@@ -16096,7 +16101,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16096
16101
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16097
16102
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
16098
16103
|
name: `mysql2.pool.getConnection`,
|
|
16099
|
-
kind: import_src$
|
|
16104
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16100
16105
|
submodule: "getConnection",
|
|
16101
16106
|
packageName: "mysql2",
|
|
16102
16107
|
packageType: PackageType.MYSQL,
|
|
@@ -16107,7 +16112,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16107
16112
|
return self._handleRecordPoolGetConnectionInSpan(spanInfo, originalGetConnection, callback, this);
|
|
16108
16113
|
});
|
|
16109
16114
|
},
|
|
16110
|
-
spanKind: import_src$
|
|
16115
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16111
16116
|
});
|
|
16112
16117
|
else return originalGetConnection.apply(this, [callback]);
|
|
16113
16118
|
};
|
|
@@ -16130,7 +16135,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16130
16135
|
replayModeHandler: () => {
|
|
16131
16136
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
16132
16137
|
name: `mysql2.${clientType}.connect`,
|
|
16133
|
-
kind: import_src$
|
|
16138
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16134
16139
|
submodule: "connect",
|
|
16135
16140
|
packageName: "mysql2",
|
|
16136
16141
|
packageType: PackageType.MYSQL,
|
|
@@ -16151,7 +16156,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16151
16156
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16152
16157
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
16153
16158
|
name: `mysql2.${clientType}.connect`,
|
|
16154
|
-
kind: import_src$
|
|
16159
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16155
16160
|
submodule: "connect",
|
|
16156
16161
|
packageName: "mysql2",
|
|
16157
16162
|
packageType: PackageType.MYSQL,
|
|
@@ -16162,7 +16167,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16162
16167
|
return self._handleSimpleCallbackMethod(spanInfo, originalConnect, callback, this);
|
|
16163
16168
|
});
|
|
16164
16169
|
},
|
|
16165
|
-
spanKind: import_src$
|
|
16170
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16166
16171
|
});
|
|
16167
16172
|
else return originalConnect.apply(this, [callback]);
|
|
16168
16173
|
};
|
|
@@ -16185,7 +16190,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16185
16190
|
replayModeHandler: () => {
|
|
16186
16191
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalPing.apply(this, [callback]), {
|
|
16187
16192
|
name: `mysql2.${clientType}.ping`,
|
|
16188
|
-
kind: import_src$
|
|
16193
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16189
16194
|
submodule: "ping",
|
|
16190
16195
|
packageName: "mysql2",
|
|
16191
16196
|
packageType: PackageType.MYSQL,
|
|
@@ -16206,7 +16211,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16206
16211
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16207
16212
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalPing.apply(this, [callback]), {
|
|
16208
16213
|
name: `mysql2.${clientType}.ping`,
|
|
16209
|
-
kind: import_src$
|
|
16214
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16210
16215
|
submodule: "ping",
|
|
16211
16216
|
packageName: "mysql2",
|
|
16212
16217
|
packageType: PackageType.MYSQL,
|
|
@@ -16217,7 +16222,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16217
16222
|
return self._handleSimpleCallbackMethod(spanInfo, originalPing, callback, this);
|
|
16218
16223
|
});
|
|
16219
16224
|
},
|
|
16220
|
-
spanKind: import_src$
|
|
16225
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16221
16226
|
});
|
|
16222
16227
|
else return originalPing.apply(this, [callback]);
|
|
16223
16228
|
};
|
|
@@ -16240,7 +16245,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16240
16245
|
replayModeHandler: () => {
|
|
16241
16246
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalEnd.apply(this, [callback]), {
|
|
16242
16247
|
name: `mysql2.${clientType}.end`,
|
|
16243
|
-
kind: import_src$
|
|
16248
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16244
16249
|
submodule: "end",
|
|
16245
16250
|
packageName: "mysql2",
|
|
16246
16251
|
packageType: PackageType.MYSQL,
|
|
@@ -16261,7 +16266,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16261
16266
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16262
16267
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalEnd.apply(this, [callback]), {
|
|
16263
16268
|
name: `mysql2.${clientType}.end`,
|
|
16264
|
-
kind: import_src$
|
|
16269
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16265
16270
|
submodule: "end",
|
|
16266
16271
|
packageName: "mysql2",
|
|
16267
16272
|
packageType: PackageType.MYSQL,
|
|
@@ -16272,7 +16277,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16272
16277
|
return self._handleSimpleCallbackMethod(spanInfo, originalEnd, callback, this);
|
|
16273
16278
|
});
|
|
16274
16279
|
},
|
|
16275
|
-
spanKind: import_src$
|
|
16280
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16276
16281
|
});
|
|
16277
16282
|
else return originalEnd.apply(this, [callback]);
|
|
16278
16283
|
};
|
|
@@ -16285,7 +16290,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16285
16290
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16286
16291
|
try {
|
|
16287
16292
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16288
|
-
code: import_src$
|
|
16293
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16289
16294
|
message: error.message
|
|
16290
16295
|
});
|
|
16291
16296
|
} catch (error$1) {
|
|
@@ -16295,7 +16300,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16295
16300
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16296
16301
|
try {
|
|
16297
16302
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { success: true } });
|
|
16298
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16303
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16299
16304
|
} catch (error$1) {
|
|
16300
16305
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error$1);
|
|
16301
16306
|
}
|
|
@@ -16309,7 +16314,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16309
16314
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16310
16315
|
try {
|
|
16311
16316
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { success: true } });
|
|
16312
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16317
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16313
16318
|
} catch (error) {
|
|
16314
16319
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error);
|
|
16315
16320
|
}
|
|
@@ -16317,7 +16322,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16317
16322
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16318
16323
|
try {
|
|
16319
16324
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16320
|
-
code: import_src$
|
|
16325
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16321
16326
|
message: error.message
|
|
16322
16327
|
});
|
|
16323
16328
|
} catch (error$1) {
|
|
@@ -16329,7 +16334,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16329
16334
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method completed (non-promise) (${SpanUtils.getTraceInfo()})`);
|
|
16330
16335
|
try {
|
|
16331
16336
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { success: true } });
|
|
16332
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16337
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16333
16338
|
} catch (error) {
|
|
16334
16339
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error);
|
|
16335
16340
|
}
|
|
@@ -16364,7 +16369,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16364
16369
|
logger.debug(`[Mysql2Instrumentation] MySQL2 query error (hasCallback): ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16365
16370
|
try {
|
|
16366
16371
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16367
|
-
code: import_src$
|
|
16372
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16368
16373
|
message: error.message
|
|
16369
16374
|
});
|
|
16370
16375
|
} catch (error$1) {
|
|
@@ -16374,7 +16379,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16374
16379
|
logger.debug(`[Mysql2Instrumentation] MySQL2 query completed successfully (hasCallback) (${SpanUtils.getTraceInfo()})`);
|
|
16375
16380
|
try {
|
|
16376
16381
|
this._addOutputAttributesToSpan(spanInfo, results, fields);
|
|
16377
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16382
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16378
16383
|
} catch (error$1) {
|
|
16379
16384
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error$1);
|
|
16380
16385
|
}
|
|
@@ -16404,7 +16409,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16404
16409
|
logger.debug(`[Mysql2Instrumentation] MySQL2 stream query error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16405
16410
|
try {
|
|
16406
16411
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16407
|
-
code: import_src$
|
|
16412
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16408
16413
|
message: error.message
|
|
16409
16414
|
});
|
|
16410
16415
|
} catch (error$1) {
|
|
@@ -16418,7 +16423,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16418
16423
|
logger.debug(`[Mysql2Instrumentation] MySQL2 stream query completed (${SpanUtils.getTraceInfo()})`);
|
|
16419
16424
|
try {
|
|
16420
16425
|
this._addOutputAttributesToSpan(spanInfo, streamResults, streamFields);
|
|
16421
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16426
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16422
16427
|
} catch (error) {
|
|
16423
16428
|
logger.error(`[Mysql2Instrumentation] error ending span:`, error);
|
|
16424
16429
|
}
|
|
@@ -16440,7 +16445,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16440
16445
|
logger.debug(`[Mysql2Instrumentation] MySQL2 Pool getConnection error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16441
16446
|
try {
|
|
16442
16447
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16443
|
-
code: import_src$
|
|
16448
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16444
16449
|
message: error.message
|
|
16445
16450
|
});
|
|
16446
16451
|
} catch (error$1) {
|
|
@@ -16453,7 +16458,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16453
16458
|
connected: true,
|
|
16454
16459
|
hasConnection: !!connection
|
|
16455
16460
|
} });
|
|
16456
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16461
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16457
16462
|
} catch (error$1) {
|
|
16458
16463
|
logger.error(`[Mysql2Instrumentation] error processing getConnection response:`, error$1);
|
|
16459
16464
|
}
|
|
@@ -16468,7 +16473,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16468
16473
|
connected: true,
|
|
16469
16474
|
hasConnection: !!connection
|
|
16470
16475
|
} });
|
|
16471
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16476
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16472
16477
|
} catch (error) {
|
|
16473
16478
|
logger.error(`[Mysql2Instrumentation] error processing getConnection response:`, error);
|
|
16474
16479
|
}
|
|
@@ -16477,7 +16482,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16477
16482
|
logger.debug(`[Mysql2Instrumentation] MySQL2 Pool getConnection error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16478
16483
|
try {
|
|
16479
16484
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16480
|
-
code: import_src$
|
|
16485
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16481
16486
|
message: error.message
|
|
16482
16487
|
});
|
|
16483
16488
|
} catch (error$1) {
|
|
@@ -16520,7 +16525,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16520
16525
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16521
16526
|
return SpanUtils.createAndExecuteSpan(self.mode, () => new OriginalConnection(...args), {
|
|
16522
16527
|
name: `mysql2.connection.create`,
|
|
16523
|
-
kind: import_src$
|
|
16528
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16524
16529
|
submodule: "connectEvent",
|
|
16525
16530
|
packageType: PackageType.MYSQL,
|
|
16526
16531
|
packageName: "mysql2",
|
|
@@ -16535,7 +16540,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16535
16540
|
connected: true,
|
|
16536
16541
|
connectionObj
|
|
16537
16542
|
} });
|
|
16538
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16543
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16539
16544
|
} catch {
|
|
16540
16545
|
logger.error(`[Mysql2Instrumentation] error adding span attributes:`);
|
|
16541
16546
|
}
|
|
@@ -16544,7 +16549,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16544
16549
|
try {
|
|
16545
16550
|
logger.debug(`[Mysql2Instrumentation] Connection error, recording: ${err.message}`);
|
|
16546
16551
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16547
|
-
code: import_src$
|
|
16552
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16548
16553
|
message: err.message
|
|
16549
16554
|
});
|
|
16550
16555
|
} catch {
|
|
@@ -16554,7 +16559,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16554
16559
|
return connection;
|
|
16555
16560
|
});
|
|
16556
16561
|
},
|
|
16557
|
-
spanKind: import_src$
|
|
16562
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16558
16563
|
});
|
|
16559
16564
|
if (self.mode === TuskDriftMode.REPLAY) return handleReplayMode({
|
|
16560
16565
|
noOpRequestHandler: () => {
|
|
@@ -16564,7 +16569,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16564
16569
|
replayModeHandler: () => {
|
|
16565
16570
|
return SpanUtils.createAndExecuteSpan(self.mode, () => new OriginalConnection(...args), {
|
|
16566
16571
|
name: `mysql2.connection.create`,
|
|
16567
|
-
kind: import_src$
|
|
16572
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16568
16573
|
submodule: "connectEvent",
|
|
16569
16574
|
packageType: PackageType.MYSQL,
|
|
16570
16575
|
packageName: "mysql2",
|
|
@@ -16643,7 +16648,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16643
16648
|
|
|
16644
16649
|
//#endregion
|
|
16645
16650
|
//#region src/instrumentation/libraries/tcp/Instrumentation.ts
|
|
16646
|
-
var import_src$
|
|
16651
|
+
var import_src$21 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
16647
16652
|
/**
|
|
16648
16653
|
* TCP Instrumentation for Tusk Drift
|
|
16649
16654
|
*
|
|
@@ -16730,7 +16735,7 @@ var TcpInstrumentation = class extends TdInstrumentationBase {
|
|
|
16730
16735
|
const currentSpanInfo = SpanUtils.getCurrentSpanInfo();
|
|
16731
16736
|
if (!currentSpanInfo) return originalMethod.apply(socketContext, args);
|
|
16732
16737
|
const callingLibrary = currentSpanInfo.context.getValue(CALLING_LIBRARY_CONTEXT_KEY);
|
|
16733
|
-
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) === import_src$
|
|
16738
|
+
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) === import_src$21.SpanKind.SERVER && callingLibrary !== "ProtobufCommunicator") this._logUnpatchedDependency(methodName, currentSpanInfo, socketContext);
|
|
16734
16739
|
return originalMethod.apply(socketContext, args);
|
|
16735
16740
|
}
|
|
16736
16741
|
_isHttpResponseSocket(socketContext) {
|
|
@@ -16740,7 +16745,7 @@ var TcpInstrumentation = class extends TdInstrumentationBase {
|
|
|
16740
16745
|
|
|
16741
16746
|
//#endregion
|
|
16742
16747
|
//#region src/instrumentation/libraries/jsonwebtoken/Instrumentation.ts
|
|
16743
|
-
var import_src$
|
|
16748
|
+
var import_src$20 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
16744
16749
|
var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
16745
16750
|
constructor(config = {}) {
|
|
16746
16751
|
super("jsonwebtoken", config);
|
|
@@ -16820,7 +16825,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16820
16825
|
replayModeHandler: () => {
|
|
16821
16826
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalVerify.apply(this, args), {
|
|
16822
16827
|
name: "jsonwebtoken.verify",
|
|
16823
|
-
kind: import_src$
|
|
16828
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16824
16829
|
submodule: "verify",
|
|
16825
16830
|
packageName: "jsonwebtoken",
|
|
16826
16831
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16836,7 +16841,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16836
16841
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16837
16842
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalVerify.apply(this, args), {
|
|
16838
16843
|
name: "jsonwebtoken.verify",
|
|
16839
|
-
kind: import_src$
|
|
16844
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16840
16845
|
submodule: "verify",
|
|
16841
16846
|
packageName: "jsonwebtoken",
|
|
16842
16847
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16846,7 +16851,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16846
16851
|
return self._handleRecordVerifyInSpan(spanInfo, originalVerify, verifyConfig, args, this);
|
|
16847
16852
|
});
|
|
16848
16853
|
},
|
|
16849
|
-
spanKind: import_src$
|
|
16854
|
+
spanKind: import_src$20.SpanKind.CLIENT
|
|
16850
16855
|
});
|
|
16851
16856
|
else return originalVerify.apply(this, args);
|
|
16852
16857
|
};
|
|
@@ -16884,7 +16889,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16884
16889
|
replayModeHandler: () => {
|
|
16885
16890
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSign.apply(this, args), {
|
|
16886
16891
|
name: "jsonwebtoken.sign",
|
|
16887
|
-
kind: import_src$
|
|
16892
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16888
16893
|
submodule: "sign",
|
|
16889
16894
|
packageName: "jsonwebtoken",
|
|
16890
16895
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16900,7 +16905,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16900
16905
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16901
16906
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSign.apply(this, args), {
|
|
16902
16907
|
name: "jsonwebtoken.sign",
|
|
16903
|
-
kind: import_src$
|
|
16908
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16904
16909
|
submodule: "sign",
|
|
16905
16910
|
packageName: "jsonwebtoken",
|
|
16906
16911
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16910,7 +16915,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16910
16915
|
return self._handleRecordSignInSpan(spanInfo, originalSign, signConfig, args, this);
|
|
16911
16916
|
});
|
|
16912
16917
|
},
|
|
16913
|
-
spanKind: import_src$
|
|
16918
|
+
spanKind: import_src$20.SpanKind.CLIENT
|
|
16914
16919
|
});
|
|
16915
16920
|
else return originalSign.apply(this, args);
|
|
16916
16921
|
};
|
|
@@ -16949,7 +16954,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16949
16954
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16950
16955
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
16951
16956
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16952
|
-
code: import_src$
|
|
16957
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
16953
16958
|
message: error.message
|
|
16954
16959
|
});
|
|
16955
16960
|
} catch (error$1) {
|
|
@@ -16958,7 +16963,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16958
16963
|
else try {
|
|
16959
16964
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16960
16965
|
this._addOutputAttributesToSpan(spanInfo, decoded);
|
|
16961
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16966
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
16962
16967
|
} catch (error$1) {
|
|
16963
16968
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error$1);
|
|
16964
16969
|
}
|
|
@@ -16976,7 +16981,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16976
16981
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify sync error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16977
16982
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
16978
16983
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16979
|
-
code: import_src$
|
|
16984
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
16980
16985
|
message: error.message
|
|
16981
16986
|
});
|
|
16982
16987
|
} catch (error$1) {
|
|
@@ -16989,7 +16994,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16989
16994
|
try {
|
|
16990
16995
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16991
16996
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
16992
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16997
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
16993
16998
|
} catch (error) {
|
|
16994
16999
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error);
|
|
16995
17000
|
}
|
|
@@ -16999,7 +17004,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16999
17004
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
17000
17005
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
17001
17006
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17002
|
-
code: import_src$
|
|
17007
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
17003
17008
|
message: error.message
|
|
17004
17009
|
});
|
|
17005
17010
|
} catch (error$1) {
|
|
@@ -17016,7 +17021,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17016
17021
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
17017
17022
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
17018
17023
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17019
|
-
code: import_src$
|
|
17024
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
17020
17025
|
message: error.message
|
|
17021
17026
|
});
|
|
17022
17027
|
} catch (error$1) {
|
|
@@ -17025,7 +17030,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17025
17030
|
else try {
|
|
17026
17031
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
17027
17032
|
this._addOutputAttributesToSpan(spanInfo, token);
|
|
17028
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
17033
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
17029
17034
|
} catch (error$1) {
|
|
17030
17035
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error$1);
|
|
17031
17036
|
}
|
|
@@ -17042,7 +17047,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17042
17047
|
try {
|
|
17043
17048
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
17044
17049
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
17045
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
17050
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
17046
17051
|
} catch (error) {
|
|
17047
17052
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error);
|
|
17048
17053
|
}
|
|
@@ -17052,7 +17057,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17052
17057
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
17053
17058
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
17054
17059
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17055
|
-
code: import_src$
|
|
17060
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
17056
17061
|
message: error.message
|
|
17057
17062
|
});
|
|
17058
17063
|
} catch (error$1) {
|
|
@@ -17061,9 +17066,9 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17061
17066
|
throw error;
|
|
17062
17067
|
}
|
|
17063
17068
|
}
|
|
17064
|
-
|
|
17069
|
+
handleReplayVerify(verifyConfig, inputValue, spanInfo, stackTrace) {
|
|
17065
17070
|
logger.debug(`[JsonwebtokenInstrumentation] Replaying JWT verify`);
|
|
17066
|
-
const mockData =
|
|
17071
|
+
const mockData = findMockResponseSync({
|
|
17067
17072
|
mockRequestData: {
|
|
17068
17073
|
traceId: spanInfo.traceId,
|
|
17069
17074
|
spanId: spanInfo.spanId,
|
|
@@ -17072,7 +17077,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17072
17077
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
17073
17078
|
submoduleName: "verify",
|
|
17074
17079
|
inputValue,
|
|
17075
|
-
kind: import_src$
|
|
17080
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
17076
17081
|
stackTrace
|
|
17077
17082
|
},
|
|
17078
17083
|
tuskDrift: this.tuskDrift
|
|
@@ -17104,9 +17109,9 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17104
17109
|
return;
|
|
17105
17110
|
} else return result;
|
|
17106
17111
|
}
|
|
17107
|
-
|
|
17112
|
+
handleReplaySign(signConfig, inputValue, spanInfo, stackTrace) {
|
|
17108
17113
|
logger.debug(`[JsonwebtokenInstrumentation] Replaying JWT sign`);
|
|
17109
|
-
const mockData =
|
|
17114
|
+
const mockData = findMockResponseSync({
|
|
17110
17115
|
mockRequestData: {
|
|
17111
17116
|
traceId: spanInfo?.traceId,
|
|
17112
17117
|
spanId: spanInfo?.spanId,
|
|
@@ -17115,7 +17120,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17115
17120
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
17116
17121
|
submoduleName: "sign",
|
|
17117
17122
|
inputValue,
|
|
17118
|
-
kind: import_src$
|
|
17123
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
17119
17124
|
stackTrace
|
|
17120
17125
|
},
|
|
17121
17126
|
tuskDrift: this.tuskDrift
|
|
@@ -17217,7 +17222,7 @@ var JwksRsaInstrumentation = class extends TdInstrumentationBase {
|
|
|
17217
17222
|
|
|
17218
17223
|
//#endregion
|
|
17219
17224
|
//#region src/instrumentation/libraries/fetch/FetchTransformEngine.ts
|
|
17220
|
-
var import_src$
|
|
17225
|
+
var import_src$19 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
17221
17226
|
/**
|
|
17222
17227
|
* Creates an empty FetchInputValue object for dropped spans
|
|
17223
17228
|
*/
|
|
@@ -17292,7 +17297,7 @@ var FetchTransformEngine = class {
|
|
|
17292
17297
|
}
|
|
17293
17298
|
compileMatcher(matcher) {
|
|
17294
17299
|
const checks = [];
|
|
17295
|
-
checks.push((span) => span.kind === import_src$
|
|
17300
|
+
checks.push((span) => span.kind === import_src$19.SpanKind.CLIENT);
|
|
17296
17301
|
if (matcher.method) if (matcher.method.length === 0) {} else {
|
|
17297
17302
|
const methods = matcher.method.map((method) => method.toUpperCase());
|
|
17298
17303
|
checks.push((span) => {
|
|
@@ -17488,7 +17493,7 @@ var FetchTransformEngine = class {
|
|
|
17488
17493
|
|
|
17489
17494
|
//#endregion
|
|
17490
17495
|
//#region src/instrumentation/libraries/fetch/Instrumentation.ts
|
|
17491
|
-
var import_src$
|
|
17496
|
+
var import_src$18 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
17492
17497
|
/**
|
|
17493
17498
|
* Fetch API instrumentation for capturing requests made via fetch()
|
|
17494
17499
|
* This covers libraries like @octokit/rest, axios (when using fetch adapter), etc.
|
|
@@ -17550,7 +17555,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17550
17555
|
replayModeHandler: () => {
|
|
17551
17556
|
return SpanUtils.createAndExecuteSpan(this.mode, () => this.originalFetch(input, init), {
|
|
17552
17557
|
name: url,
|
|
17553
|
-
kind: import_src$
|
|
17558
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17554
17559
|
packageName: "fetch",
|
|
17555
17560
|
packageType: PackageType.HTTP,
|
|
17556
17561
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
@@ -17565,14 +17570,14 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17565
17570
|
else if (this.mode === TuskDriftMode.RECORD) return handleRecordMode({
|
|
17566
17571
|
originalFunctionCall: () => this.originalFetch(input, init),
|
|
17567
17572
|
recordModeHandler: ({ isPreAppStart }) => this._handleRecordFetch(input, inputValue, isPreAppStart, init),
|
|
17568
|
-
spanKind: import_src$
|
|
17573
|
+
spanKind: import_src$18.SpanKind.CLIENT
|
|
17569
17574
|
});
|
|
17570
17575
|
else return this.originalFetch(input, init);
|
|
17571
17576
|
}
|
|
17572
17577
|
_handleRecordFetch(input, inputValue, isPreAppStart, init) {
|
|
17573
17578
|
return SpanUtils.createAndExecuteSpan(this.mode, () => this.originalFetch(input, init), {
|
|
17574
17579
|
name: inputValue.url,
|
|
17575
|
-
kind: import_src$
|
|
17580
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17576
17581
|
packageName: "fetch",
|
|
17577
17582
|
packageType: PackageType.HTTP,
|
|
17578
17583
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
@@ -17601,7 +17606,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17601
17606
|
const spanData = {
|
|
17602
17607
|
traceId: spanInfo.traceId,
|
|
17603
17608
|
spanId: spanInfo.spanId,
|
|
17604
|
-
kind: import_src$
|
|
17609
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17605
17610
|
inputValue,
|
|
17606
17611
|
outputValue
|
|
17607
17612
|
};
|
|
@@ -17618,10 +17623,10 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17618
17623
|
},
|
|
17619
17624
|
...spanData.transformMetadata && { transformMetadata: spanData.transformMetadata }
|
|
17620
17625
|
});
|
|
17621
|
-
const status = response.status >=
|
|
17622
|
-
code: import_src$
|
|
17626
|
+
const status = response.status >= 300 ? {
|
|
17627
|
+
code: import_src$18.SpanStatusCode.ERROR,
|
|
17623
17628
|
message: `HTTP ${response.status}`
|
|
17624
|
-
} : { code: import_src$
|
|
17629
|
+
} : { code: import_src$18.SpanStatusCode.OK };
|
|
17625
17630
|
SpanUtils.endSpan(spanInfo.span, status);
|
|
17626
17631
|
} catch (error) {
|
|
17627
17632
|
logger.error(`[FetchInstrumentation] error processing response body:`, error);
|
|
@@ -17630,7 +17635,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17630
17635
|
}).catch((error) => {
|
|
17631
17636
|
try {
|
|
17632
17637
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17633
|
-
code: import_src$
|
|
17638
|
+
code: import_src$18.SpanStatusCode.ERROR,
|
|
17634
17639
|
message: error.message
|
|
17635
17640
|
});
|
|
17636
17641
|
} catch (error$1) {
|
|
@@ -17651,7 +17656,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17651
17656
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
17652
17657
|
submoduleName: inputValue.method,
|
|
17653
17658
|
inputValue,
|
|
17654
|
-
kind: import_src$
|
|
17659
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17655
17660
|
stackTrace
|
|
17656
17661
|
},
|
|
17657
17662
|
tuskDrift: this.tuskDrift,
|
|
@@ -17817,10 +17822,23 @@ function convertValueToJsonable(value) {
|
|
|
17817
17822
|
encoding: BufferEncoding.NONE
|
|
17818
17823
|
};
|
|
17819
17824
|
}
|
|
17825
|
+
/**
|
|
17826
|
+
* Recursively deserialize Buffer objects from JSON representation.
|
|
17827
|
+
* Converts {"type":"Buffer","data":[...]} back to actual Buffer instances.
|
|
17828
|
+
* This handles the format produced by JSON.stringify(Buffer).
|
|
17829
|
+
*/
|
|
17830
|
+
function deserializeBufferValue(value) {
|
|
17831
|
+
if (!value || typeof value !== "object") return value;
|
|
17832
|
+
if (value.type === "Buffer" && Array.isArray(value.data)) return Buffer.from(value.data);
|
|
17833
|
+
if (Array.isArray(value)) return value.map((item) => deserializeBufferValue(item));
|
|
17834
|
+
const result = {};
|
|
17835
|
+
for (const key of Object.keys(value)) result[key] = deserializeBufferValue(value[key]);
|
|
17836
|
+
return result;
|
|
17837
|
+
}
|
|
17820
17838
|
|
|
17821
17839
|
//#endregion
|
|
17822
17840
|
//#region src/instrumentation/libraries/ioredis/Instrumentation.ts
|
|
17823
|
-
var import_src$
|
|
17841
|
+
var import_src$17 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
17824
17842
|
const SUPPORTED_VERSIONS$1 = [">=4.11.0 <5", "5.*"];
|
|
17825
17843
|
var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
17826
17844
|
constructor(config = {}) {
|
|
@@ -17938,7 +17956,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17938
17956
|
replayModeHandler: () => {
|
|
17939
17957
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSendCommand.apply(this, arguments), {
|
|
17940
17958
|
name: `ioredis.${commandName}`,
|
|
17941
|
-
kind: import_src$
|
|
17959
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
17942
17960
|
submodule: commandName,
|
|
17943
17961
|
packageType: PackageType.REDIS,
|
|
17944
17962
|
packageName: "ioredis",
|
|
@@ -17955,7 +17973,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17955
17973
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
17956
17974
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSendCommand.apply(this, arguments), {
|
|
17957
17975
|
name: `ioredis.${commandName}`,
|
|
17958
|
-
kind: import_src$
|
|
17976
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
17959
17977
|
submodule: commandName,
|
|
17960
17978
|
packageType: PackageType.REDIS,
|
|
17961
17979
|
packageName: "ioredis",
|
|
@@ -17966,7 +17984,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17966
17984
|
return self._handleRecordSendCommand(spanInfo, originalSendCommand, cmd, this);
|
|
17967
17985
|
});
|
|
17968
17986
|
},
|
|
17969
|
-
spanKind: import_src$
|
|
17987
|
+
spanKind: import_src$17.SpanKind.CLIENT
|
|
17970
17988
|
});
|
|
17971
17989
|
else return originalSendCommand.apply(this, arguments);
|
|
17972
17990
|
};
|
|
@@ -17991,7 +18009,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17991
18009
|
replayModeHandler: () => {
|
|
17992
18010
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, arguments), {
|
|
17993
18011
|
name: "ioredis.connect",
|
|
17994
|
-
kind: import_src$
|
|
18012
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
17995
18013
|
submodule: "connect",
|
|
17996
18014
|
packageType: PackageType.REDIS,
|
|
17997
18015
|
packageName: "ioredis",
|
|
@@ -18008,7 +18026,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18008
18026
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18009
18027
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, arguments), {
|
|
18010
18028
|
name: "ioredis.connect",
|
|
18011
|
-
kind: import_src$
|
|
18029
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18012
18030
|
submodule: "connect",
|
|
18013
18031
|
packageType: PackageType.REDIS,
|
|
18014
18032
|
packageName: "ioredis",
|
|
@@ -18019,7 +18037,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18019
18037
|
return self._handleRecordConnect(spanInfo, originalConnect, this);
|
|
18020
18038
|
});
|
|
18021
18039
|
},
|
|
18022
|
-
spanKind: import_src$
|
|
18040
|
+
spanKind: import_src$17.SpanKind.CLIENT
|
|
18023
18041
|
});
|
|
18024
18042
|
else return originalConnect.apply(this, arguments);
|
|
18025
18043
|
};
|
|
@@ -18067,7 +18085,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18067
18085
|
replayModeHandler: () => {
|
|
18068
18086
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExec.apply(this, args), {
|
|
18069
18087
|
name: "ioredis.pipeline.exec",
|
|
18070
|
-
kind: import_src$
|
|
18088
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18071
18089
|
submodule: "pipeline-exec",
|
|
18072
18090
|
packageType: PackageType.REDIS,
|
|
18073
18091
|
packageName: "ioredis",
|
|
@@ -18084,7 +18102,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18084
18102
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18085
18103
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExec.apply(this, args), {
|
|
18086
18104
|
name: "ioredis.pipeline.exec",
|
|
18087
|
-
kind: import_src$
|
|
18105
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18088
18106
|
submodule: "pipeline-exec",
|
|
18089
18107
|
packageType: PackageType.REDIS,
|
|
18090
18108
|
packageName: "ioredis",
|
|
@@ -18095,7 +18113,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18095
18113
|
return self._handleRecordPipelineExec(spanInfo, originalExec, this, args);
|
|
18096
18114
|
});
|
|
18097
18115
|
},
|
|
18098
|
-
spanKind: import_src$
|
|
18116
|
+
spanKind: import_src$17.SpanKind.CLIENT
|
|
18099
18117
|
});
|
|
18100
18118
|
else return originalExec.apply(this, args);
|
|
18101
18119
|
};
|
|
@@ -18108,7 +18126,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18108
18126
|
logger.debug(`[IORedisInstrumentation] IORedis command ${cmd.name} completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
18109
18127
|
const outputValue = this._serializeOutput(result);
|
|
18110
18128
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
18111
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18129
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18112
18130
|
} catch (error) {
|
|
18113
18131
|
logger.error(`[IORedisInstrumentation] error processing command response:`, error);
|
|
18114
18132
|
}
|
|
@@ -18117,7 +18135,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18117
18135
|
try {
|
|
18118
18136
|
logger.debug(`[IORedisInstrumentation] IORedis command ${cmd.name} error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
18119
18137
|
SpanUtils.endSpan(spanInfo.span, {
|
|
18120
|
-
code: import_src$
|
|
18138
|
+
code: import_src$17.SpanStatusCode.ERROR,
|
|
18121
18139
|
message: error.message
|
|
18122
18140
|
});
|
|
18123
18141
|
} catch (spanError) {
|
|
@@ -18138,7 +18156,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18138
18156
|
packageName: "ioredis",
|
|
18139
18157
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
18140
18158
|
submoduleName: cmd.name,
|
|
18141
|
-
kind: import_src$
|
|
18159
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18142
18160
|
stackTrace
|
|
18143
18161
|
},
|
|
18144
18162
|
tuskDrift: this.tuskDrift
|
|
@@ -18160,7 +18178,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18160
18178
|
try {
|
|
18161
18179
|
logger.debug(`[IORedisInstrumentation] IORedis connect completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
18162
18180
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
18163
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18181
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18164
18182
|
} catch {
|
|
18165
18183
|
logger.error(`[IORedisInstrumentation] error adding span attributes`);
|
|
18166
18184
|
}
|
|
@@ -18169,7 +18187,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18169
18187
|
try {
|
|
18170
18188
|
logger.debug(`[IORedisInstrumentation] IORedis connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
18171
18189
|
SpanUtils.endSpan(spanInfo.span, {
|
|
18172
|
-
code: import_src$
|
|
18190
|
+
code: import_src$17.SpanStatusCode.ERROR,
|
|
18173
18191
|
message: error.message
|
|
18174
18192
|
});
|
|
18175
18193
|
} catch {
|
|
@@ -18180,7 +18198,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18180
18198
|
try {
|
|
18181
18199
|
logger.debug(`[IORedisInstrumentation] IORedis connect completed (synchronous) (${SpanUtils.getTraceInfo()})`);
|
|
18182
18200
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
18183
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18201
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18184
18202
|
} catch {
|
|
18185
18203
|
logger.error(`[IORedisInstrumentation] error adding span attributes`);
|
|
18186
18204
|
}
|
|
@@ -18200,7 +18218,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18200
18218
|
logger.debug(`[IORedisInstrumentation] Pipeline exec completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
18201
18219
|
const outputValue = this._serializePipelineOutput(results);
|
|
18202
18220
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
18203
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18221
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18204
18222
|
} catch {
|
|
18205
18223
|
logger.error(`[IORedisInstrumentation] error adding span attributes`);
|
|
18206
18224
|
}
|
|
@@ -18209,7 +18227,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18209
18227
|
try {
|
|
18210
18228
|
logger.debug(`[IORedisInstrumentation] Pipeline exec error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
18211
18229
|
SpanUtils.endSpan(spanInfo.span, {
|
|
18212
|
-
code: import_src$
|
|
18230
|
+
code: import_src$17.SpanStatusCode.ERROR,
|
|
18213
18231
|
message: error.message
|
|
18214
18232
|
});
|
|
18215
18233
|
} catch {
|
|
@@ -18230,7 +18248,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18230
18248
|
packageName: "ioredis",
|
|
18231
18249
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
18232
18250
|
submoduleName: "pipeline-exec",
|
|
18233
|
-
kind: import_src$
|
|
18251
|
+
kind: import_src$17.SpanKind.CLIENT
|
|
18234
18252
|
},
|
|
18235
18253
|
tuskDrift: this.tuskDrift
|
|
18236
18254
|
});
|
|
@@ -18270,12 +18288,12 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18270
18288
|
}
|
|
18271
18289
|
_deserializePipelineOutput(outputValue) {
|
|
18272
18290
|
if (!outputValue) return [];
|
|
18273
|
-
return outputValue.value || outputValue;
|
|
18291
|
+
return deserializeBufferValue(outputValue.value || outputValue);
|
|
18274
18292
|
}
|
|
18275
18293
|
_deserializeOutput(outputValue) {
|
|
18276
18294
|
if (!outputValue) return;
|
|
18277
|
-
if (typeof outputValue !== "object" || !("value" in outputValue)) return outputValue;
|
|
18278
|
-
return outputValue.value;
|
|
18295
|
+
if (typeof outputValue !== "object" || !("value" in outputValue)) return deserializeBufferValue(outputValue);
|
|
18296
|
+
return deserializeBufferValue(outputValue.value);
|
|
18279
18297
|
}
|
|
18280
18298
|
_wrap(target, propertyName, wrapper) {
|
|
18281
18299
|
wrap(target, propertyName, wrapper);
|
|
@@ -18284,7 +18302,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18284
18302
|
|
|
18285
18303
|
//#endregion
|
|
18286
18304
|
//#region src/instrumentation/libraries/upstash-redis-js/Instrumentation.ts
|
|
18287
|
-
var import_src$
|
|
18305
|
+
var import_src$16 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
18288
18306
|
const SUPPORTED_VERSIONS = [">=1.0.0"];
|
|
18289
18307
|
const REDIS_COMMANDS = [
|
|
18290
18308
|
"get",
|
|
@@ -18541,7 +18559,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18541
18559
|
replayModeHandler: () => {
|
|
18542
18560
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalValue.apply(this === receiver ? target : this, args), {
|
|
18543
18561
|
name: operationName,
|
|
18544
|
-
kind: import_src$
|
|
18562
|
+
kind: import_src$16.SpanKind.CLIENT,
|
|
18545
18563
|
submodule: submoduleName,
|
|
18546
18564
|
packageType: PackageType.REDIS,
|
|
18547
18565
|
packageName: "@upstash/redis",
|
|
@@ -18558,7 +18576,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18558
18576
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18559
18577
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalValue.apply(this === receiver ? target : this, args), {
|
|
18560
18578
|
name: operationName,
|
|
18561
|
-
kind: import_src$
|
|
18579
|
+
kind: import_src$16.SpanKind.CLIENT,
|
|
18562
18580
|
submodule: submoduleName,
|
|
18563
18581
|
packageType: PackageType.REDIS,
|
|
18564
18582
|
packageName: "@upstash/redis",
|
|
@@ -18570,7 +18588,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18570
18588
|
return self._handleRecordCommand(spanInfo, originalValue, this === receiver ? target : this, args);
|
|
18571
18589
|
});
|
|
18572
18590
|
},
|
|
18573
|
-
spanKind: import_src$
|
|
18591
|
+
spanKind: import_src$16.SpanKind.CLIENT
|
|
18574
18592
|
});
|
|
18575
18593
|
else return originalValue.apply(this === receiver ? target : this, args);
|
|
18576
18594
|
};
|
|
@@ -18585,7 +18603,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18585
18603
|
const outputValue = { result };
|
|
18586
18604
|
try {
|
|
18587
18605
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
18588
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18606
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$16.SpanStatusCode.OK });
|
|
18589
18607
|
} catch (error) {
|
|
18590
18608
|
logger.error(`[UpstashRedisInstrumentation] Error adding span attributes: ${error}`);
|
|
18591
18609
|
}
|
|
@@ -18593,7 +18611,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18593
18611
|
} catch (error) {
|
|
18594
18612
|
logger.debug(`[UpstashRedisInstrumentation] Command error: ${error}`);
|
|
18595
18613
|
try {
|
|
18596
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18614
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$16.SpanStatusCode.ERROR });
|
|
18597
18615
|
} catch (error$1) {
|
|
18598
18616
|
logger.error(`[UpstashRedisInstrumentation] Error ending span: ${error$1}`);
|
|
18599
18617
|
}
|
|
@@ -18611,7 +18629,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18611
18629
|
packageName: "@upstash/redis",
|
|
18612
18630
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
18613
18631
|
submoduleName,
|
|
18614
|
-
kind: import_src$
|
|
18632
|
+
kind: import_src$16.SpanKind.CLIENT,
|
|
18615
18633
|
stackTrace
|
|
18616
18634
|
},
|
|
18617
18635
|
tuskDrift: this.tuskDrift
|
|
@@ -18784,7 +18802,7 @@ function deepClone(obj) {
|
|
|
18784
18802
|
|
|
18785
18803
|
//#endregion
|
|
18786
18804
|
//#region src/instrumentation/libraries/grpc/Instrumentation.ts
|
|
18787
|
-
var import_src$
|
|
18805
|
+
var import_src$15 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
18788
18806
|
const GRPC_MODULE_NAME = "@grpc/grpc-js";
|
|
18789
18807
|
var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBase {
|
|
18790
18808
|
constructor(config = {}) {
|
|
@@ -18935,7 +18953,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
18935
18953
|
replayModeHandler: () => {
|
|
18936
18954
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
18937
18955
|
name: "grpc.client.unary",
|
|
18938
|
-
kind: import_src$
|
|
18956
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
18939
18957
|
submodule: "client",
|
|
18940
18958
|
packageType: PackageType.GRPC,
|
|
18941
18959
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -18952,7 +18970,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
18952
18970
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18953
18971
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
18954
18972
|
name: "grpc.client.unary",
|
|
18955
|
-
kind: import_src$
|
|
18973
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
18956
18974
|
submodule: "client",
|
|
18957
18975
|
packageType: PackageType.GRPC,
|
|
18958
18976
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -18963,7 +18981,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
18963
18981
|
return self._handleRecordUnaryRequest(spanInfo, original, this, parsedParams, callback);
|
|
18964
18982
|
});
|
|
18965
18983
|
},
|
|
18966
|
-
spanKind: import_src$
|
|
18984
|
+
spanKind: import_src$15.SpanKind.CLIENT
|
|
18967
18985
|
});
|
|
18968
18986
|
else return original.apply(this, args);
|
|
18969
18987
|
};
|
|
@@ -19029,7 +19047,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19029
19047
|
replayModeHandler: () => {
|
|
19030
19048
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
19031
19049
|
name: "grpc.client.server_stream",
|
|
19032
|
-
kind: import_src$
|
|
19050
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
19033
19051
|
submodule: "client",
|
|
19034
19052
|
packageType: PackageType.GRPC,
|
|
19035
19053
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -19046,7 +19064,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19046
19064
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19047
19065
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
19048
19066
|
name: "grpc.client.server_stream",
|
|
19049
|
-
kind: import_src$
|
|
19067
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
19050
19068
|
submodule: "client",
|
|
19051
19069
|
packageType: PackageType.GRPC,
|
|
19052
19070
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -19057,7 +19075,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19057
19075
|
return self._handleRecordServerStreamRequest(spanInfo, original, this, parsedParams);
|
|
19058
19076
|
});
|
|
19059
19077
|
},
|
|
19060
|
-
spanKind: import_src$
|
|
19078
|
+
spanKind: import_src$15.SpanKind.CLIENT
|
|
19061
19079
|
});
|
|
19062
19080
|
else return original.apply(this, args);
|
|
19063
19081
|
};
|
|
@@ -19140,7 +19158,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19140
19158
|
status,
|
|
19141
19159
|
bufferMap: responseBufferMap,
|
|
19142
19160
|
jsonableStringMap: responseJsonableStringMap
|
|
19143
|
-
}, import_src$
|
|
19161
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19144
19162
|
else if (isStatusEmitted && hasErrorOccurred) completeSpan({
|
|
19145
19163
|
error: {
|
|
19146
19164
|
message: serviceError.message,
|
|
@@ -19149,7 +19167,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19149
19167
|
},
|
|
19150
19168
|
status,
|
|
19151
19169
|
metadata: responseMetadataInitial
|
|
19152
|
-
}, import_src$
|
|
19170
|
+
}, import_src$15.SpanStatusCode.ERROR, serviceError.message);
|
|
19153
19171
|
} catch (e) {
|
|
19154
19172
|
logger.error(`[GrpcInstrumentation] Error in patchedCallback:`, e);
|
|
19155
19173
|
}
|
|
@@ -19181,7 +19199,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19181
19199
|
status,
|
|
19182
19200
|
bufferMap: responseBufferMap,
|
|
19183
19201
|
jsonableStringMap: responseJsonableStringMap
|
|
19184
|
-
}, import_src$
|
|
19202
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19185
19203
|
else if (hasErrorOccurred) completeSpan({
|
|
19186
19204
|
error: {
|
|
19187
19205
|
message: serviceError.message,
|
|
@@ -19190,7 +19208,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19190
19208
|
},
|
|
19191
19209
|
status,
|
|
19192
19210
|
metadata: responseMetadataInitial
|
|
19193
|
-
}, import_src$
|
|
19211
|
+
}, import_src$15.SpanStatusCode.ERROR, serviceError.message);
|
|
19194
19212
|
});
|
|
19195
19213
|
return result;
|
|
19196
19214
|
}
|
|
@@ -19214,7 +19232,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19214
19232
|
packageType: PackageType.GRPC,
|
|
19215
19233
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
19216
19234
|
submoduleName: "client",
|
|
19217
|
-
kind: import_src$
|
|
19235
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
19218
19236
|
stackTrace
|
|
19219
19237
|
},
|
|
19220
19238
|
tuskDrift: this.tuskDrift
|
|
@@ -19318,14 +19336,14 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19318
19336
|
status,
|
|
19319
19337
|
bufferMap: {},
|
|
19320
19338
|
jsonableStringMap: {}
|
|
19321
|
-
}, import_src$
|
|
19339
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19322
19340
|
else if (!hasErrorOccurred && streamResponses.length === 0) completeSpan({
|
|
19323
19341
|
body: [],
|
|
19324
19342
|
metadata: responseMetadataInitial,
|
|
19325
19343
|
status,
|
|
19326
19344
|
bufferMap: {},
|
|
19327
19345
|
jsonableStringMap: {}
|
|
19328
|
-
}, import_src$
|
|
19346
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19329
19347
|
else if (hasErrorOccurred) completeSpan({
|
|
19330
19348
|
error: {
|
|
19331
19349
|
message: serviceError.message,
|
|
@@ -19334,7 +19352,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19334
19352
|
},
|
|
19335
19353
|
status,
|
|
19336
19354
|
metadata: responseMetadataInitial
|
|
19337
|
-
}, import_src$
|
|
19355
|
+
}, import_src$15.SpanStatusCode.ERROR, serviceError.message);
|
|
19338
19356
|
});
|
|
19339
19357
|
return stream$1;
|
|
19340
19358
|
}
|
|
@@ -19359,7 +19377,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19359
19377
|
packageType: PackageType.GRPC,
|
|
19360
19378
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
19361
19379
|
submoduleName: "client",
|
|
19362
|
-
kind: import_src$
|
|
19380
|
+
kind: import_src$15.SpanKind.CLIENT
|
|
19363
19381
|
},
|
|
19364
19382
|
tuskDrift: this.tuskDrift
|
|
19365
19383
|
}).then((mockData) => {
|
|
@@ -19631,7 +19649,7 @@ var TdFirestoreWriteResultMock = class {
|
|
|
19631
19649
|
|
|
19632
19650
|
//#endregion
|
|
19633
19651
|
//#region src/instrumentation/libraries/firestore/Instrumentation.ts
|
|
19634
|
-
var import_src$
|
|
19652
|
+
var import_src$14 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
19635
19653
|
const FIRESTORE_VERSION = "7.*";
|
|
19636
19654
|
const PACKAGE_NAME = "@google-cloud/firestore";
|
|
19637
19655
|
var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
@@ -19739,7 +19757,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19739
19757
|
replayModeHandler: () => {
|
|
19740
19758
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
19741
19759
|
name: "firestore.document.get",
|
|
19742
|
-
kind: import_src$
|
|
19760
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19743
19761
|
submodule: "document",
|
|
19744
19762
|
packageType: PackageType.FIRESTORE,
|
|
19745
19763
|
packageName: PACKAGE_NAME,
|
|
@@ -19757,7 +19775,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19757
19775
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19758
19776
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
19759
19777
|
name: "firestore.document.get",
|
|
19760
|
-
kind: import_src$
|
|
19778
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19761
19779
|
submodule: "document",
|
|
19762
19780
|
packageType: PackageType.FIRESTORE,
|
|
19763
19781
|
packageName: PACKAGE_NAME,
|
|
@@ -19769,7 +19787,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19769
19787
|
return self._handleRecordDocumentGet(spanInfo, originalGet, this);
|
|
19770
19788
|
});
|
|
19771
19789
|
},
|
|
19772
|
-
spanKind: import_src$
|
|
19790
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19773
19791
|
});
|
|
19774
19792
|
else return originalGet.call(this);
|
|
19775
19793
|
};
|
|
@@ -19797,7 +19815,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19797
19815
|
};
|
|
19798
19816
|
try {
|
|
19799
19817
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: documentResult });
|
|
19800
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
19818
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
19801
19819
|
} catch {
|
|
19802
19820
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for document.get`);
|
|
19803
19821
|
}
|
|
@@ -19814,7 +19832,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19814
19832
|
packageName: PACKAGE_NAME,
|
|
19815
19833
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
19816
19834
|
submoduleName: "document",
|
|
19817
|
-
kind: import_src$
|
|
19835
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
19818
19836
|
},
|
|
19819
19837
|
tuskDrift: this.tuskDrift
|
|
19820
19838
|
});
|
|
@@ -19846,7 +19864,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19846
19864
|
replayModeHandler: () => {
|
|
19847
19865
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCreate.call(this, data), {
|
|
19848
19866
|
name: "firestore.document.create",
|
|
19849
|
-
kind: import_src$
|
|
19867
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19850
19868
|
submodule: "document",
|
|
19851
19869
|
packageType: PackageType.FIRESTORE,
|
|
19852
19870
|
packageName: PACKAGE_NAME,
|
|
@@ -19864,7 +19882,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19864
19882
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19865
19883
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCreate.call(this, data), {
|
|
19866
19884
|
name: "firestore.document.create",
|
|
19867
|
-
kind: import_src$
|
|
19885
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19868
19886
|
submodule: "document",
|
|
19869
19887
|
packageType: PackageType.FIRESTORE,
|
|
19870
19888
|
packageName: PACKAGE_NAME,
|
|
@@ -19876,7 +19894,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19876
19894
|
return self._handleRecordDocumentWrite(spanInfo, originalCreate, this, data);
|
|
19877
19895
|
});
|
|
19878
19896
|
},
|
|
19879
|
-
spanKind: import_src$
|
|
19897
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19880
19898
|
});
|
|
19881
19899
|
else return originalCreate.call(this, data);
|
|
19882
19900
|
};
|
|
@@ -19904,7 +19922,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19904
19922
|
replayModeHandler: () => {
|
|
19905
19923
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSet.call(this, data, options), {
|
|
19906
19924
|
name: "firestore.document.set",
|
|
19907
|
-
kind: import_src$
|
|
19925
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19908
19926
|
submodule: "document",
|
|
19909
19927
|
packageType: PackageType.FIRESTORE,
|
|
19910
19928
|
packageName: PACKAGE_NAME,
|
|
@@ -19922,7 +19940,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19922
19940
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19923
19941
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSet.call(this, data, options), {
|
|
19924
19942
|
name: "firestore.document.set",
|
|
19925
|
-
kind: import_src$
|
|
19943
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19926
19944
|
submodule: "document",
|
|
19927
19945
|
packageType: PackageType.FIRESTORE,
|
|
19928
19946
|
packageName: PACKAGE_NAME,
|
|
@@ -19934,7 +19952,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19934
19952
|
return self._handleRecordDocumentWrite(spanInfo, originalSet, this, data, options);
|
|
19935
19953
|
});
|
|
19936
19954
|
},
|
|
19937
|
-
spanKind: import_src$
|
|
19955
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19938
19956
|
});
|
|
19939
19957
|
else return originalSet.call(this, data, options);
|
|
19940
19958
|
};
|
|
@@ -19961,7 +19979,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19961
19979
|
replayModeHandler: () => {
|
|
19962
19980
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalUpdate.apply(this, args), {
|
|
19963
19981
|
name: "firestore.document.update",
|
|
19964
|
-
kind: import_src$
|
|
19982
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19965
19983
|
submodule: "document",
|
|
19966
19984
|
packageType: PackageType.FIRESTORE,
|
|
19967
19985
|
packageName: PACKAGE_NAME,
|
|
@@ -19979,7 +19997,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19979
19997
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19980
19998
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalUpdate.apply(this, args), {
|
|
19981
19999
|
name: "firestore.document.update",
|
|
19982
|
-
kind: import_src$
|
|
20000
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19983
20001
|
submodule: "document",
|
|
19984
20002
|
packageType: PackageType.FIRESTORE,
|
|
19985
20003
|
packageName: PACKAGE_NAME,
|
|
@@ -19991,7 +20009,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19991
20009
|
return self._handleRecordDocumentWrite(spanInfo, originalUpdate, this, ...args);
|
|
19992
20010
|
});
|
|
19993
20011
|
},
|
|
19994
|
-
spanKind: import_src$
|
|
20012
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19995
20013
|
});
|
|
19996
20014
|
else return originalUpdate.apply(this, args);
|
|
19997
20015
|
};
|
|
@@ -20018,7 +20036,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20018
20036
|
replayModeHandler: () => {
|
|
20019
20037
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalDelete.call(this, precondition), {
|
|
20020
20038
|
name: "firestore.document.delete",
|
|
20021
|
-
kind: import_src$
|
|
20039
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20022
20040
|
submodule: "document",
|
|
20023
20041
|
packageType: PackageType.FIRESTORE,
|
|
20024
20042
|
packageName: PACKAGE_NAME,
|
|
@@ -20036,7 +20054,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20036
20054
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20037
20055
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalDelete.call(this, precondition), {
|
|
20038
20056
|
name: "firestore.document.delete",
|
|
20039
|
-
kind: import_src$
|
|
20057
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20040
20058
|
submodule: "document",
|
|
20041
20059
|
packageType: PackageType.FIRESTORE,
|
|
20042
20060
|
packageName: PACKAGE_NAME,
|
|
@@ -20048,7 +20066,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20048
20066
|
return self._handleRecordDocumentWrite(spanInfo, originalDelete, this, precondition);
|
|
20049
20067
|
});
|
|
20050
20068
|
},
|
|
20051
|
-
spanKind: import_src$
|
|
20069
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20052
20070
|
});
|
|
20053
20071
|
else return originalDelete.call(this, precondition);
|
|
20054
20072
|
};
|
|
@@ -20062,7 +20080,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20062
20080
|
} : void 0 };
|
|
20063
20081
|
try {
|
|
20064
20082
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: result });
|
|
20065
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20083
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20066
20084
|
} catch {
|
|
20067
20085
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for document.write`);
|
|
20068
20086
|
}
|
|
@@ -20079,7 +20097,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20079
20097
|
packageName: PACKAGE_NAME,
|
|
20080
20098
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20081
20099
|
submoduleName: "document",
|
|
20082
|
-
kind: import_src$
|
|
20100
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20083
20101
|
},
|
|
20084
20102
|
tuskDrift: this.tuskDrift
|
|
20085
20103
|
});
|
|
@@ -20111,7 +20129,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20111
20129
|
replayModeHandler: () => {
|
|
20112
20130
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalAdd.call(this, data), {
|
|
20113
20131
|
name: "firestore.collection.add",
|
|
20114
|
-
kind: import_src$
|
|
20132
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20115
20133
|
submodule: "collection",
|
|
20116
20134
|
packageType: PackageType.FIRESTORE,
|
|
20117
20135
|
packageName: PACKAGE_NAME,
|
|
@@ -20129,7 +20147,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20129
20147
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20130
20148
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalAdd.call(this, data), {
|
|
20131
20149
|
name: "firestore.collection.add",
|
|
20132
|
-
kind: import_src$
|
|
20150
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20133
20151
|
submodule: "collection",
|
|
20134
20152
|
packageType: PackageType.FIRESTORE,
|
|
20135
20153
|
packageName: PACKAGE_NAME,
|
|
@@ -20141,7 +20159,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20141
20159
|
return self._handleRecordCollectionAdd(spanInfo, originalAdd, this, data);
|
|
20142
20160
|
});
|
|
20143
20161
|
},
|
|
20144
|
-
spanKind: import_src$
|
|
20162
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20145
20163
|
});
|
|
20146
20164
|
else return originalAdd.call(this, data);
|
|
20147
20165
|
};
|
|
@@ -20155,7 +20173,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20155
20173
|
};
|
|
20156
20174
|
try {
|
|
20157
20175
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: result });
|
|
20158
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20176
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20159
20177
|
} catch {
|
|
20160
20178
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for collection.add`);
|
|
20161
20179
|
}
|
|
@@ -20172,7 +20190,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20172
20190
|
packageName: PACKAGE_NAME,
|
|
20173
20191
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20174
20192
|
submoduleName: "collection",
|
|
20175
|
-
kind: import_src$
|
|
20193
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20176
20194
|
},
|
|
20177
20195
|
tuskDrift: this.tuskDrift
|
|
20178
20196
|
});
|
|
@@ -20205,7 +20223,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20205
20223
|
replayModeHandler: () => {
|
|
20206
20224
|
return SpanUtils.createAndExecuteSpan(self.mode, () => documentPath ? originalDoc.call(this, documentPath) : originalDoc.call(this), {
|
|
20207
20225
|
name: "firestore.collection.doc",
|
|
20208
|
-
kind: import_src$
|
|
20226
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20209
20227
|
submodule: "collection",
|
|
20210
20228
|
packageType: PackageType.FIRESTORE,
|
|
20211
20229
|
packageName: PACKAGE_NAME,
|
|
@@ -20223,7 +20241,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20223
20241
|
packageName: PACKAGE_NAME,
|
|
20224
20242
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
20225
20243
|
submoduleName: "collection",
|
|
20226
|
-
kind: import_src$
|
|
20244
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20227
20245
|
},
|
|
20228
20246
|
tuskDrift: self.tuskDrift
|
|
20229
20247
|
});
|
|
@@ -20244,7 +20262,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20244
20262
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20245
20263
|
return SpanUtils.createAndExecuteSpan(self.mode, () => documentPath ? originalDoc.call(this, documentPath) : originalDoc.call(this), {
|
|
20246
20264
|
name: "firestore.collection.doc",
|
|
20247
|
-
kind: import_src$
|
|
20265
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20248
20266
|
submodule: "collection",
|
|
20249
20267
|
packageType: PackageType.FIRESTORE,
|
|
20250
20268
|
packageName: PACKAGE_NAME,
|
|
@@ -20260,14 +20278,14 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20260
20278
|
};
|
|
20261
20279
|
try {
|
|
20262
20280
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: result });
|
|
20263
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20281
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20264
20282
|
} catch {
|
|
20265
20283
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for collection.doc`);
|
|
20266
20284
|
}
|
|
20267
20285
|
return docRef;
|
|
20268
20286
|
});
|
|
20269
20287
|
},
|
|
20270
|
-
spanKind: import_src$
|
|
20288
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20271
20289
|
});
|
|
20272
20290
|
else return documentPath ? originalDoc.call(this, documentPath) : originalDoc.call(this);
|
|
20273
20291
|
};
|
|
@@ -20293,7 +20311,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20293
20311
|
replayModeHandler: () => {
|
|
20294
20312
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
20295
20313
|
name: "firestore.query.get",
|
|
20296
|
-
kind: import_src$
|
|
20314
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20297
20315
|
submodule: "query",
|
|
20298
20316
|
packageType: PackageType.FIRESTORE,
|
|
20299
20317
|
packageName: PACKAGE_NAME,
|
|
@@ -20311,7 +20329,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20311
20329
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20312
20330
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
20313
20331
|
name: "firestore.query.get",
|
|
20314
|
-
kind: import_src$
|
|
20332
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20315
20333
|
submodule: "query",
|
|
20316
20334
|
packageType: PackageType.FIRESTORE,
|
|
20317
20335
|
packageName: PACKAGE_NAME,
|
|
@@ -20323,7 +20341,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20323
20341
|
return self._handleRecordQueryGet(spanInfo, originalGet, this);
|
|
20324
20342
|
});
|
|
20325
20343
|
},
|
|
20326
|
-
spanKind: import_src$
|
|
20344
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20327
20345
|
});
|
|
20328
20346
|
else return originalGet.call(this);
|
|
20329
20347
|
};
|
|
@@ -20359,7 +20377,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20359
20377
|
};
|
|
20360
20378
|
try {
|
|
20361
20379
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: queryResult });
|
|
20362
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20380
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20363
20381
|
} catch {
|
|
20364
20382
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for query.get`);
|
|
20365
20383
|
}
|
|
@@ -20376,7 +20394,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20376
20394
|
packageName: PACKAGE_NAME,
|
|
20377
20395
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20378
20396
|
submoduleName: "query",
|
|
20379
|
-
kind: import_src$
|
|
20397
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20380
20398
|
},
|
|
20381
20399
|
tuskDrift: this.tuskDrift
|
|
20382
20400
|
});
|
|
@@ -20399,7 +20417,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20399
20417
|
|
|
20400
20418
|
//#endregion
|
|
20401
20419
|
//#region src/instrumentation/libraries/nextjs/Instrumentation.ts
|
|
20402
|
-
var import_src$
|
|
20420
|
+
var import_src$13 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
20403
20421
|
var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
20404
20422
|
constructor(config = {}) {
|
|
20405
20423
|
super("nextjs", config);
|
|
@@ -20485,10 +20503,10 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20485
20503
|
logger.debug(`[NextjsInstrumentation] Setting replay trace id`, replayTraceId);
|
|
20486
20504
|
const ctxWithReplayTraceId = SpanUtils.setCurrentReplayTraceId(replayTraceId);
|
|
20487
20505
|
if (!ctxWithReplayTraceId) throw new Error("Error setting current replay trace id");
|
|
20488
|
-
return import_src$
|
|
20506
|
+
return import_src$13.context.with(ctxWithReplayTraceId, () => {
|
|
20489
20507
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalHandleRequest.call(this, req, res, parsedUrl), {
|
|
20490
20508
|
name: url,
|
|
20491
|
-
kind: import_src$
|
|
20509
|
+
kind: import_src$13.SpanKind.SERVER,
|
|
20492
20510
|
packageName: "nextjs",
|
|
20493
20511
|
submodule: method,
|
|
20494
20512
|
packageType: PackageType.HTTP,
|
|
@@ -20524,7 +20542,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20524
20542
|
};
|
|
20525
20543
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalHandleRequest.call(this, req, res, parsedUrl), {
|
|
20526
20544
|
name: url,
|
|
20527
|
-
kind: import_src$
|
|
20545
|
+
kind: import_src$13.SpanKind.SERVER,
|
|
20528
20546
|
packageName: "nextjs",
|
|
20529
20547
|
packageType: PackageType.HTTP,
|
|
20530
20548
|
submodule: method,
|
|
@@ -20544,7 +20562,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20544
20562
|
});
|
|
20545
20563
|
});
|
|
20546
20564
|
},
|
|
20547
|
-
spanKind: import_src$
|
|
20565
|
+
spanKind: import_src$13.SpanKind.SERVER
|
|
20548
20566
|
});
|
|
20549
20567
|
} else return originalHandleRequest.call(this, req, res, parsedUrl);
|
|
20550
20568
|
};
|
|
@@ -20552,8 +20570,8 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20552
20570
|
}
|
|
20553
20571
|
async _handleNextjsRequestInSpan({ req, res, parsedUrl, originalHandleRequest, spanInfo, inputValue, thisContext }) {
|
|
20554
20572
|
const self = this;
|
|
20555
|
-
import_src$
|
|
20556
|
-
import_src$
|
|
20573
|
+
import_src$13.context.bind(spanInfo.context, req);
|
|
20574
|
+
import_src$13.context.bind(spanInfo.context, res);
|
|
20557
20575
|
let completeInputValue = inputValue;
|
|
20558
20576
|
this._captureRequestBody(req, spanInfo, inputValue, (updatedInputValue) => {
|
|
20559
20577
|
completeInputValue = updatedInputValue;
|
|
@@ -20594,7 +20612,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20594
20612
|
logger.error(`[NextjsInstrumentation] Error in Next.js request: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20595
20613
|
try {
|
|
20596
20614
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20597
|
-
code: import_src$
|
|
20615
|
+
code: import_src$13.SpanStatusCode.ERROR,
|
|
20598
20616
|
message: error instanceof Error ? error.message : "Unknown error"
|
|
20599
20617
|
});
|
|
20600
20618
|
} catch (e) {
|
|
@@ -20639,10 +20657,10 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20639
20657
|
headers: { matchImportance: 0 }
|
|
20640
20658
|
}
|
|
20641
20659
|
});
|
|
20642
|
-
const status = (capturedStatusCode || 200) >=
|
|
20643
|
-
code: import_src$
|
|
20660
|
+
const status = (capturedStatusCode || 200) >= 300 ? {
|
|
20661
|
+
code: import_src$13.SpanStatusCode.ERROR,
|
|
20644
20662
|
message: `HTTP ${capturedStatusCode}`
|
|
20645
|
-
} : { code: import_src$
|
|
20663
|
+
} : { code: import_src$13.SpanStatusCode.OK };
|
|
20646
20664
|
SpanUtils.setStatus(spanInfo.span, status);
|
|
20647
20665
|
const decodedType = getDecodedType(outputValue.headers?.["content-type"] || "");
|
|
20648
20666
|
if (decodedType && !ACCEPTABLE_CONTENT_TYPES.has(decodedType)) {
|
|
@@ -20684,11 +20702,11 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20684
20702
|
outputSchemaHash: JsonSchemaHelper.generateDeterministicHash(outputSchema),
|
|
20685
20703
|
inputValueHash,
|
|
20686
20704
|
outputValueHash,
|
|
20687
|
-
kind: import_src$
|
|
20705
|
+
kind: import_src$13.SpanKind.SERVER,
|
|
20688
20706
|
packageType: PackageType.HTTP,
|
|
20689
20707
|
status: {
|
|
20690
|
-
code: (capturedStatusCode || 200) >=
|
|
20691
|
-
message: (capturedStatusCode || 200) >=
|
|
20708
|
+
code: (capturedStatusCode || 200) >= 300 ? StatusCode.ERROR : StatusCode.OK,
|
|
20709
|
+
message: (capturedStatusCode || 200) >= 300 ? `HTTP ${capturedStatusCode}` : ""
|
|
20692
20710
|
},
|
|
20693
20711
|
timestamp: {
|
|
20694
20712
|
seconds: Math.floor(now.getTime() / 1e3),
|
|
@@ -20710,7 +20728,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20710
20728
|
logger.error(`[NextjsInstrumentation] Error in Next.js request: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20711
20729
|
try {
|
|
20712
20730
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20713
|
-
code: import_src$
|
|
20731
|
+
code: import_src$13.SpanStatusCode.ERROR,
|
|
20714
20732
|
message: error instanceof Error ? error.message : "Unknown error"
|
|
20715
20733
|
});
|
|
20716
20734
|
} catch (e) {
|
|
@@ -20804,7 +20822,7 @@ let PrismaErrorClassName = /* @__PURE__ */ function(PrismaErrorClassName$1) {
|
|
|
20804
20822
|
|
|
20805
20823
|
//#endregion
|
|
20806
20824
|
//#region src/instrumentation/libraries/prisma/Instrumentation.ts
|
|
20807
|
-
var import_src$
|
|
20825
|
+
var import_src$12 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
20808
20826
|
var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
20809
20827
|
constructor(config = {}) {
|
|
20810
20828
|
super("@prisma/client", config);
|
|
@@ -20890,7 +20908,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20890
20908
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20891
20909
|
return SpanUtils.createAndExecuteSpan(this.mode, () => query(args), {
|
|
20892
20910
|
name: `prisma.${operation}`,
|
|
20893
|
-
kind: import_src$
|
|
20911
|
+
kind: import_src$12.SpanKind.CLIENT,
|
|
20894
20912
|
submodule: model,
|
|
20895
20913
|
packageType: PackageType.PRISMA,
|
|
20896
20914
|
packageName: "@prisma/client",
|
|
@@ -20901,7 +20919,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20901
20919
|
return this._handleRecordPrismaOperation(spanInfo, query, args);
|
|
20902
20920
|
});
|
|
20903
20921
|
},
|
|
20904
|
-
spanKind: import_src$
|
|
20922
|
+
spanKind: import_src$12.SpanKind.CLIENT
|
|
20905
20923
|
});
|
|
20906
20924
|
else if (this.mode === TuskDriftMode.REPLAY) {
|
|
20907
20925
|
const stackTrace = captureStackTrace(["PrismaInstrumentation"]);
|
|
@@ -20911,7 +20929,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20911
20929
|
replayModeHandler: () => {
|
|
20912
20930
|
return SpanUtils.createAndExecuteSpan(this.mode, () => query(args), {
|
|
20913
20931
|
name: `prisma.${operation}`,
|
|
20914
|
-
kind: import_src$
|
|
20932
|
+
kind: import_src$12.SpanKind.CLIENT,
|
|
20915
20933
|
submodule: model,
|
|
20916
20934
|
packageType: PackageType.PRISMA,
|
|
20917
20935
|
packageName: "@prisma/client",
|
|
@@ -20935,7 +20953,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20935
20953
|
};
|
|
20936
20954
|
try {
|
|
20937
20955
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
20938
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20956
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$12.SpanStatusCode.OK });
|
|
20939
20957
|
} catch (spanError) {
|
|
20940
20958
|
logger.error(`[PrismaInstrumentation] error adding span attributes:`, spanError);
|
|
20941
20959
|
}
|
|
@@ -20952,7 +20970,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20952
20970
|
};
|
|
20953
20971
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
20954
20972
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20955
|
-
code: import_src$
|
|
20973
|
+
code: import_src$12.SpanStatusCode.ERROR,
|
|
20956
20974
|
message: error.message
|
|
20957
20975
|
});
|
|
20958
20976
|
} catch (spanError) {
|
|
@@ -20971,7 +20989,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20971
20989
|
packageName: "@prisma/client",
|
|
20972
20990
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20973
20991
|
submoduleName: inputValue.model,
|
|
20974
|
-
kind: import_src$
|
|
20992
|
+
kind: import_src$12.SpanKind.CLIENT,
|
|
20975
20993
|
stackTrace
|
|
20976
20994
|
},
|
|
20977
20995
|
tuskDrift: this.tuskDrift
|
|
@@ -20989,12 +21007,12 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20989
21007
|
if (errorClass) Object.setPrototypeOf(errorObj, errorClass.prototype);
|
|
20990
21008
|
}
|
|
20991
21009
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20992
|
-
code: import_src$
|
|
21010
|
+
code: import_src$12.SpanStatusCode.ERROR,
|
|
20993
21011
|
message: errorObj.message || "Prisma error"
|
|
20994
21012
|
});
|
|
20995
21013
|
throw errorObj;
|
|
20996
21014
|
}
|
|
20997
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
21015
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$12.SpanStatusCode.OK });
|
|
20998
21016
|
return outputValue.prismaResult;
|
|
20999
21017
|
}
|
|
21000
21018
|
_getPrismaErrorClassName(error) {
|
|
@@ -25155,8 +25173,8 @@ var require_src$6 = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/co
|
|
|
25155
25173
|
|
|
25156
25174
|
//#endregion
|
|
25157
25175
|
//#region src/core/tracing/SpanTransformer.ts
|
|
25158
|
-
var import_src$
|
|
25159
|
-
var import_src$
|
|
25176
|
+
var import_src$10 = /* @__PURE__ */ __toESM(require_src$6(), 1);
|
|
25177
|
+
var import_src$11 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25160
25178
|
/**
|
|
25161
25179
|
* Utility class for transforming OpenTelemetry spans to CleanSpanData
|
|
25162
25180
|
*/
|
|
@@ -25167,7 +25185,7 @@ var SpanTransformer = class SpanTransformer {
|
|
|
25167
25185
|
* We use JSON because serialized protobuf is extremely verbose and not readable.
|
|
25168
25186
|
*/
|
|
25169
25187
|
static transformSpanToCleanJSON(span, environment) {
|
|
25170
|
-
const isRootSpan =
|
|
25188
|
+
const isRootSpan = span.kind === import_src$11.SpanKind.SERVER;
|
|
25171
25189
|
const attributes = span.attributes;
|
|
25172
25190
|
const packageName = SpanTransformer.extractPackageName(attributes);
|
|
25173
25191
|
const instrumentationName = SpanTransformer.extractInstrumentationName(span, attributes);
|
|
@@ -25287,11 +25305,11 @@ var FilesystemSpanAdapter = class {
|
|
|
25287
25305
|
fs.appendFileSync(filePath, jsonLine, "utf8");
|
|
25288
25306
|
}
|
|
25289
25307
|
logger.debug(`Exported ${spans.length} span(s) to trace-specific files in ${this.baseDirectory}`);
|
|
25290
|
-
return { code: import_src$
|
|
25308
|
+
return { code: import_src$10.ExportResultCode.SUCCESS };
|
|
25291
25309
|
} catch (error) {
|
|
25292
25310
|
logger.error(`Failed to export spans to local files:`, error);
|
|
25293
25311
|
return {
|
|
25294
|
-
code: import_src$
|
|
25312
|
+
code: import_src$10.ExportResultCode.FAILED,
|
|
25295
25313
|
error: error instanceof Error ? error : /* @__PURE__ */ new Error("Filesystem export failed")
|
|
25296
25314
|
};
|
|
25297
25315
|
}
|
|
@@ -25646,9 +25664,9 @@ var require_commonjs = /* @__PURE__ */ __commonJS({ "node_modules/@protobuf-ts/t
|
|
|
25646
25664
|
|
|
25647
25665
|
//#endregion
|
|
25648
25666
|
//#region src/core/tracing/adapters/ApiSpanAdapter.ts
|
|
25649
|
-
var import_src$
|
|
25667
|
+
var import_src$8 = /* @__PURE__ */ __toESM(require_src$6(), 1);
|
|
25650
25668
|
var import_commonjs$2 = /* @__PURE__ */ __toESM(require_commonjs(), 1);
|
|
25651
|
-
var import_src$
|
|
25669
|
+
var import_src$9 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25652
25670
|
const DRIFT_API_PATH = "/api/drift";
|
|
25653
25671
|
/**
|
|
25654
25672
|
* Exports spans to Tusk backend API via protobuf
|
|
@@ -25682,11 +25700,11 @@ var ApiSpanAdapter = class {
|
|
|
25682
25700
|
const response = await this.spanExportClient.exportSpans(request);
|
|
25683
25701
|
if (!response.response.success) throw new Error(`Remote export failed: ${response.response.message}`);
|
|
25684
25702
|
logger.debug(`Successfully exported ${spans.length} spans to remote endpoint`);
|
|
25685
|
-
return { code: import_src$
|
|
25703
|
+
return { code: import_src$8.ExportResultCode.SUCCESS };
|
|
25686
25704
|
} catch (error) {
|
|
25687
25705
|
logger.error(`Failed to export spans to remote:`, error);
|
|
25688
25706
|
return {
|
|
25689
|
-
code: import_src$
|
|
25707
|
+
code: import_src$8.ExportResultCode.FAILED,
|
|
25690
25708
|
error: error instanceof Error ? error : /* @__PURE__ */ new Error("API export failed")
|
|
25691
25709
|
};
|
|
25692
25710
|
}
|
|
@@ -25727,12 +25745,12 @@ var ApiSpanAdapter = class {
|
|
|
25727
25745
|
}
|
|
25728
25746
|
mapSpanKind(kind) {
|
|
25729
25747
|
switch (kind) {
|
|
25730
|
-
case import_src$
|
|
25731
|
-
case import_src$
|
|
25732
|
-
case import_src$
|
|
25733
|
-
case import_src$
|
|
25734
|
-
case import_src$
|
|
25735
|
-
default: return SpanKind$
|
|
25748
|
+
case import_src$9.SpanKind.CLIENT: return SpanKind$2.CLIENT;
|
|
25749
|
+
case import_src$9.SpanKind.SERVER: return SpanKind$2.SERVER;
|
|
25750
|
+
case import_src$9.SpanKind.PRODUCER: return SpanKind$2.PRODUCER;
|
|
25751
|
+
case import_src$9.SpanKind.CONSUMER: return SpanKind$2.CONSUMER;
|
|
25752
|
+
case import_src$9.SpanKind.INTERNAL: return SpanKind$2.INTERNAL;
|
|
25753
|
+
default: return SpanKind$2.UNSPECIFIED;
|
|
25736
25754
|
}
|
|
25737
25755
|
}
|
|
25738
25756
|
async shutdown() {
|
|
@@ -25743,6 +25761,8 @@ var ApiSpanAdapter = class {
|
|
|
25743
25761
|
//#endregion
|
|
25744
25762
|
//#region src/core/tracing/TdSpanExporter.ts
|
|
25745
25763
|
var import_src$5 = /* @__PURE__ */ __toESM(require_src$6(), 1);
|
|
25764
|
+
var import_src$6 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25765
|
+
var import_src$7 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25746
25766
|
var TdSpanExporter = class {
|
|
25747
25767
|
constructor(config) {
|
|
25748
25768
|
this.adapters = [];
|
|
@@ -25819,6 +25839,11 @@ var TdSpanExporter = class {
|
|
|
25819
25839
|
logger.debug(`Skipping span '${span.name}' (${span.spanContext().spanId}) - trace ${traceId} is blocked`);
|
|
25820
25840
|
return false;
|
|
25821
25841
|
}
|
|
25842
|
+
if (span.kind === import_src$7.SpanKind.SERVER && span.status.code === import_src$6.SpanStatusCode.ERROR) {
|
|
25843
|
+
traceBlockingManager.blockTrace(traceId);
|
|
25844
|
+
logger.debug(`Blocking trace ${traceId} - server span has error status`);
|
|
25845
|
+
return false;
|
|
25846
|
+
}
|
|
25822
25847
|
const inputValueString = span.attributes[TdSpanAttributes.INPUT_VALUE] || "";
|
|
25823
25848
|
const outputValueString = span.attributes[TdSpanAttributes.OUTPUT_VALUE] || "";
|
|
25824
25849
|
const estimatedTotalSize = Buffer.byteLength(inputValueString, "utf8") + Buffer.byteLength(outputValueString, "utf8") + 5e4;
|
|
@@ -32982,7 +33007,7 @@ var require_src = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/sdk-
|
|
|
32982
33007
|
//#endregion
|
|
32983
33008
|
//#region package.json
|
|
32984
33009
|
var import_src$1 = /* @__PURE__ */ __toESM(require_src(), 1);
|
|
32985
|
-
var version = "0.1.
|
|
33010
|
+
var version = "0.1.21";
|
|
32986
33011
|
|
|
32987
33012
|
//#endregion
|
|
32988
33013
|
//#region src/version.ts
|
|
@@ -34881,14 +34906,8 @@ var TuskDriftCore = class TuskDriftCore {
|
|
|
34881
34906
|
logger.debug(`Using TCP connection to CLI: ${mockHost}:${mockPort}`);
|
|
34882
34907
|
} else {
|
|
34883
34908
|
const socketPath = mockSocket || path.default.join(os.default.tmpdir(), "tusk-connect.sock");
|
|
34884
|
-
|
|
34885
|
-
|
|
34886
|
-
if (!fs.default.statSync(socketPath).isSocket()) throw new Error(`Path exists but is not a socket: ${socketPath}`);
|
|
34887
|
-
logger.debug("Socket found and verified at", socketPath);
|
|
34888
|
-
} catch (error) {
|
|
34889
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") throw new Error(`Socket not found at ${socketPath}. Make sure Tusk CLI is running.`);
|
|
34890
|
-
throw new Error(`Socket check failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
34891
|
-
}
|
|
34909
|
+
if (!fs.default.existsSync(socketPath)) throw new Error(`Socket not found at ${socketPath}. Make sure Tusk CLI is running.`);
|
|
34910
|
+
logger.debug("Socket found at", socketPath);
|
|
34892
34911
|
connectionInfo = { socketPath };
|
|
34893
34912
|
}
|
|
34894
34913
|
this.cliConnectionPromise = this.communicator.connect(connectionInfo, this.config.service?.id || "unknown").then(() => {
|