@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.js
CHANGED
|
@@ -151,7 +151,8 @@ function warn(suppress, message) {
|
|
|
151
151
|
*
|
|
152
152
|
* This function automatically configures Next.js to work with Tusk Drift by:
|
|
153
153
|
* - Enabling the Next.js instrumentation hook (for Next.js < 15.0.0-rc.1)
|
|
154
|
-
* - Configuring
|
|
154
|
+
* - Configuring server external packages to prevent bundling of core instrumentation packages
|
|
155
|
+
* - Supporting both webpack and Turbopack bundlers
|
|
155
156
|
* - Preserving your existing Next.js configuration and webpack customizations
|
|
156
157
|
*
|
|
157
158
|
* @param nextConfig - Your existing Next.js configuration object (optional)
|
|
@@ -186,9 +187,12 @@ function warn(suppress, message) {
|
|
|
186
187
|
* ```
|
|
187
188
|
*
|
|
188
189
|
* @remarks
|
|
189
|
-
* The following
|
|
190
|
+
* The following packages are added as server externals for both webpack and Turbopack:
|
|
190
191
|
* - `require-in-the-middle` - Required for CommonJS module interception
|
|
191
192
|
* - `jsonpath` - Required for schema manipulation
|
|
193
|
+
* - Additional packages when TUSK_DRIFT_MODE is RECORD or REPLAY (e.g., database clients, etc.)
|
|
194
|
+
*
|
|
195
|
+
* Works with both webpack (default) and Turbopack (`next dev --turbo`).
|
|
192
196
|
*/
|
|
193
197
|
function withTuskDrift(nextConfig = {}, options = {}) {
|
|
194
198
|
const config = nextConfig;
|
|
@@ -198,33 +202,34 @@ function withTuskDrift(nextConfig = {}, options = {}) {
|
|
|
198
202
|
if (nextjsVersion) debugLog(debug, `Detected Next.js version: ${nextjsVersion}`);
|
|
199
203
|
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.");
|
|
200
204
|
const needsInstrumentationHook = !options.disableInstrumentationHook && shouldSetInstrumentationHook(nextjsVersion);
|
|
205
|
+
const mode = process.env.TUSK_DRIFT_MODE?.toUpperCase();
|
|
206
|
+
const coreExternals = [
|
|
207
|
+
"require-in-the-middle",
|
|
208
|
+
"jsonpath",
|
|
209
|
+
...mode === "RECORD" || mode === "REPLAY" ? [
|
|
210
|
+
"@upstash/redis",
|
|
211
|
+
"ioredis",
|
|
212
|
+
"pg",
|
|
213
|
+
"postgres",
|
|
214
|
+
"mysql2",
|
|
215
|
+
"@prisma/client",
|
|
216
|
+
"@google-cloud/firestore",
|
|
217
|
+
"@grpc/grpc-js",
|
|
218
|
+
"graphql",
|
|
219
|
+
"jsonwebtoken",
|
|
220
|
+
"jwks-rsa"
|
|
221
|
+
] : []
|
|
222
|
+
];
|
|
201
223
|
const wrappedConfig = {
|
|
202
224
|
...config,
|
|
203
225
|
...needsInstrumentationHook ? { experimental: {
|
|
204
226
|
...config.experimental,
|
|
205
227
|
instrumentationHook: true
|
|
206
228
|
} } : { experimental: config.experimental },
|
|
229
|
+
serverExternalPackages: [...config.serverExternalPackages || [], ...coreExternals],
|
|
207
230
|
webpack: (webpackConfig, webpackOptions) => {
|
|
208
231
|
if (webpackOptions.isServer) {
|
|
209
232
|
const originalExternals = webpackConfig.externals;
|
|
210
|
-
const mode = process.env.TUSK_DRIFT_MODE?.toUpperCase();
|
|
211
|
-
const coreExternals = [
|
|
212
|
-
"require-in-the-middle",
|
|
213
|
-
"jsonpath",
|
|
214
|
-
...mode === "RECORD" || mode === "REPLAY" ? [
|
|
215
|
-
"@upstash/redis",
|
|
216
|
-
"ioredis",
|
|
217
|
-
"pg",
|
|
218
|
-
"postgres",
|
|
219
|
-
"mysql2",
|
|
220
|
-
"@prisma/client",
|
|
221
|
-
"@google-cloud/firestore",
|
|
222
|
-
"@grpc/grpc-js",
|
|
223
|
-
"graphql",
|
|
224
|
-
"jsonwebtoken",
|
|
225
|
-
"jwks-rsa"
|
|
226
|
-
] : []
|
|
227
|
-
];
|
|
228
233
|
const externalsMapping = {};
|
|
229
234
|
for (const pkg of coreExternals) {
|
|
230
235
|
externalsMapping[pkg] = `commonjs ${pkg}`;
|
|
@@ -4978,31 +4983,31 @@ var require_SamplingResult = /* @__PURE__ */ __commonJS({ "node_modules/@opentel
|
|
|
4978
4983
|
var require_span_kind = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/api/build/src/trace/span_kind.js": ((exports) => {
|
|
4979
4984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4980
4985
|
exports.SpanKind = void 0;
|
|
4981
|
-
(function(SpanKind$
|
|
4986
|
+
(function(SpanKind$27) {
|
|
4982
4987
|
/** Default value. Indicates that the span is used internally. */
|
|
4983
|
-
SpanKind$
|
|
4988
|
+
SpanKind$27[SpanKind$27["INTERNAL"] = 0] = "INTERNAL";
|
|
4984
4989
|
/**
|
|
4985
4990
|
* Indicates that the span covers server-side handling of an RPC or other
|
|
4986
4991
|
* remote request.
|
|
4987
4992
|
*/
|
|
4988
|
-
SpanKind$
|
|
4993
|
+
SpanKind$27[SpanKind$27["SERVER"] = 1] = "SERVER";
|
|
4989
4994
|
/**
|
|
4990
4995
|
* Indicates that the span covers the client-side wrapper around an RPC or
|
|
4991
4996
|
* other remote request.
|
|
4992
4997
|
*/
|
|
4993
|
-
SpanKind$
|
|
4998
|
+
SpanKind$27[SpanKind$27["CLIENT"] = 2] = "CLIENT";
|
|
4994
4999
|
/**
|
|
4995
5000
|
* Indicates that the span describes producer sending a message to a
|
|
4996
5001
|
* broker. Unlike client and server, there is no direct critical path latency
|
|
4997
5002
|
* relationship between producer and consumer spans.
|
|
4998
5003
|
*/
|
|
4999
|
-
SpanKind$
|
|
5004
|
+
SpanKind$27[SpanKind$27["PRODUCER"] = 3] = "PRODUCER";
|
|
5000
5005
|
/**
|
|
5001
5006
|
* Indicates that the span describes consumer receiving a message from a
|
|
5002
5007
|
* broker. Unlike client and server, there is no direct critical path latency
|
|
5003
5008
|
* relationship between producer and consumer spans.
|
|
5004
5009
|
*/
|
|
5005
|
-
SpanKind$
|
|
5010
|
+
SpanKind$27[SpanKind$27["CONSUMER"] = 4] = "CONSUMER";
|
|
5006
5011
|
})(exports.SpanKind || (exports.SpanKind = {}));
|
|
5007
5012
|
}) });
|
|
5008
5013
|
|
|
@@ -5011,20 +5016,20 @@ var require_span_kind = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetr
|
|
|
5011
5016
|
var require_status = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/api/build/src/trace/status.js": ((exports) => {
|
|
5012
5017
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5013
5018
|
exports.SpanStatusCode = void 0;
|
|
5014
|
-
(function(SpanStatusCode$
|
|
5019
|
+
(function(SpanStatusCode$16) {
|
|
5015
5020
|
/**
|
|
5016
5021
|
* The default status.
|
|
5017
5022
|
*/
|
|
5018
|
-
SpanStatusCode$
|
|
5023
|
+
SpanStatusCode$16[SpanStatusCode$16["UNSET"] = 0] = "UNSET";
|
|
5019
5024
|
/**
|
|
5020
5025
|
* The operation has been validated by an Application developer or
|
|
5021
5026
|
* Operator to have completed successfully.
|
|
5022
5027
|
*/
|
|
5023
|
-
SpanStatusCode$
|
|
5028
|
+
SpanStatusCode$16[SpanStatusCode$16["OK"] = 1] = "OK";
|
|
5024
5029
|
/**
|
|
5025
5030
|
* The operation contains an error.
|
|
5026
5031
|
*/
|
|
5027
|
-
SpanStatusCode$
|
|
5032
|
+
SpanStatusCode$16[SpanStatusCode$16["ERROR"] = 2] = "ERROR";
|
|
5028
5033
|
})(exports.SpanStatusCode || (exports.SpanStatusCode = {}));
|
|
5029
5034
|
}) });
|
|
5030
5035
|
|
|
@@ -5673,7 +5678,7 @@ var require_src$7 = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/ap
|
|
|
5673
5678
|
|
|
5674
5679
|
//#endregion
|
|
5675
5680
|
//#region node_modules/@use-tusk/drift-schemas/dist/duration-B3fwb4jB.js
|
|
5676
|
-
var import_src$
|
|
5681
|
+
var import_src$37 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
5677
5682
|
var import_commonjs$9 = /* @__PURE__ */ __toESM(require_commonjs$2(), 1);
|
|
5678
5683
|
var Duration$Type = class extends import_commonjs$9.MessageType {
|
|
5679
5684
|
constructor() {
|
|
@@ -6284,7 +6289,7 @@ let PackageType = /* @__PURE__ */ function(PackageType$1) {
|
|
|
6284
6289
|
*
|
|
6285
6290
|
* @generated from protobuf enum tusk.drift.core.v1.SpanKind
|
|
6286
6291
|
*/
|
|
6287
|
-
let SpanKind$
|
|
6292
|
+
let SpanKind$2 = /* @__PURE__ */ function(SpanKind$1$1) {
|
|
6288
6293
|
/**
|
|
6289
6294
|
* @generated from protobuf enum value: SPAN_KIND_UNSPECIFIED = 0;
|
|
6290
6295
|
*/
|
|
@@ -6454,7 +6459,7 @@ var Span$Type = class extends import_commonjs$6.MessageType {
|
|
|
6454
6459
|
kind: "enum",
|
|
6455
6460
|
T: () => [
|
|
6456
6461
|
"tusk.drift.core.v1.SpanKind",
|
|
6457
|
-
SpanKind$
|
|
6462
|
+
SpanKind$2,
|
|
6458
6463
|
"SPAN_KIND_"
|
|
6459
6464
|
]
|
|
6460
6465
|
},
|
|
@@ -6997,12 +7002,12 @@ const Trace = new Trace$Type();
|
|
|
6997
7002
|
const toStruct = (obj) => obj ? objectToProtobufStruct(obj) : void 0;
|
|
6998
7003
|
const mapOtToPb = (k) => {
|
|
6999
7004
|
switch (k) {
|
|
7000
|
-
case import_src$
|
|
7001
|
-
case import_src$
|
|
7002
|
-
case import_src$
|
|
7003
|
-
case import_src$
|
|
7004
|
-
case import_src$
|
|
7005
|
-
default: return SpanKind$
|
|
7005
|
+
case import_src$37.SpanKind.INTERNAL: return SpanKind$2.INTERNAL;
|
|
7006
|
+
case import_src$37.SpanKind.SERVER: return SpanKind$2.SERVER;
|
|
7007
|
+
case import_src$37.SpanKind.CLIENT: return SpanKind$2.CLIENT;
|
|
7008
|
+
case import_src$37.SpanKind.PRODUCER: return SpanKind$2.PRODUCER;
|
|
7009
|
+
case import_src$37.SpanKind.CONSUMER: return SpanKind$2.CONSUMER;
|
|
7010
|
+
default: return SpanKind$2.UNSPECIFIED;
|
|
7006
7011
|
}
|
|
7007
7012
|
};
|
|
7008
7013
|
/**
|
|
@@ -7405,13 +7410,13 @@ var TdInstrumentationNodeModule = class {
|
|
|
7405
7410
|
|
|
7406
7411
|
//#endregion
|
|
7407
7412
|
//#region src/core/types.ts
|
|
7408
|
-
var import_src$
|
|
7413
|
+
var import_src$36 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
7409
7414
|
const TD_INSTRUMENTATION_LIBRARY_NAME = "tusk-drift-sdk";
|
|
7410
|
-
const REPLAY_TRACE_ID_CONTEXT_KEY = (0, import_src$
|
|
7411
|
-
const SPAN_KIND_CONTEXT_KEY = (0, import_src$
|
|
7412
|
-
const IS_PRE_APP_START_CONTEXT_KEY = (0, import_src$
|
|
7413
|
-
const STOP_RECORDING_CHILD_SPANS_CONTEXT_KEY = (0, import_src$
|
|
7414
|
-
const CALLING_LIBRARY_CONTEXT_KEY = (0, import_src$
|
|
7415
|
+
const REPLAY_TRACE_ID_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.replayTraceId");
|
|
7416
|
+
const SPAN_KIND_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.spanKind");
|
|
7417
|
+
const IS_PRE_APP_START_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.isPreAppStart");
|
|
7418
|
+
const STOP_RECORDING_CHILD_SPANS_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.stopRecordingChildSpans");
|
|
7419
|
+
const CALLING_LIBRARY_CONTEXT_KEY = (0, import_src$36.createContextKey)("td.callingLibrary");
|
|
7415
7420
|
let TdSpanAttributes = /* @__PURE__ */ function(TdSpanAttributes$1) {
|
|
7416
7421
|
/**
|
|
7417
7422
|
* Presentational information:
|
|
@@ -7523,7 +7528,7 @@ TraceBlockingManager.instance = null;
|
|
|
7523
7528
|
|
|
7524
7529
|
//#endregion
|
|
7525
7530
|
//#region src/core/tracing/SpanUtils.ts
|
|
7526
|
-
var import_src$
|
|
7531
|
+
var import_src$35 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
7527
7532
|
var SpanUtils = class SpanUtils {
|
|
7528
7533
|
/**
|
|
7529
7534
|
* Creates a new span and returns span info including trace ID and span ID
|
|
@@ -7531,8 +7536,8 @@ var SpanUtils = class SpanUtils {
|
|
|
7531
7536
|
static createSpan(options) {
|
|
7532
7537
|
try {
|
|
7533
7538
|
const tracer = TuskDriftCore.getInstance().getTracer();
|
|
7534
|
-
const parentContext = options.parentContext || import_src$
|
|
7535
|
-
const activeSpan = import_src$
|
|
7539
|
+
const parentContext = options.parentContext || import_src$35.context.active();
|
|
7540
|
+
const activeSpan = import_src$35.trace.getSpan(parentContext);
|
|
7536
7541
|
if (activeSpan) {
|
|
7537
7542
|
const parentTraceId = activeSpan.spanContext().traceId;
|
|
7538
7543
|
if (TraceBlockingManager.getInstance().isTraceBlocked(parentTraceId)) {
|
|
@@ -7541,11 +7546,11 @@ var SpanUtils = class SpanUtils {
|
|
|
7541
7546
|
}
|
|
7542
7547
|
}
|
|
7543
7548
|
const span = tracer.startSpan(options.name, {
|
|
7544
|
-
kind: options.kind || import_src$
|
|
7549
|
+
kind: options.kind || import_src$35.SpanKind.CLIENT,
|
|
7545
7550
|
attributes: options.attributes || {}
|
|
7546
7551
|
}, parentContext);
|
|
7547
7552
|
const spanContext = span.spanContext();
|
|
7548
|
-
const newContext = import_src$
|
|
7553
|
+
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);
|
|
7549
7554
|
return {
|
|
7550
7555
|
traceId: spanContext.traceId,
|
|
7551
7556
|
spanId: spanContext.spanId,
|
|
@@ -7562,7 +7567,7 @@ var SpanUtils = class SpanUtils {
|
|
|
7562
7567
|
* Executes a function within a span context
|
|
7563
7568
|
*/
|
|
7564
7569
|
static withSpan(spanInfo, fn) {
|
|
7565
|
-
return import_src$
|
|
7570
|
+
return import_src$35.context.with(spanInfo.context, fn);
|
|
7566
7571
|
}
|
|
7567
7572
|
/**
|
|
7568
7573
|
* Execute a function within a properly configured span
|
|
@@ -7579,9 +7584,9 @@ var SpanUtils = class SpanUtils {
|
|
|
7579
7584
|
* @returns The result of the function execution
|
|
7580
7585
|
*/
|
|
7581
7586
|
static createAndExecuteSpan(mode, originalFunctionCall, options, fn) {
|
|
7582
|
-
const spanContext = import_src$
|
|
7587
|
+
const spanContext = import_src$35.trace.getActiveSpan()?.spanContext();
|
|
7583
7588
|
if (spanContext) {
|
|
7584
|
-
if (import_src$
|
|
7589
|
+
if (import_src$35.context.active().getValue(STOP_RECORDING_CHILD_SPANS_CONTEXT_KEY)) {
|
|
7585
7590
|
logger.debug(`[SpanUtils] Stopping recording of child spans for span ${spanContext.spanId}, packageName: ${options.packageName}, instrumentationName: ${options.instrumentationName}`);
|
|
7586
7591
|
return originalFunctionCall();
|
|
7587
7592
|
}
|
|
@@ -7620,15 +7625,15 @@ var SpanUtils = class SpanUtils {
|
|
|
7620
7625
|
*/
|
|
7621
7626
|
static getCurrentSpanInfo() {
|
|
7622
7627
|
try {
|
|
7623
|
-
const activeSpan = import_src$
|
|
7628
|
+
const activeSpan = import_src$35.trace.getActiveSpan();
|
|
7624
7629
|
if (!activeSpan) return null;
|
|
7625
7630
|
const spanContext = activeSpan.spanContext();
|
|
7626
7631
|
return {
|
|
7627
7632
|
traceId: spanContext.traceId,
|
|
7628
7633
|
spanId: spanContext.spanId,
|
|
7629
7634
|
span: activeSpan,
|
|
7630
|
-
context: import_src$
|
|
7631
|
-
isPreAppStart: import_src$
|
|
7635
|
+
context: import_src$35.context.active(),
|
|
7636
|
+
isPreAppStart: import_src$35.context.active().getValue(IS_PRE_APP_START_CONTEXT_KEY)
|
|
7632
7637
|
};
|
|
7633
7638
|
} catch (error) {
|
|
7634
7639
|
logger.error("SpanUtils error getting current span info:", error);
|
|
@@ -7692,7 +7697,7 @@ var SpanUtils = class SpanUtils {
|
|
|
7692
7697
|
}
|
|
7693
7698
|
static setCurrentReplayTraceId(replayTraceId) {
|
|
7694
7699
|
try {
|
|
7695
|
-
return import_src$
|
|
7700
|
+
return import_src$35.context.active().setValue(REPLAY_TRACE_ID_CONTEXT_KEY, replayTraceId);
|
|
7696
7701
|
} catch (error) {
|
|
7697
7702
|
logger.error("SpanUtils error setting current replay trace id:", error);
|
|
7698
7703
|
return null;
|
|
@@ -7703,7 +7708,7 @@ var SpanUtils = class SpanUtils {
|
|
|
7703
7708
|
*/
|
|
7704
7709
|
static getCurrentReplayTraceId() {
|
|
7705
7710
|
try {
|
|
7706
|
-
return import_src$
|
|
7711
|
+
return import_src$35.context.active().getValue(REPLAY_TRACE_ID_CONTEXT_KEY);
|
|
7707
7712
|
} catch (error) {
|
|
7708
7713
|
logger.error("SpanUtils error getting current replay trace id:", error);
|
|
7709
7714
|
return null;
|
|
@@ -8352,7 +8357,7 @@ function findMockResponseSync({ mockRequestData, tuskDrift, inputValueSchemaMerg
|
|
|
8352
8357
|
|
|
8353
8358
|
//#endregion
|
|
8354
8359
|
//#region src/instrumentation/libraries/http/mocks/TdMockClientRequest.ts
|
|
8355
|
-
var import_src$
|
|
8360
|
+
var import_src$34 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
8356
8361
|
let ClientRequest;
|
|
8357
8362
|
/**
|
|
8358
8363
|
* Mock ClientRequest implementation for Tusk Drift HTTP replay
|
|
@@ -8523,7 +8528,7 @@ var TdMockClientRequest = class TdMockClientRequest extends EventEmitter {
|
|
|
8523
8528
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
8524
8529
|
submoduleName: rawInputValue.method,
|
|
8525
8530
|
inputValue,
|
|
8526
|
-
kind: import_src$
|
|
8531
|
+
kind: import_src$34.SpanKind.CLIENT,
|
|
8527
8532
|
stackTrace: this.stackTrace
|
|
8528
8533
|
},
|
|
8529
8534
|
tuskDrift: this.tuskDrift,
|
|
@@ -8693,7 +8698,7 @@ var HttpReplayHooks = class {
|
|
|
8693
8698
|
|
|
8694
8699
|
//#endregion
|
|
8695
8700
|
//#region src/instrumentation/core/utils/modeUtils.ts
|
|
8696
|
-
var import_src$
|
|
8701
|
+
var import_src$33 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
8697
8702
|
/**
|
|
8698
8703
|
* Utility function that abstracts the common record mode pattern of checking for current span context
|
|
8699
8704
|
* and deciding whether to execute record mode logic or just call the original function.
|
|
@@ -8714,7 +8719,7 @@ function handleRecordMode({ originalFunctionCall, recordModeHandler, spanKind })
|
|
|
8714
8719
|
return originalFunctionCall();
|
|
8715
8720
|
}
|
|
8716
8721
|
if (!isAppReady) return recordModeHandler({ isPreAppStart: true });
|
|
8717
|
-
if (!currentSpanInfo && spanKind !== import_src$
|
|
8722
|
+
if (!currentSpanInfo && spanKind !== import_src$33.SpanKind.SERVER || currentSpanInfo?.isPreAppStart) return originalFunctionCall();
|
|
8718
8723
|
else return recordModeHandler({ isPreAppStart: false });
|
|
8719
8724
|
}
|
|
8720
8725
|
/**
|
|
@@ -10194,7 +10199,7 @@ function captureStackTrace(excludeClassNames = []) {
|
|
|
10194
10199
|
|
|
10195
10200
|
//#endregion
|
|
10196
10201
|
//#region src/instrumentation/libraries/http/HttpTransformEngine.ts
|
|
10197
|
-
var import_src$
|
|
10202
|
+
var import_src$32 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
10198
10203
|
/**
|
|
10199
10204
|
* Creates an empty HttpClientInputValue object for dropped spans
|
|
10200
10205
|
*/
|
|
@@ -10247,7 +10252,7 @@ var HttpTransformEngine = class {
|
|
|
10247
10252
|
const testSpan = {
|
|
10248
10253
|
traceId: "",
|
|
10249
10254
|
spanId: "",
|
|
10250
|
-
kind: import_src$
|
|
10255
|
+
kind: import_src$32.SpanKind.SERVER,
|
|
10251
10256
|
protocol: "http",
|
|
10252
10257
|
inputValue: {
|
|
10253
10258
|
method,
|
|
@@ -10270,7 +10275,7 @@ var HttpTransformEngine = class {
|
|
|
10270
10275
|
const testSpan = {
|
|
10271
10276
|
traceId: "",
|
|
10272
10277
|
spanId: "",
|
|
10273
|
-
kind: import_src$
|
|
10278
|
+
kind: import_src$32.SpanKind.CLIENT,
|
|
10274
10279
|
protocol: inputValue.protocol || "http",
|
|
10275
10280
|
inputValue: clonedInputValue
|
|
10276
10281
|
};
|
|
@@ -10297,8 +10302,8 @@ var HttpTransformEngine = class {
|
|
|
10297
10302
|
const matcherFunction = this.compileMatcher(matcher);
|
|
10298
10303
|
if (action.type === "drop") return (span) => {
|
|
10299
10304
|
if (!matcherFunction(span)) return;
|
|
10300
|
-
if (span.inputValue) span.inputValue = span.kind === import_src$
|
|
10301
|
-
if (span.outputValue) span.outputValue = span.kind === import_src$
|
|
10305
|
+
if (span.inputValue) span.inputValue = span.kind === import_src$32.SpanKind.CLIENT ? createEmptyClientInputValue(span.protocol) : createEmptyServerInputValue();
|
|
10306
|
+
if (span.outputValue) span.outputValue = span.kind === import_src$32.SpanKind.CLIENT ? createEmptyClientOutputValue() : createEmptyServerOutputValue();
|
|
10302
10307
|
return {
|
|
10303
10308
|
type: "drop",
|
|
10304
10309
|
field: "entire_span",
|
|
@@ -10328,8 +10333,8 @@ var HttpTransformEngine = class {
|
|
|
10328
10333
|
}
|
|
10329
10334
|
compileMatcher(matcher) {
|
|
10330
10335
|
const checks = [];
|
|
10331
|
-
if (matcher.direction === "outbound") checks.push((span) => span.kind === import_src$
|
|
10332
|
-
else if (matcher.direction === "inbound") checks.push((span) => span.kind === import_src$
|
|
10336
|
+
if (matcher.direction === "outbound") checks.push((span) => span.kind === import_src$32.SpanKind.CLIENT);
|
|
10337
|
+
else if (matcher.direction === "inbound") checks.push((span) => span.kind === import_src$32.SpanKind.SERVER);
|
|
10333
10338
|
if (matcher.method) if (matcher.method.length === 0) {} else {
|
|
10334
10339
|
const methods = matcher.method.map((method) => method.toUpperCase());
|
|
10335
10340
|
checks.push((span) => {
|
|
@@ -10557,7 +10562,7 @@ var HttpTransformEngine = class {
|
|
|
10557
10562
|
|
|
10558
10563
|
//#endregion
|
|
10559
10564
|
//#region src/instrumentation/libraries/http/Instrumentation.ts
|
|
10560
|
-
var import_src$
|
|
10565
|
+
var import_src$31 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
10561
10566
|
var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
10562
10567
|
constructor(config) {
|
|
10563
10568
|
super("http", config);
|
|
@@ -10644,10 +10649,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10644
10649
|
logger.debug(`[HttpInstrumentation] Setting replay trace id`, replayTraceId);
|
|
10645
10650
|
const ctxWithReplayTraceId = SpanUtils.setCurrentReplayTraceId(replayTraceId);
|
|
10646
10651
|
if (!ctxWithReplayTraceId) throw new Error("Error setting current replay trace id");
|
|
10647
|
-
return import_src$
|
|
10652
|
+
return import_src$31.context.with(ctxWithReplayTraceId, () => {
|
|
10648
10653
|
return SpanUtils.createAndExecuteSpan(this.mode, () => originalHandler.call(this), {
|
|
10649
10654
|
name: `${target}`,
|
|
10650
|
-
kind: import_src$
|
|
10655
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10651
10656
|
packageName: spanProtocol,
|
|
10652
10657
|
submodule: method,
|
|
10653
10658
|
packageType: PackageType.HTTP,
|
|
@@ -10692,7 +10697,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10692
10697
|
logger.debug(`[HttpInstrumentation] Http inbound request arriving, inputValue: ${JSON.stringify(inputValue)}`);
|
|
10693
10698
|
return SpanUtils.createAndExecuteSpan(this.mode, () => originalHandler.call(this), {
|
|
10694
10699
|
name: `${target}`,
|
|
10695
|
-
kind: import_src$
|
|
10700
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10696
10701
|
packageName: spanProtocol,
|
|
10697
10702
|
packageType: PackageType.HTTP,
|
|
10698
10703
|
submodule: method,
|
|
@@ -10712,7 +10717,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10712
10717
|
});
|
|
10713
10718
|
});
|
|
10714
10719
|
},
|
|
10715
|
-
spanKind: import_src$
|
|
10720
|
+
spanKind: import_src$31.SpanKind.SERVER
|
|
10716
10721
|
});
|
|
10717
10722
|
} else return originalHandler.call(this);
|
|
10718
10723
|
}
|
|
@@ -10729,8 +10734,8 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10729
10734
|
_handleInboundRequestInSpan({ req, res, originalHandler, spanInfo, inputValue, schemaMerges, protocol }) {
|
|
10730
10735
|
const self = this;
|
|
10731
10736
|
const spanProtocol = this._normalizeProtocol(protocol, "http");
|
|
10732
|
-
import_src$
|
|
10733
|
-
import_src$
|
|
10737
|
+
import_src$31.context.bind(spanInfo.context, req);
|
|
10738
|
+
import_src$31.context.bind(spanInfo.context, res);
|
|
10734
10739
|
let completeInputValue = inputValue;
|
|
10735
10740
|
this._captureServerRequestBody(req, spanInfo, inputValue, schemaMerges, (updatedInputValue) => {
|
|
10736
10741
|
completeInputValue = updatedInputValue;
|
|
@@ -10768,7 +10773,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10768
10773
|
const spanData = {
|
|
10769
10774
|
traceId: spanInfo.traceId,
|
|
10770
10775
|
spanId: spanInfo.spanId,
|
|
10771
|
-
kind: import_src$
|
|
10776
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10772
10777
|
protocol: spanProtocol,
|
|
10773
10778
|
inputValue: completeInputValue,
|
|
10774
10779
|
outputValue
|
|
@@ -10786,10 +10791,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10786
10791
|
},
|
|
10787
10792
|
...spanData.transformMetadata && { transformMetadata: spanData.transformMetadata }
|
|
10788
10793
|
});
|
|
10789
|
-
const status = statusCode >=
|
|
10790
|
-
code: import_src$
|
|
10794
|
+
const status = statusCode >= 300 ? {
|
|
10795
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
10791
10796
|
message: `HTTP ${statusCode}`
|
|
10792
|
-
} : { code: import_src$
|
|
10797
|
+
} : { code: import_src$31.SpanStatusCode.OK };
|
|
10793
10798
|
SpanUtils.setStatus(spanInfo.span, status);
|
|
10794
10799
|
const decodedType = getDecodedType(outputValue.headers?.["content-type"] || "");
|
|
10795
10800
|
if (decodedType && !ACCEPTABLE_CONTENT_TYPES.has(decodedType)) {
|
|
@@ -10839,11 +10844,11 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10839
10844
|
outputSchemaHash: JsonSchemaHelper.generateDeterministicHash(outputSchema),
|
|
10840
10845
|
inputValueHash,
|
|
10841
10846
|
outputValueHash,
|
|
10842
|
-
kind: import_src$
|
|
10847
|
+
kind: import_src$31.SpanKind.SERVER,
|
|
10843
10848
|
packageType: PackageType.HTTP,
|
|
10844
10849
|
status: {
|
|
10845
|
-
code: statusCode >=
|
|
10846
|
-
message: statusCode >=
|
|
10850
|
+
code: statusCode >= 300 ? StatusCode.ERROR : StatusCode.OK,
|
|
10851
|
+
message: statusCode >= 300 ? `HTTP ${statusCode}` : ""
|
|
10847
10852
|
},
|
|
10848
10853
|
timestamp: {
|
|
10849
10854
|
seconds: Math.floor(now.getTime() / 1e3),
|
|
@@ -10868,7 +10873,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10868
10873
|
try {
|
|
10869
10874
|
logger.debug(`[HttpInstrumentation] Server request error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
10870
10875
|
SpanUtils.endSpan(spanInfo.span, {
|
|
10871
|
-
code: import_src$
|
|
10876
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
10872
10877
|
message: error.message
|
|
10873
10878
|
});
|
|
10874
10879
|
} catch (error$1) {
|
|
@@ -10879,7 +10884,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
10879
10884
|
try {
|
|
10880
10885
|
logger.debug(`[HttpInstrumentation] Server response 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) {
|
|
@@ -11084,7 +11089,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11084
11089
|
inputValue: completeInputValue
|
|
11085
11090
|
});
|
|
11086
11091
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11087
|
-
code: import_src$
|
|
11092
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
11088
11093
|
message: error.message
|
|
11089
11094
|
});
|
|
11090
11095
|
} catch (error$1) {
|
|
@@ -11101,7 +11106,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11101
11106
|
const spanData = {
|
|
11102
11107
|
traceId: spanInfo.traceId,
|
|
11103
11108
|
spanId: spanInfo.spanId,
|
|
11104
|
-
kind: import_src$
|
|
11109
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11105
11110
|
protocol: normalizedProtocol,
|
|
11106
11111
|
inputValue,
|
|
11107
11112
|
outputValue
|
|
@@ -11113,10 +11118,10 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11113
11118
|
outputSchemaMerges,
|
|
11114
11119
|
transformMetadata: spanData.transformMetadata ? spanData.transformMetadata : void 0
|
|
11115
11120
|
});
|
|
11116
|
-
const status = statusCode >=
|
|
11117
|
-
code: import_src$
|
|
11121
|
+
const status = statusCode >= 300 ? {
|
|
11122
|
+
code: import_src$31.SpanStatusCode.ERROR,
|
|
11118
11123
|
message: `HTTP ${statusCode}`
|
|
11119
|
-
} : { code: import_src$
|
|
11124
|
+
} : { code: import_src$31.SpanStatusCode.OK };
|
|
11120
11125
|
SpanUtils.endSpan(spanInfo.span, status);
|
|
11121
11126
|
}
|
|
11122
11127
|
_captureHeadersFromRawHeaders(rawHeaders) {
|
|
@@ -11170,7 +11175,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11170
11175
|
};
|
|
11171
11176
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRequest.apply(this, args), {
|
|
11172
11177
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11173
|
-
kind: import_src$
|
|
11178
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11174
11179
|
packageName: requestProtocol,
|
|
11175
11180
|
packageType: PackageType.HTTP,
|
|
11176
11181
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11205,7 +11210,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11205
11210
|
};
|
|
11206
11211
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRequest.apply(this, args), {
|
|
11207
11212
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11208
|
-
kind: import_src$
|
|
11213
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11209
11214
|
packageName: requestProtocol,
|
|
11210
11215
|
packageType: PackageType.HTTP,
|
|
11211
11216
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11217,7 +11222,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11217
11222
|
return self._handleOutboundRequestInSpan(originalRequest, args, spanInfo, inputValue, { headers: { matchImportance: 0 } });
|
|
11218
11223
|
});
|
|
11219
11224
|
},
|
|
11220
|
-
spanKind: import_src$
|
|
11225
|
+
spanKind: import_src$31.SpanKind.CLIENT
|
|
11221
11226
|
});
|
|
11222
11227
|
else return originalRequest.apply(this, args);
|
|
11223
11228
|
};
|
|
@@ -11263,7 +11268,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11263
11268
|
};
|
|
11264
11269
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.apply(this, args), {
|
|
11265
11270
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11266
|
-
kind: import_src$
|
|
11271
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11267
11272
|
packageName: requestProtocol,
|
|
11268
11273
|
packageType: PackageType.HTTP,
|
|
11269
11274
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11297,7 +11302,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11297
11302
|
};
|
|
11298
11303
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.apply(this, args), {
|
|
11299
11304
|
name: requestOptions.path || `${requestProtocol.toUpperCase()} ${method}`,
|
|
11300
|
-
kind: import_src$
|
|
11305
|
+
kind: import_src$31.SpanKind.CLIENT,
|
|
11301
11306
|
packageName: requestProtocol,
|
|
11302
11307
|
packageType: PackageType.HTTP,
|
|
11303
11308
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11309,7 +11314,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11309
11314
|
return self._handleOutboundRequestInSpan(originalGet, args, spanInfo, inputValue, { headers: { matchImportance: 0 } });
|
|
11310
11315
|
});
|
|
11311
11316
|
},
|
|
11312
|
-
spanKind: import_src$
|
|
11317
|
+
spanKind: import_src$31.SpanKind.CLIENT
|
|
11313
11318
|
});
|
|
11314
11319
|
else return originalGet.apply(this, args);
|
|
11315
11320
|
};
|
|
@@ -11354,7 +11359,7 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
11354
11359
|
|
|
11355
11360
|
//#endregion
|
|
11356
11361
|
//#region src/instrumentation/libraries/date/Instrumentation.ts
|
|
11357
|
-
var import_src$
|
|
11362
|
+
var import_src$30 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
11358
11363
|
/**
|
|
11359
11364
|
* Date instrumentation that provides consistent dates in replay mode.
|
|
11360
11365
|
* In replay mode, new Date() calls return the latest mock response timestamp.
|
|
@@ -11393,7 +11398,7 @@ var DateInstrumentation = class DateInstrumentation extends TdInstrumentationBas
|
|
|
11393
11398
|
if (this.mode !== TuskDriftMode.REPLAY) return this._callOriginalDate(args, isConstructorCall);
|
|
11394
11399
|
const currentSpanInfo = SpanUtils.getCurrentSpanInfo();
|
|
11395
11400
|
if (!currentSpanInfo) return this._callOriginalDate(args, isConstructorCall);
|
|
11396
|
-
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) !== import_src$
|
|
11401
|
+
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) !== import_src$30.SpanKind.SERVER) return this._callOriginalDate(args, isConstructorCall);
|
|
11397
11402
|
this.isInPatchedCall = true;
|
|
11398
11403
|
try {
|
|
11399
11404
|
return this._handleReplayDate(args, isConstructorCall);
|
|
@@ -11639,7 +11644,7 @@ var TdPgClientMock = class extends EventEmitter {
|
|
|
11639
11644
|
|
|
11640
11645
|
//#endregion
|
|
11641
11646
|
//#region src/instrumentation/libraries/pg/Instrumentation.ts
|
|
11642
|
-
var import_src$
|
|
11647
|
+
var import_src$29 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
11643
11648
|
var PgInstrumentation = class extends TdInstrumentationBase {
|
|
11644
11649
|
constructor(config = {}) {
|
|
11645
11650
|
super("pg", config);
|
|
@@ -11712,7 +11717,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11712
11717
|
const spanName = inputValue.clientType === "pool" ? "pg-pool.query" : "pg.query";
|
|
11713
11718
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
11714
11719
|
name: spanName,
|
|
11715
|
-
kind: import_src$
|
|
11720
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11716
11721
|
submodule: "query",
|
|
11717
11722
|
packageType: PackageType.PG,
|
|
11718
11723
|
packageName,
|
|
@@ -11731,7 +11736,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11731
11736
|
const spanName = inputValue.clientType === "pool" ? "pg-pool.query" : "pg.query";
|
|
11732
11737
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
11733
11738
|
name: spanName,
|
|
11734
|
-
kind: import_src$
|
|
11739
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11735
11740
|
submodule: "query",
|
|
11736
11741
|
packageType: PackageType.PG,
|
|
11737
11742
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -11742,7 +11747,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11742
11747
|
return self._handleRecordQueryInSpan(spanInfo, originalQuery, queryConfig, args, this);
|
|
11743
11748
|
});
|
|
11744
11749
|
},
|
|
11745
|
-
spanKind: import_src$
|
|
11750
|
+
spanKind: import_src$29.SpanKind.CLIENT
|
|
11746
11751
|
});
|
|
11747
11752
|
else return originalQuery.apply(this, args);
|
|
11748
11753
|
};
|
|
@@ -11764,7 +11769,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11764
11769
|
replayModeHandler: () => {
|
|
11765
11770
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
11766
11771
|
name: `pg.connect`,
|
|
11767
|
-
kind: import_src$
|
|
11772
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11768
11773
|
submodule: "connect",
|
|
11769
11774
|
packageName: "pg",
|
|
11770
11775
|
packageType: PackageType.PG,
|
|
@@ -11781,7 +11786,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11781
11786
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
11782
11787
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
11783
11788
|
name: `pg.connect`,
|
|
11784
|
-
kind: import_src$
|
|
11789
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11785
11790
|
submodule: "connect",
|
|
11786
11791
|
packageName: "pg",
|
|
11787
11792
|
packageType: PackageType.PG,
|
|
@@ -11792,7 +11797,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11792
11797
|
return self._handleRecordConnectInSpan(spanInfo, originalConnect, callback, this);
|
|
11793
11798
|
});
|
|
11794
11799
|
},
|
|
11795
|
-
spanKind: import_src$
|
|
11800
|
+
spanKind: import_src$29.SpanKind.CLIENT
|
|
11796
11801
|
});
|
|
11797
11802
|
else return originalConnect.apply(this, [callback]);
|
|
11798
11803
|
};
|
|
@@ -11832,7 +11837,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11832
11837
|
logger.debug(`[PgInstrumentation] PG query error (hasCallback): ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
11833
11838
|
try {
|
|
11834
11839
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11835
|
-
code: import_src$
|
|
11840
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
11836
11841
|
message: error.message
|
|
11837
11842
|
});
|
|
11838
11843
|
} catch (error$1) {
|
|
@@ -11842,7 +11847,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11842
11847
|
logger.debug(`[PgInstrumentation] PG query completed successfully (hasCallback) (${SpanUtils.getTraceInfo()})`);
|
|
11843
11848
|
try {
|
|
11844
11849
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
11845
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
11850
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
11846
11851
|
} catch (error$1) {
|
|
11847
11852
|
logger.error(`[PgInstrumentation] error processing response:`, error$1);
|
|
11848
11853
|
}
|
|
@@ -11869,7 +11874,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11869
11874
|
logger.debug(`[PgInstrumentation] PG query completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
11870
11875
|
try {
|
|
11871
11876
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
11872
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
11877
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
11873
11878
|
} catch (error) {
|
|
11874
11879
|
logger.error(`[PgInstrumentation] error processing response:`, error);
|
|
11875
11880
|
}
|
|
@@ -11878,7 +11883,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11878
11883
|
logger.debug(`[PgInstrumentation] PG query error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
11879
11884
|
try {
|
|
11880
11885
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11881
|
-
code: import_src$
|
|
11886
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
11882
11887
|
message: error.message
|
|
11883
11888
|
});
|
|
11884
11889
|
} catch (error$1) {
|
|
@@ -11910,7 +11915,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11910
11915
|
packageName,
|
|
11911
11916
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
11912
11917
|
submoduleName: "query",
|
|
11913
|
-
kind: import_src$
|
|
11918
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
11914
11919
|
stackTrace
|
|
11915
11920
|
},
|
|
11916
11921
|
tuskDrift: this.tuskDrift
|
|
@@ -11996,7 +12001,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
11996
12001
|
logger.debug(`[PgInstrumentation] PG connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
11997
12002
|
try {
|
|
11998
12003
|
SpanUtils.endSpan(spanInfo.span, {
|
|
11999
|
-
code: import_src$
|
|
12004
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12000
12005
|
message: error.message
|
|
12001
12006
|
});
|
|
12002
12007
|
} catch (error$1) {
|
|
@@ -12006,7 +12011,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12006
12011
|
logger.debug(`[PgInstrumentation] PG connect completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
12007
12012
|
try {
|
|
12008
12013
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
12009
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12014
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12010
12015
|
} catch (error$1) {
|
|
12011
12016
|
logger.error(`[PgInstrumentation] error processing connect response:`, error$1);
|
|
12012
12017
|
}
|
|
@@ -12018,7 +12023,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12018
12023
|
logger.debug(`[PgInstrumentation] PG connect completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
12019
12024
|
try {
|
|
12020
12025
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
12021
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12026
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12022
12027
|
} catch (error) {
|
|
12023
12028
|
logger.error(`[PgInstrumentation] error processing connect response:`, error);
|
|
12024
12029
|
}
|
|
@@ -12027,7 +12032,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12027
12032
|
logger.debug(`[PgInstrumentation] PG connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12028
12033
|
try {
|
|
12029
12034
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12030
|
-
code: import_src$
|
|
12035
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12031
12036
|
message: error.message
|
|
12032
12037
|
});
|
|
12033
12038
|
} catch (error$1) {
|
|
@@ -12099,7 +12104,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12099
12104
|
replayModeHandler: () => {
|
|
12100
12105
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
12101
12106
|
name: `pg-pool.connect`,
|
|
12102
|
-
kind: import_src$
|
|
12107
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
12103
12108
|
submodule: "connect",
|
|
12104
12109
|
packageName: "pg-pool",
|
|
12105
12110
|
packageType: PackageType.PG,
|
|
@@ -12116,7 +12121,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12116
12121
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12117
12122
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
12118
12123
|
name: `pg-pool.connect`,
|
|
12119
|
-
kind: import_src$
|
|
12124
|
+
kind: import_src$29.SpanKind.CLIENT,
|
|
12120
12125
|
submodule: "connect",
|
|
12121
12126
|
packageName: "pg-pool",
|
|
12122
12127
|
packageType: PackageType.PG,
|
|
@@ -12127,7 +12132,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12127
12132
|
return self._handleRecordPoolConnectInSpan(spanInfo, originalConnect, callback, this);
|
|
12128
12133
|
});
|
|
12129
12134
|
},
|
|
12130
|
-
spanKind: import_src$
|
|
12135
|
+
spanKind: import_src$29.SpanKind.CLIENT
|
|
12131
12136
|
});
|
|
12132
12137
|
else return originalConnect.apply(this, [callback]);
|
|
12133
12138
|
};
|
|
@@ -12140,7 +12145,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12140
12145
|
logger.debug(`[PgInstrumentation] PG Pool connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12141
12146
|
try {
|
|
12142
12147
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12143
|
-
code: import_src$
|
|
12148
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12144
12149
|
message: error.message
|
|
12145
12150
|
});
|
|
12146
12151
|
} catch (error$1) {
|
|
@@ -12153,7 +12158,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12153
12158
|
connected: true,
|
|
12154
12159
|
hasClient: !!client
|
|
12155
12160
|
} });
|
|
12156
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12161
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12157
12162
|
} catch (error$1) {
|
|
12158
12163
|
logger.error(`[PgInstrumentation] error processing pool connect response:`, error$1);
|
|
12159
12164
|
}
|
|
@@ -12168,7 +12173,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12168
12173
|
connected: true,
|
|
12169
12174
|
hasClient: !!client
|
|
12170
12175
|
} });
|
|
12171
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12176
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$29.SpanStatusCode.OK });
|
|
12172
12177
|
} catch (error) {
|
|
12173
12178
|
logger.error(`[PgInstrumentation] error processing pool connect response:`, error);
|
|
12174
12179
|
}
|
|
@@ -12177,7 +12182,7 @@ var PgInstrumentation = class extends TdInstrumentationBase {
|
|
|
12177
12182
|
logger.debug(`[PgInstrumentation] PG Pool connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
12178
12183
|
try {
|
|
12179
12184
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12180
|
-
code: import_src$
|
|
12185
|
+
code: import_src$29.SpanStatusCode.ERROR,
|
|
12181
12186
|
message: error.message
|
|
12182
12187
|
});
|
|
12183
12188
|
} catch (error$1) {
|
|
@@ -12302,7 +12307,7 @@ function reconstructQueryString(strings, values) {
|
|
|
12302
12307
|
|
|
12303
12308
|
//#endregion
|
|
12304
12309
|
//#region src/instrumentation/libraries/postgres/handlers/ConnectionHandler.ts
|
|
12305
|
-
var import_src$
|
|
12310
|
+
var import_src$28 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
12306
12311
|
var ConnectionHandler = class {
|
|
12307
12312
|
constructor(mode, instrumentationName, isAppReady, wrapSqlInstance) {
|
|
12308
12313
|
this.mode = mode;
|
|
@@ -12346,7 +12351,7 @@ var ConnectionHandler = class {
|
|
|
12346
12351
|
return this.wrapSqlInstance(sqlInstance);
|
|
12347
12352
|
}, {
|
|
12348
12353
|
name: "postgres.connect",
|
|
12349
|
-
kind: import_src$
|
|
12354
|
+
kind: import_src$28.SpanKind.CLIENT,
|
|
12350
12355
|
submodule: "connect",
|
|
12351
12356
|
packageType: PackageType.PG,
|
|
12352
12357
|
packageName: "postgres",
|
|
@@ -12369,7 +12374,7 @@ var ConnectionHandler = class {
|
|
|
12369
12374
|
return this.wrapSqlInstance(sqlInstance);
|
|
12370
12375
|
}, {
|
|
12371
12376
|
name: "postgres.connect",
|
|
12372
|
-
kind: import_src$
|
|
12377
|
+
kind: import_src$28.SpanKind.CLIENT,
|
|
12373
12378
|
submodule: "connect",
|
|
12374
12379
|
packageType: PackageType.PG,
|
|
12375
12380
|
packageName: "postgres",
|
|
@@ -12380,7 +12385,7 @@ var ConnectionHandler = class {
|
|
|
12380
12385
|
return this.handleRecordConnect(spanInfo, originalFunction, args);
|
|
12381
12386
|
});
|
|
12382
12387
|
},
|
|
12383
|
-
spanKind: import_src$
|
|
12388
|
+
spanKind: import_src$28.SpanKind.CLIENT
|
|
12384
12389
|
});
|
|
12385
12390
|
else return originalFunction(...args);
|
|
12386
12391
|
}
|
|
@@ -12390,7 +12395,7 @@ var ConnectionHandler = class {
|
|
|
12390
12395
|
try {
|
|
12391
12396
|
logger.debug(`[PostgresInstrumentation] Postgres connection created successfully (${SpanUtils.getTraceInfo()})`);
|
|
12392
12397
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
12393
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12398
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$28.SpanStatusCode.OK });
|
|
12394
12399
|
} catch (error) {
|
|
12395
12400
|
logger.error(`[PostgresInstrumentation] error adding span attributes:`, error);
|
|
12396
12401
|
}
|
|
@@ -12410,7 +12415,7 @@ var ConnectionHandler = class {
|
|
|
12410
12415
|
|
|
12411
12416
|
//#endregion
|
|
12412
12417
|
//#region src/instrumentation/libraries/postgres/Instrumentation.ts
|
|
12413
|
-
var import_src$
|
|
12418
|
+
var import_src$27 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
12414
12419
|
var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
12415
12420
|
constructor(config = {}) {
|
|
12416
12421
|
super("postgres", config);
|
|
@@ -12581,7 +12586,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12581
12586
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12582
12587
|
return SpanUtils.createAndExecuteSpan(this.mode, () => originalListen.call(sqlInstance, channelName, callback, onlisten), {
|
|
12583
12588
|
name: "postgres.listen",
|
|
12584
|
-
kind: import_src$
|
|
12589
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12585
12590
|
submodule: "listen",
|
|
12586
12591
|
packageType: PackageType.PG,
|
|
12587
12592
|
packageName: "postgres",
|
|
@@ -12608,7 +12613,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12608
12613
|
state: result.state,
|
|
12609
12614
|
payloads: receivedPayloads
|
|
12610
12615
|
} });
|
|
12611
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12616
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12612
12617
|
} catch (error) {
|
|
12613
12618
|
logger.error(`[PostgresInstrumentation] error adding span attributes:`, error);
|
|
12614
12619
|
}
|
|
@@ -12622,7 +12627,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12622
12627
|
logger.error(`[PostgresInstrumentation] RECORD listen error: ${error.message}`);
|
|
12623
12628
|
try {
|
|
12624
12629
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12625
|
-
code: import_src$
|
|
12630
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12626
12631
|
message: error.message
|
|
12627
12632
|
});
|
|
12628
12633
|
} catch (error$1) {
|
|
@@ -12632,7 +12637,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12632
12637
|
}
|
|
12633
12638
|
});
|
|
12634
12639
|
},
|
|
12635
|
-
spanKind: import_src$
|
|
12640
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
12636
12641
|
});
|
|
12637
12642
|
}
|
|
12638
12643
|
async _handleReplayListen(channelName, callback, onlisten, inputValue) {
|
|
@@ -12650,7 +12655,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12650
12655
|
unlisten: async () => {}
|
|
12651
12656
|
}), {
|
|
12652
12657
|
name: "postgres.listen",
|
|
12653
|
-
kind: import_src$
|
|
12658
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12654
12659
|
submodule: "listen",
|
|
12655
12660
|
packageType: PackageType.PG,
|
|
12656
12661
|
packageName: "postgres",
|
|
@@ -12678,7 +12683,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12678
12683
|
logger.debug(`[PostgresInstrumentation] REPLAY: Invoking callback with recorded payload: ${payload}`);
|
|
12679
12684
|
callback(payload);
|
|
12680
12685
|
}
|
|
12681
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12686
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12682
12687
|
return {
|
|
12683
12688
|
state: recordedState,
|
|
12684
12689
|
unlisten: async () => {
|
|
@@ -12688,7 +12693,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12688
12693
|
} catch (error) {
|
|
12689
12694
|
logger.error(`[PostgresInstrumentation] REPLAY listen error: ${error.message}`);
|
|
12690
12695
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12691
|
-
code: import_src$
|
|
12696
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12692
12697
|
message: error.message
|
|
12693
12698
|
});
|
|
12694
12699
|
throw error;
|
|
@@ -12707,7 +12712,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12707
12712
|
}
|
|
12708
12713
|
_handleSqlQuery(originalSql, strings, values) {
|
|
12709
12714
|
if (!strings || !Array.isArray(strings.raw)) return originalSql.call(this, strings, ...values);
|
|
12710
|
-
const creationContext = import_src$
|
|
12715
|
+
const creationContext = import_src$27.context.active();
|
|
12711
12716
|
const query = originalSql.call(this, strings, ...values);
|
|
12712
12717
|
const inputValue = {
|
|
12713
12718
|
query: reconstructQueryString(strings, values).trim(),
|
|
@@ -12730,7 +12735,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12730
12735
|
else if (parameters !== void 0) return originalUnsafe.call(sqlInstance, query, parameters);
|
|
12731
12736
|
else return originalUnsafe.call(sqlInstance, query);
|
|
12732
12737
|
})();
|
|
12733
|
-
const creationContext = import_src$
|
|
12738
|
+
const creationContext = import_src$27.context.active();
|
|
12734
12739
|
const originalThen = unsafeQuery.then.bind(unsafeQuery);
|
|
12735
12740
|
const inputValue = {
|
|
12736
12741
|
query: query.trim(),
|
|
@@ -12753,7 +12758,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12753
12758
|
else if (parameters !== void 0) return originalFile.call(sqlInstance, path$2, parameters);
|
|
12754
12759
|
else return originalFile.call(sqlInstance, path$2);
|
|
12755
12760
|
})();
|
|
12756
|
-
const creationContext = import_src$
|
|
12761
|
+
const creationContext = import_src$27.context.active();
|
|
12757
12762
|
const originalThen = fileQuery.then.bind(fileQuery);
|
|
12758
12763
|
const self = this;
|
|
12759
12764
|
const inputValue = {
|
|
@@ -12764,13 +12769,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12764
12769
|
fileQuery.then = function(onFulfilled, onRejected) {
|
|
12765
12770
|
if (fileQuery._tuskRecorded) return originalThen(onFulfilled, onRejected);
|
|
12766
12771
|
fileQuery._tuskRecorded = true;
|
|
12767
|
-
return import_src$
|
|
12772
|
+
return import_src$27.context.with(creationContext, () => {
|
|
12768
12773
|
if (self.mode === TuskDriftMode.RECORD) return handleRecordMode({
|
|
12769
12774
|
originalFunctionCall: () => originalThen(onFulfilled, onRejected),
|
|
12770
12775
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12771
12776
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
12772
12777
|
name: "postgres.file",
|
|
12773
|
-
kind: import_src$
|
|
12778
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12774
12779
|
submodule: "file",
|
|
12775
12780
|
packageType: PackageType.PG,
|
|
12776
12781
|
packageName: "postgres",
|
|
@@ -12782,7 +12787,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12782
12787
|
try {
|
|
12783
12788
|
logger.debug(`[PostgresInstrumentation] Postgres file query completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
12784
12789
|
addOutputAttributesToSpan(spanInfo, result);
|
|
12785
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12790
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12786
12791
|
} catch (error) {
|
|
12787
12792
|
logger.error(`[PostgresInstrumentation] error processing file query response:`, error);
|
|
12788
12793
|
}
|
|
@@ -12792,7 +12797,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12792
12797
|
try {
|
|
12793
12798
|
logger.debug(`[PostgresInstrumentation] Postgres file query error: ${error.message}`);
|
|
12794
12799
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12795
|
-
code: import_src$
|
|
12800
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12796
12801
|
message: error.message
|
|
12797
12802
|
});
|
|
12798
12803
|
} catch (spanError) {
|
|
@@ -12804,7 +12809,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12804
12809
|
return originalThen(wrappedOnFulfilled, wrappedOnRejected);
|
|
12805
12810
|
});
|
|
12806
12811
|
},
|
|
12807
|
-
spanKind: import_src$
|
|
12812
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
12808
12813
|
});
|
|
12809
12814
|
else if (self.mode === TuskDriftMode.REPLAY) {
|
|
12810
12815
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
@@ -12817,7 +12822,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12817
12822
|
replayModeHandler: () => {
|
|
12818
12823
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
12819
12824
|
name: "postgres.file",
|
|
12820
|
-
kind: import_src$
|
|
12825
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12821
12826
|
submodule: "file",
|
|
12822
12827
|
packageType: PackageType.PG,
|
|
12823
12828
|
packageName: "postgres",
|
|
@@ -12890,7 +12895,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12890
12895
|
replayModeHandler: () => {
|
|
12891
12896
|
return SpanUtils.createAndExecuteSpan(this.mode, () => executeBegin(), {
|
|
12892
12897
|
name: "postgres.begin",
|
|
12893
|
-
kind: import_src$
|
|
12898
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12894
12899
|
submodule: "transaction",
|
|
12895
12900
|
packageType: PackageType.PG,
|
|
12896
12901
|
packageName: "postgres",
|
|
@@ -12907,7 +12912,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12907
12912
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
12908
12913
|
return SpanUtils.createAndExecuteSpan(this.mode, executeBegin, {
|
|
12909
12914
|
name: "postgres.begin",
|
|
12910
|
-
kind: import_src$
|
|
12915
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
12911
12916
|
submodule: "transaction",
|
|
12912
12917
|
packageType: PackageType.PG,
|
|
12913
12918
|
packageName: "postgres",
|
|
@@ -12918,7 +12923,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12918
12923
|
return this._handleRecordBeginTransaction(spanInfo, executeBegin);
|
|
12919
12924
|
});
|
|
12920
12925
|
},
|
|
12921
|
-
spanKind: import_src$
|
|
12926
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
12922
12927
|
});
|
|
12923
12928
|
else return executeBegin();
|
|
12924
12929
|
}
|
|
@@ -12930,7 +12935,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12930
12935
|
status: "committed",
|
|
12931
12936
|
result
|
|
12932
12937
|
} });
|
|
12933
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
12938
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
12934
12939
|
} catch (error) {
|
|
12935
12940
|
logger.error(`[PostgresInstrumentation] error processing transaction response:`, error);
|
|
12936
12941
|
}
|
|
@@ -12943,7 +12948,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
12943
12948
|
error: error.message
|
|
12944
12949
|
} });
|
|
12945
12950
|
SpanUtils.endSpan(spanInfo.span, {
|
|
12946
|
-
code: import_src$
|
|
12951
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
12947
12952
|
message: error.message
|
|
12948
12953
|
});
|
|
12949
12954
|
} catch (spanError) {
|
|
@@ -13022,7 +13027,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13022
13027
|
packageName: "postgres",
|
|
13023
13028
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
13024
13029
|
submoduleName,
|
|
13025
|
-
kind: import_src$
|
|
13030
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13026
13031
|
stackTrace
|
|
13027
13032
|
},
|
|
13028
13033
|
tuskDrift: this.tuskDrift
|
|
@@ -13039,7 +13044,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13039
13044
|
state: result?.state,
|
|
13040
13045
|
statement: result?.statement
|
|
13041
13046
|
}));
|
|
13042
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13047
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13043
13048
|
logger.debug(`[PostgresInstrumentation] ${operation} completed, recorded ${allRows.length} rows`);
|
|
13044
13049
|
}
|
|
13045
13050
|
/**
|
|
@@ -13067,13 +13072,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13067
13072
|
}
|
|
13068
13073
|
_handleCursorCallbackRecord({ originalCursor, rows, inputValue, creationContext, userCallback }) {
|
|
13069
13074
|
const self = this;
|
|
13070
|
-
return import_src$
|
|
13075
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13071
13076
|
return handleRecordMode({
|
|
13072
13077
|
originalFunctionCall: () => originalCursor(rows, userCallback),
|
|
13073
13078
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
13074
13079
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCursor(rows, userCallback), {
|
|
13075
13080
|
name: "postgres.cursor",
|
|
13076
|
-
kind: import_src$
|
|
13081
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13077
13082
|
submodule: "cursor",
|
|
13078
13083
|
packageType: PackageType.PG,
|
|
13079
13084
|
packageName: "postgres",
|
|
@@ -13089,7 +13094,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13089
13094
|
});
|
|
13090
13095
|
});
|
|
13091
13096
|
},
|
|
13092
|
-
spanKind: import_src$
|
|
13097
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
13093
13098
|
});
|
|
13094
13099
|
});
|
|
13095
13100
|
}
|
|
@@ -13112,7 +13117,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13112
13117
|
logger.debug(`[PostgresInstrumentation] Cursor callback error: ${error.message}`);
|
|
13113
13118
|
if (spanInfo) try {
|
|
13114
13119
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13115
|
-
code: import_src$
|
|
13120
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13116
13121
|
message: error.message
|
|
13117
13122
|
});
|
|
13118
13123
|
} catch (error$1) {
|
|
@@ -13124,14 +13129,14 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13124
13129
|
_handleCursorCallbackReplay({ inputValue, creationContext, cursorBatchSize, userCallback }) {
|
|
13125
13130
|
const self = this;
|
|
13126
13131
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
13127
|
-
return import_src$
|
|
13132
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13128
13133
|
return handleReplayMode({
|
|
13129
13134
|
noOpRequestHandler: () => Promise.resolve(),
|
|
13130
13135
|
isServerRequest: false,
|
|
13131
13136
|
replayModeHandler: () => {
|
|
13132
13137
|
return SpanUtils.createAndExecuteSpan(self.mode, () => Promise.resolve(), {
|
|
13133
13138
|
name: "postgres.cursor",
|
|
13134
|
-
kind: import_src$
|
|
13139
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13135
13140
|
submodule: "cursor",
|
|
13136
13141
|
packageType: PackageType.PG,
|
|
13137
13142
|
packageName: "postgres",
|
|
@@ -13156,11 +13161,11 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13156
13161
|
logger.debug(`[PostgresInstrumentation] Cursor replay calling callback with batch of ${batch.length} rows`);
|
|
13157
13162
|
await userCallback(batch);
|
|
13158
13163
|
}
|
|
13159
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13164
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13160
13165
|
} catch (error) {
|
|
13161
13166
|
logger.debug(`[PostgresInstrumentation] Cursor callback replay error: ${error.message}`);
|
|
13162
13167
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13163
|
-
code: import_src$
|
|
13168
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13164
13169
|
message: error.message
|
|
13165
13170
|
});
|
|
13166
13171
|
throw error;
|
|
@@ -13180,7 +13185,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13180
13185
|
let spanStarted = false;
|
|
13181
13186
|
return {
|
|
13182
13187
|
async next() {
|
|
13183
|
-
return import_src$
|
|
13188
|
+
return import_src$27.context.with(creationContext, async () => {
|
|
13184
13189
|
if (!spanStarted) {
|
|
13185
13190
|
spanStarted = true;
|
|
13186
13191
|
let spanInputValue;
|
|
@@ -13192,7 +13197,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13192
13197
|
}
|
|
13193
13198
|
spanInfo = SpanUtils.createSpan({
|
|
13194
13199
|
name: "postgres.cursor",
|
|
13195
|
-
kind: import_src$
|
|
13200
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13196
13201
|
isPreAppStart: self.tuskDrift.isAppReady() ? false : true,
|
|
13197
13202
|
attributes: {
|
|
13198
13203
|
[TdSpanAttributes.NAME]: "postgres.cursor",
|
|
@@ -13227,7 +13232,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13227
13232
|
} catch (error) {
|
|
13228
13233
|
if (spanInfo) try {
|
|
13229
13234
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13230
|
-
code: import_src$
|
|
13235
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13231
13236
|
message: error.message
|
|
13232
13237
|
});
|
|
13233
13238
|
} catch (error$1) {
|
|
@@ -13262,12 +13267,12 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13262
13267
|
let dataFetched = false;
|
|
13263
13268
|
return {
|
|
13264
13269
|
async next() {
|
|
13265
|
-
return import_src$
|
|
13270
|
+
return import_src$27.context.with(creationContext, async () => {
|
|
13266
13271
|
if (!dataFetched) {
|
|
13267
13272
|
dataFetched = true;
|
|
13268
13273
|
spanInfo = SpanUtils.createSpan({
|
|
13269
13274
|
name: "postgres.cursor",
|
|
13270
|
-
kind: import_src$
|
|
13275
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13271
13276
|
isPreAppStart: self.tuskDrift.isAppReady() ? false : true,
|
|
13272
13277
|
attributes: {
|
|
13273
13278
|
[TdSpanAttributes.NAME]: "postgres.cursor",
|
|
@@ -13289,7 +13294,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13289
13294
|
});
|
|
13290
13295
|
if (!mockData) {
|
|
13291
13296
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13292
|
-
code: import_src$
|
|
13297
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13293
13298
|
message: "No mock data found"
|
|
13294
13299
|
});
|
|
13295
13300
|
throw new Error(`[PostgresInstrumentation] No matching mock found for cursor query: ${inputValue.query}`);
|
|
@@ -13299,7 +13304,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13299
13304
|
mockedData = Array.isArray(processedResult) ? processedResult : [];
|
|
13300
13305
|
}
|
|
13301
13306
|
if (currentIndex >= mockedData.length) {
|
|
13302
|
-
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13307
|
+
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13303
13308
|
return {
|
|
13304
13309
|
done: true,
|
|
13305
13310
|
value: void 0
|
|
@@ -13315,7 +13320,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13315
13320
|
});
|
|
13316
13321
|
},
|
|
13317
13322
|
async return() {
|
|
13318
|
-
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13323
|
+
if (spanInfo) SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13319
13324
|
return {
|
|
13320
13325
|
done: true,
|
|
13321
13326
|
value: void 0
|
|
@@ -13326,13 +13331,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13326
13331
|
}
|
|
13327
13332
|
_handleForEachRecord({ originalForEach, inputValue, creationContext, userCallback }) {
|
|
13328
13333
|
const self = this;
|
|
13329
|
-
return import_src$
|
|
13334
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13330
13335
|
return handleRecordMode({
|
|
13331
13336
|
originalFunctionCall: () => originalForEach(userCallback),
|
|
13332
13337
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
13333
13338
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalForEach(userCallback), {
|
|
13334
13339
|
name: "postgres.query",
|
|
13335
|
-
kind: import_src$
|
|
13340
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13336
13341
|
submodule: "query",
|
|
13337
13342
|
packageType: PackageType.PG,
|
|
13338
13343
|
packageName: "postgres",
|
|
@@ -13356,7 +13361,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13356
13361
|
} catch (error) {
|
|
13357
13362
|
try {
|
|
13358
13363
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13359
|
-
code: import_src$
|
|
13364
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13360
13365
|
message: error.message
|
|
13361
13366
|
});
|
|
13362
13367
|
} catch (error$1) {
|
|
@@ -13366,14 +13371,14 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13366
13371
|
}
|
|
13367
13372
|
});
|
|
13368
13373
|
},
|
|
13369
|
-
spanKind: import_src$
|
|
13374
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
13370
13375
|
});
|
|
13371
13376
|
});
|
|
13372
13377
|
}
|
|
13373
13378
|
_handleForEachReplay({ inputValue, creationContext, userCallback }) {
|
|
13374
13379
|
const self = this;
|
|
13375
13380
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
13376
|
-
return import_src$
|
|
13381
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13377
13382
|
return handleReplayMode({
|
|
13378
13383
|
noOpRequestHandler: () => Promise.resolve(Object.assign([], {
|
|
13379
13384
|
count: 0,
|
|
@@ -13386,7 +13391,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13386
13391
|
command: null
|
|
13387
13392
|
})), {
|
|
13388
13393
|
name: "postgres.query",
|
|
13389
|
-
kind: import_src$
|
|
13394
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13390
13395
|
submodule: "query",
|
|
13391
13396
|
packageType: PackageType.PG,
|
|
13392
13397
|
packageName: "postgres",
|
|
@@ -13406,7 +13411,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13406
13411
|
const mockedRows = Array.isArray(mockedResult) ? mockedResult : [];
|
|
13407
13412
|
logger.debug(`[PostgresInstrumentation] forEach replay: calling callback with ${mockedRows.length} mocked rows`);
|
|
13408
13413
|
for (const row of mockedRows) userCallback(row, mockedResult);
|
|
13409
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13414
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13410
13415
|
return Object.assign([], {
|
|
13411
13416
|
count: mockedRows.length,
|
|
13412
13417
|
command: null
|
|
@@ -13414,7 +13419,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13414
13419
|
} catch (error) {
|
|
13415
13420
|
logger.debug(`[PostgresInstrumentation] forEach replay error: ${error.message}`);
|
|
13416
13421
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13417
|
-
code: import_src$
|
|
13422
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13418
13423
|
message: error.message
|
|
13419
13424
|
});
|
|
13420
13425
|
throw error;
|
|
@@ -13434,13 +13439,13 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13434
13439
|
if (query._forEachCalled) return originalThen(onFulfilled, onRejected);
|
|
13435
13440
|
if (query._tuskRecorded) return originalThen(onFulfilled, onRejected);
|
|
13436
13441
|
query._tuskRecorded = true;
|
|
13437
|
-
return import_src$
|
|
13442
|
+
return import_src$27.context.with(creationContext, () => {
|
|
13438
13443
|
if (self.mode === TuskDriftMode.RECORD) return handleRecordMode({
|
|
13439
13444
|
originalFunctionCall: () => originalThen(onFulfilled, onRejected),
|
|
13440
13445
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
13441
13446
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
13442
13447
|
name: spanConfig.name,
|
|
13443
|
-
kind: import_src$
|
|
13448
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13444
13449
|
submodule: spanConfig.submodule,
|
|
13445
13450
|
packageType: PackageType.PG,
|
|
13446
13451
|
packageName: "postgres",
|
|
@@ -13452,7 +13457,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13452
13457
|
try {
|
|
13453
13458
|
logger.debug(`[PostgresInstrumentation] Postgres ${spanConfig.operationType} query completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
13454
13459
|
addOutputAttributesToSpan(spanInfo, result);
|
|
13455
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
13460
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$27.SpanStatusCode.OK });
|
|
13456
13461
|
} catch (error) {
|
|
13457
13462
|
logger.error(`[PostgresInstrumentation] error processing ${spanConfig.operationType} query response:`, error);
|
|
13458
13463
|
}
|
|
@@ -13462,7 +13467,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13462
13467
|
try {
|
|
13463
13468
|
logger.debug(`[PostgresInstrumentation] Postgres ${spanConfig.operationType} query error: ${error.message}`);
|
|
13464
13469
|
SpanUtils.endSpan(spanInfo.span, {
|
|
13465
|
-
code: import_src$
|
|
13470
|
+
code: import_src$27.SpanStatusCode.ERROR,
|
|
13466
13471
|
message: error.message
|
|
13467
13472
|
});
|
|
13468
13473
|
} catch (spanError) {
|
|
@@ -13474,7 +13479,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13474
13479
|
return originalThen(wrappedOnFulfilled, wrappedOnRejected);
|
|
13475
13480
|
});
|
|
13476
13481
|
},
|
|
13477
|
-
spanKind: import_src$
|
|
13482
|
+
spanKind: import_src$27.SpanKind.CLIENT
|
|
13478
13483
|
});
|
|
13479
13484
|
else if (self.mode === TuskDriftMode.REPLAY) {
|
|
13480
13485
|
const stackTrace = captureStackTrace(["PostgresInstrumentation"]);
|
|
@@ -13487,7 +13492,7 @@ var PostgresInstrumentation = class extends TdInstrumentationBase {
|
|
|
13487
13492
|
replayModeHandler: () => {
|
|
13488
13493
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalThen(onFulfilled, onRejected), {
|
|
13489
13494
|
name: spanConfig.name,
|
|
13490
|
-
kind: import_src$
|
|
13495
|
+
kind: import_src$27.SpanKind.CLIENT,
|
|
13491
13496
|
submodule: spanConfig.submodule,
|
|
13492
13497
|
packageType: PackageType.PG,
|
|
13493
13498
|
packageName: "postgres",
|
|
@@ -13768,7 +13773,7 @@ var TdMysqlConnectionMock = class extends EventEmitter {
|
|
|
13768
13773
|
|
|
13769
13774
|
//#endregion
|
|
13770
13775
|
//#region src/instrumentation/libraries/mysql/mocks/TdMysqlQueryMock.ts
|
|
13771
|
-
var import_src$
|
|
13776
|
+
var import_src$26 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
13772
13777
|
/**
|
|
13773
13778
|
* Handles replay mode for MySQL query operations
|
|
13774
13779
|
* Returns EventEmitters synchronously to support both callback and streaming modes
|
|
@@ -13889,7 +13894,7 @@ var TdMysqlQueryMock = class {
|
|
|
13889
13894
|
packageName: "mysql",
|
|
13890
13895
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
13891
13896
|
submoduleName: "query",
|
|
13892
|
-
kind: import_src$
|
|
13897
|
+
kind: import_src$26.SpanKind.CLIENT,
|
|
13893
13898
|
stackTrace
|
|
13894
13899
|
},
|
|
13895
13900
|
tuskDrift: this.tuskDrift
|
|
@@ -13899,7 +13904,7 @@ var TdMysqlQueryMock = class {
|
|
|
13899
13904
|
|
|
13900
13905
|
//#endregion
|
|
13901
13906
|
//#region src/instrumentation/libraries/mysql/Instrumentation.ts
|
|
13902
|
-
var import_src$
|
|
13907
|
+
var import_src$25 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
13903
13908
|
var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
13904
13909
|
constructor(config = {}) {
|
|
13905
13910
|
super("mysql", config);
|
|
@@ -14142,7 +14147,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14142
14147
|
replayModeHandler: () => {
|
|
14143
14148
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
14144
14149
|
name: "mysql.query",
|
|
14145
|
-
kind: import_src$
|
|
14150
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14146
14151
|
submodule: "query",
|
|
14147
14152
|
packageType: PackageType.MYSQL,
|
|
14148
14153
|
packageName: "mysql",
|
|
@@ -14168,7 +14173,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14168
14173
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14169
14174
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
14170
14175
|
name: "mysql.query",
|
|
14171
|
-
kind: import_src$
|
|
14176
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14172
14177
|
submodule: "query",
|
|
14173
14178
|
packageType: PackageType.MYSQL,
|
|
14174
14179
|
packageName: "mysql",
|
|
@@ -14179,7 +14184,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14179
14184
|
return self._handleRecordQuery(spanInfo, originalQuery, this, args, callback, isEventEmitterMode);
|
|
14180
14185
|
});
|
|
14181
14186
|
},
|
|
14182
|
-
spanKind: import_src$
|
|
14187
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14183
14188
|
});
|
|
14184
14189
|
else return originalQuery.apply(this, args);
|
|
14185
14190
|
};
|
|
@@ -14210,7 +14215,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14210
14215
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14211
14216
|
return originalConnect.apply(this, arguments);
|
|
14212
14217
|
},
|
|
14213
|
-
spanKind: import_src$
|
|
14218
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14214
14219
|
});
|
|
14215
14220
|
else return originalConnect.apply(this, arguments);
|
|
14216
14221
|
};
|
|
@@ -14235,7 +14240,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14235
14240
|
replayModeHandler: () => {
|
|
14236
14241
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(this, arguments), {
|
|
14237
14242
|
name: "mysql.beginTransaction",
|
|
14238
|
-
kind: import_src$
|
|
14243
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14239
14244
|
submodule: "transaction",
|
|
14240
14245
|
packageType: PackageType.MYSQL,
|
|
14241
14246
|
packageName: "mysql",
|
|
@@ -14252,7 +14257,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14252
14257
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14253
14258
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(this, arguments), {
|
|
14254
14259
|
name: "mysql.beginTransaction",
|
|
14255
|
-
kind: import_src$
|
|
14260
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14256
14261
|
submodule: "transaction",
|
|
14257
14262
|
packageType: PackageType.MYSQL,
|
|
14258
14263
|
packageName: "mysql",
|
|
@@ -14263,7 +14268,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14263
14268
|
return self._handleRecordTransaction(spanInfo, originalBeginTransaction, this, arguments, actualCallback);
|
|
14264
14269
|
});
|
|
14265
14270
|
},
|
|
14266
|
-
spanKind: import_src$
|
|
14271
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14267
14272
|
});
|
|
14268
14273
|
else return originalBeginTransaction.apply(this, arguments);
|
|
14269
14274
|
};
|
|
@@ -14288,7 +14293,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14288
14293
|
replayModeHandler: () => {
|
|
14289
14294
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(this, arguments), {
|
|
14290
14295
|
name: "mysql.commit",
|
|
14291
|
-
kind: import_src$
|
|
14296
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14292
14297
|
submodule: "transaction",
|
|
14293
14298
|
packageType: PackageType.MYSQL,
|
|
14294
14299
|
packageName: "mysql",
|
|
@@ -14305,7 +14310,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14305
14310
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14306
14311
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(this, arguments), {
|
|
14307
14312
|
name: "mysql.commit",
|
|
14308
|
-
kind: import_src$
|
|
14313
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14309
14314
|
submodule: "transaction",
|
|
14310
14315
|
packageType: PackageType.MYSQL,
|
|
14311
14316
|
packageName: "mysql",
|
|
@@ -14316,7 +14321,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14316
14321
|
return self._handleRecordTransaction(spanInfo, originalCommit, this, arguments, actualCallback);
|
|
14317
14322
|
});
|
|
14318
14323
|
},
|
|
14319
|
-
spanKind: import_src$
|
|
14324
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14320
14325
|
});
|
|
14321
14326
|
else return originalCommit.apply(this, arguments);
|
|
14322
14327
|
};
|
|
@@ -14341,7 +14346,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14341
14346
|
replayModeHandler: () => {
|
|
14342
14347
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(this, arguments), {
|
|
14343
14348
|
name: "mysql.rollback",
|
|
14344
|
-
kind: import_src$
|
|
14349
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14345
14350
|
submodule: "transaction",
|
|
14346
14351
|
packageType: PackageType.MYSQL,
|
|
14347
14352
|
packageName: "mysql",
|
|
@@ -14358,7 +14363,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14358
14363
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14359
14364
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(this, arguments), {
|
|
14360
14365
|
name: "mysql.rollback",
|
|
14361
|
-
kind: import_src$
|
|
14366
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14362
14367
|
submodule: "transaction",
|
|
14363
14368
|
packageType: PackageType.MYSQL,
|
|
14364
14369
|
packageName: "mysql",
|
|
@@ -14369,7 +14374,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14369
14374
|
return self._handleRecordTransaction(spanInfo, originalRollback, this, arguments, actualCallback);
|
|
14370
14375
|
});
|
|
14371
14376
|
},
|
|
14372
|
-
spanKind: import_src$
|
|
14377
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14373
14378
|
});
|
|
14374
14379
|
else return originalRollback.apply(this, arguments);
|
|
14375
14380
|
};
|
|
@@ -14396,7 +14401,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14396
14401
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14397
14402
|
return originalPing.apply(this, arguments);
|
|
14398
14403
|
},
|
|
14399
|
-
spanKind: import_src$
|
|
14404
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14400
14405
|
});
|
|
14401
14406
|
else return originalPing.apply(this, arguments);
|
|
14402
14407
|
};
|
|
@@ -14425,7 +14430,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14425
14430
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14426
14431
|
return originalEnd.apply(this, arguments);
|
|
14427
14432
|
},
|
|
14428
|
-
spanKind: import_src$
|
|
14433
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14429
14434
|
});
|
|
14430
14435
|
else return originalEnd.apply(this, arguments);
|
|
14431
14436
|
};
|
|
@@ -14454,7 +14459,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14454
14459
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14455
14460
|
return originalChangeUser.apply(this, arguments);
|
|
14456
14461
|
},
|
|
14457
|
-
spanKind: import_src$
|
|
14462
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14458
14463
|
});
|
|
14459
14464
|
else return originalChangeUser.apply(this, arguments);
|
|
14460
14465
|
};
|
|
@@ -14520,7 +14525,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14520
14525
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14521
14526
|
return originalEnd.apply(this, arguments);
|
|
14522
14527
|
},
|
|
14523
|
-
spanKind: import_src$
|
|
14528
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14524
14529
|
});
|
|
14525
14530
|
else return originalEnd.apply(this, arguments);
|
|
14526
14531
|
};
|
|
@@ -14543,7 +14548,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14543
14548
|
replayModeHandler: () => {
|
|
14544
14549
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
14545
14550
|
name: `mysql.pool.getConnection`,
|
|
14546
|
-
kind: import_src$
|
|
14551
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14547
14552
|
submodule: "getConnection",
|
|
14548
14553
|
packageName: "mysql",
|
|
14549
14554
|
packageType: PackageType.MYSQL,
|
|
@@ -14560,7 +14565,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14560
14565
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14561
14566
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
14562
14567
|
name: `mysql.pool.getConnection`,
|
|
14563
|
-
kind: import_src$
|
|
14568
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14564
14569
|
submodule: "getConnection",
|
|
14565
14570
|
packageName: "mysql",
|
|
14566
14571
|
packageType: PackageType.MYSQL,
|
|
@@ -14571,7 +14576,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14571
14576
|
return self._handleRecordPoolGetConnectionInSpan(spanInfo, originalGetConnection, callback, this);
|
|
14572
14577
|
});
|
|
14573
14578
|
},
|
|
14574
|
-
spanKind: import_src$
|
|
14579
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14575
14580
|
});
|
|
14576
14581
|
else return originalGetConnection.apply(this, [callback]);
|
|
14577
14582
|
};
|
|
@@ -14615,7 +14620,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14615
14620
|
replayModeHandler: () => {
|
|
14616
14621
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(connection, args), {
|
|
14617
14622
|
name: "mysql.query",
|
|
14618
|
-
kind: import_src$
|
|
14623
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14619
14624
|
submodule: "query",
|
|
14620
14625
|
packageType: PackageType.MYSQL,
|
|
14621
14626
|
packageName: "mysql",
|
|
@@ -14641,7 +14646,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14641
14646
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14642
14647
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(connection, args), {
|
|
14643
14648
|
name: "mysql.query",
|
|
14644
|
-
kind: import_src$
|
|
14649
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14645
14650
|
submodule: "query",
|
|
14646
14651
|
packageType: PackageType.MYSQL,
|
|
14647
14652
|
packageName: "mysql",
|
|
@@ -14652,7 +14657,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14652
14657
|
return self._handleRecordQuery(spanInfo, originalQuery, connection, args, callback, isEventEmitterMode);
|
|
14653
14658
|
});
|
|
14654
14659
|
},
|
|
14655
|
-
spanKind: import_src$
|
|
14660
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14656
14661
|
});
|
|
14657
14662
|
else return originalQuery.apply(connection, args);
|
|
14658
14663
|
};
|
|
@@ -14690,7 +14695,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14690
14695
|
};
|
|
14691
14696
|
if (error) try {
|
|
14692
14697
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14693
|
-
code: import_src$
|
|
14698
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14694
14699
|
message: error.message
|
|
14695
14700
|
});
|
|
14696
14701
|
} catch (error$1) {
|
|
@@ -14698,7 +14703,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14698
14703
|
}
|
|
14699
14704
|
else try {
|
|
14700
14705
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
14701
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14706
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14702
14707
|
} catch (error$1) {
|
|
14703
14708
|
logger.error(`[MysqlInstrumentation] error ending span:`, error$1);
|
|
14704
14709
|
}
|
|
@@ -14712,7 +14717,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14712
14717
|
queryObject._callback = function(err, results, fields) {
|
|
14713
14718
|
if (err) try {
|
|
14714
14719
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14715
|
-
code: import_src$
|
|
14720
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14716
14721
|
message: err.message
|
|
14717
14722
|
});
|
|
14718
14723
|
} catch (error) {
|
|
@@ -14724,7 +14729,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14724
14729
|
fields
|
|
14725
14730
|
};
|
|
14726
14731
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
14727
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14732
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14728
14733
|
} catch (error) {
|
|
14729
14734
|
logger.error(`[MysqlInstrumentation] error ending span:`, error);
|
|
14730
14735
|
}
|
|
@@ -14738,7 +14743,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14738
14743
|
args[callbackIndex] = function(err, results, fields) {
|
|
14739
14744
|
if (err) try {
|
|
14740
14745
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14741
|
-
code: import_src$
|
|
14746
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14742
14747
|
message: err.message
|
|
14743
14748
|
});
|
|
14744
14749
|
} catch (error) {
|
|
@@ -14750,7 +14755,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14750
14755
|
fields
|
|
14751
14756
|
};
|
|
14752
14757
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
14753
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14758
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14754
14759
|
} catch (error) {
|
|
14755
14760
|
logger.error(`[MysqlInstrumentation] error ending span:`, error);
|
|
14756
14761
|
}
|
|
@@ -14778,7 +14783,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14778
14783
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14779
14784
|
return originalConnect.apply(connection, arguments);
|
|
14780
14785
|
},
|
|
14781
|
-
spanKind: import_src$
|
|
14786
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14782
14787
|
});
|
|
14783
14788
|
else return originalConnect.apply(connection, arguments);
|
|
14784
14789
|
};
|
|
@@ -14800,7 +14805,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14800
14805
|
replayModeHandler: () => {
|
|
14801
14806
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(connection, arguments), {
|
|
14802
14807
|
name: "mysql.beginTransaction",
|
|
14803
|
-
kind: import_src$
|
|
14808
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14804
14809
|
submodule: "transaction",
|
|
14805
14810
|
packageType: PackageType.MYSQL,
|
|
14806
14811
|
packageName: "mysql",
|
|
@@ -14817,7 +14822,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14817
14822
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14818
14823
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalBeginTransaction.apply(connection, arguments), {
|
|
14819
14824
|
name: "mysql.beginTransaction",
|
|
14820
|
-
kind: import_src$
|
|
14825
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14821
14826
|
submodule: "transaction",
|
|
14822
14827
|
packageType: PackageType.MYSQL,
|
|
14823
14828
|
packageName: "mysql",
|
|
@@ -14828,7 +14833,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14828
14833
|
return self._handleRecordTransaction(spanInfo, originalBeginTransaction, connection, arguments, actualCallback);
|
|
14829
14834
|
});
|
|
14830
14835
|
},
|
|
14831
|
-
spanKind: import_src$
|
|
14836
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14832
14837
|
});
|
|
14833
14838
|
else return originalBeginTransaction.apply(connection, arguments);
|
|
14834
14839
|
};
|
|
@@ -14850,7 +14855,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14850
14855
|
replayModeHandler: () => {
|
|
14851
14856
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(connection, arguments), {
|
|
14852
14857
|
name: "mysql.commit",
|
|
14853
|
-
kind: import_src$
|
|
14858
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14854
14859
|
submodule: "transaction",
|
|
14855
14860
|
packageType: PackageType.MYSQL,
|
|
14856
14861
|
packageName: "mysql",
|
|
@@ -14867,7 +14872,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14867
14872
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14868
14873
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCommit.apply(connection, arguments), {
|
|
14869
14874
|
name: "mysql.commit",
|
|
14870
|
-
kind: import_src$
|
|
14875
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14871
14876
|
submodule: "transaction",
|
|
14872
14877
|
packageType: PackageType.MYSQL,
|
|
14873
14878
|
packageName: "mysql",
|
|
@@ -14878,7 +14883,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14878
14883
|
return self._handleRecordTransaction(spanInfo, originalCommit, connection, arguments, actualCallback);
|
|
14879
14884
|
});
|
|
14880
14885
|
},
|
|
14881
|
-
spanKind: import_src$
|
|
14886
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14882
14887
|
});
|
|
14883
14888
|
else return originalCommit.apply(connection, arguments);
|
|
14884
14889
|
};
|
|
@@ -14900,7 +14905,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14900
14905
|
replayModeHandler: () => {
|
|
14901
14906
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(connection, arguments), {
|
|
14902
14907
|
name: "mysql.rollback",
|
|
14903
|
-
kind: import_src$
|
|
14908
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14904
14909
|
submodule: "transaction",
|
|
14905
14910
|
packageType: PackageType.MYSQL,
|
|
14906
14911
|
packageName: "mysql",
|
|
@@ -14917,7 +14922,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14917
14922
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
14918
14923
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalRollback.apply(connection, arguments), {
|
|
14919
14924
|
name: "mysql.rollback",
|
|
14920
|
-
kind: import_src$
|
|
14925
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
14921
14926
|
submodule: "transaction",
|
|
14922
14927
|
packageType: PackageType.MYSQL,
|
|
14923
14928
|
packageName: "mysql",
|
|
@@ -14928,7 +14933,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14928
14933
|
return self._handleRecordTransaction(spanInfo, originalRollback, connection, arguments, actualCallback);
|
|
14929
14934
|
});
|
|
14930
14935
|
},
|
|
14931
|
-
spanKind: import_src$
|
|
14936
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
14932
14937
|
});
|
|
14933
14938
|
else return originalRollback.apply(connection, arguments);
|
|
14934
14939
|
};
|
|
@@ -14939,7 +14944,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14939
14944
|
const result = originalFunction.apply(connection, args);
|
|
14940
14945
|
try {
|
|
14941
14946
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { status: "success" } });
|
|
14942
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14947
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14943
14948
|
} catch (error) {
|
|
14944
14949
|
logger.error(`[MysqlInstrumentation] error adding span attributes:`, error);
|
|
14945
14950
|
}
|
|
@@ -14947,7 +14952,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14947
14952
|
} catch (error) {
|
|
14948
14953
|
try {
|
|
14949
14954
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14950
|
-
code: import_src$
|
|
14955
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14951
14956
|
message: error.message
|
|
14952
14957
|
});
|
|
14953
14958
|
} catch (error$1) {
|
|
@@ -14962,7 +14967,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14962
14967
|
argsArray[callbackIndex] = function(err) {
|
|
14963
14968
|
if (err) try {
|
|
14964
14969
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14965
|
-
code: import_src$
|
|
14970
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14966
14971
|
message: err.message
|
|
14967
14972
|
});
|
|
14968
14973
|
} catch (error) {
|
|
@@ -14970,14 +14975,14 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14970
14975
|
}
|
|
14971
14976
|
else try {
|
|
14972
14977
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { status: "success" } });
|
|
14973
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
14978
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
14974
14979
|
} catch (error) {
|
|
14975
14980
|
logger.error(`[MysqlInstrumentation] error ending span:`, error);
|
|
14976
14981
|
}
|
|
14977
14982
|
logger.debug(`[MysqlInstrumentation] Transaction completed`);
|
|
14978
14983
|
return originalCallback.apply(this, arguments);
|
|
14979
14984
|
};
|
|
14980
|
-
argsArray[callbackIndex] = import_src$
|
|
14985
|
+
argsArray[callbackIndex] = import_src$25.context.bind(spanInfo.context, argsArray[callbackIndex]);
|
|
14981
14986
|
}
|
|
14982
14987
|
return originalFunction.apply(connection, argsArray);
|
|
14983
14988
|
}
|
|
@@ -14994,7 +14999,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
14994
14999
|
if (error) {
|
|
14995
15000
|
logger.debug(`[MysqlInstrumentation] MySQL Pool getConnection error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
14996
15001
|
SpanUtils.endSpan(spanInfo.span, {
|
|
14997
|
-
code: import_src$
|
|
15002
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
14998
15003
|
message: error.message
|
|
14999
15004
|
});
|
|
15000
15005
|
} else {
|
|
@@ -15010,9 +15015,9 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15010
15015
|
connected: true,
|
|
15011
15016
|
hasConnection: !!connection
|
|
15012
15017
|
} });
|
|
15013
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
15018
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
15014
15019
|
}
|
|
15015
|
-
return import_src$
|
|
15020
|
+
return import_src$25.context.bind(spanInfo.context, callback)(error, connection);
|
|
15016
15021
|
};
|
|
15017
15022
|
return originalGetConnection.call(poolContext, wrappedCallback);
|
|
15018
15023
|
} else try {
|
|
@@ -15021,11 +15026,11 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15021
15026
|
connected: true,
|
|
15022
15027
|
hasConnection: true
|
|
15023
15028
|
} });
|
|
15024
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
15029
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
15025
15030
|
return result;
|
|
15026
15031
|
} catch (error) {
|
|
15027
15032
|
SpanUtils.endSpan(spanInfo.span, {
|
|
15028
|
-
code: import_src$
|
|
15033
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
15029
15034
|
message: error.message
|
|
15030
15035
|
});
|
|
15031
15036
|
throw error;
|
|
@@ -15102,7 +15107,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15102
15107
|
replayModeHandler: () => {
|
|
15103
15108
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalStream.apply(queryInstance, arguments), {
|
|
15104
15109
|
name: "mysql.stream",
|
|
15105
|
-
kind: import_src$
|
|
15110
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15106
15111
|
submodule: "stream",
|
|
15107
15112
|
packageType: PackageType.MYSQL,
|
|
15108
15113
|
packageName: "mysql",
|
|
@@ -15119,7 +15124,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15119
15124
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
15120
15125
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalStream.apply(queryInstance, arguments), {
|
|
15121
15126
|
name: "mysql.stream",
|
|
15122
|
-
kind: import_src$
|
|
15127
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15123
15128
|
submodule: "stream",
|
|
15124
15129
|
packageType: PackageType.MYSQL,
|
|
15125
15130
|
packageName: "mysql",
|
|
@@ -15130,7 +15135,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15130
15135
|
return self._handleRecordStream(spanInfo, originalStream, queryInstance, streamOptions);
|
|
15131
15136
|
});
|
|
15132
15137
|
},
|
|
15133
|
-
spanKind: import_src$
|
|
15138
|
+
spanKind: import_src$25.SpanKind.CLIENT
|
|
15134
15139
|
});
|
|
15135
15140
|
else return originalStream.apply(queryInstance, arguments);
|
|
15136
15141
|
};
|
|
@@ -15203,7 +15208,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15203
15208
|
const isMultiStatementQuery = queryCount > 1;
|
|
15204
15209
|
if (error) try {
|
|
15205
15210
|
SpanUtils.endSpan(spanInfo.span, {
|
|
15206
|
-
code: import_src$
|
|
15211
|
+
code: import_src$25.SpanStatusCode.ERROR,
|
|
15207
15212
|
message: error.message
|
|
15208
15213
|
});
|
|
15209
15214
|
} catch (err) {
|
|
@@ -15221,7 +15226,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15221
15226
|
queryCount
|
|
15222
15227
|
};
|
|
15223
15228
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
15224
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
15229
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$25.SpanStatusCode.OK });
|
|
15225
15230
|
} catch (err) {
|
|
15226
15231
|
logger.error(`[MysqlInstrumentation] error ending span:`, err);
|
|
15227
15232
|
}
|
|
@@ -15330,7 +15335,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15330
15335
|
replayModeHandler: () => {
|
|
15331
15336
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
15332
15337
|
name: "mysql.query",
|
|
15333
|
-
kind: import_src$
|
|
15338
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15334
15339
|
submodule: "query",
|
|
15335
15340
|
packageType: PackageType.MYSQL,
|
|
15336
15341
|
packageName: "mysql",
|
|
@@ -15379,7 +15384,7 @@ var MysqlInstrumentation = class extends TdInstrumentationBase {
|
|
|
15379
15384
|
replayModeHandler: () => {
|
|
15380
15385
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(namespace, [callback]), {
|
|
15381
15386
|
name: `mysql.poolNamespace.getConnection`,
|
|
15382
|
-
kind: import_src$
|
|
15387
|
+
kind: import_src$25.SpanKind.CLIENT,
|
|
15383
15388
|
submodule: "getConnection",
|
|
15384
15389
|
packageName: "mysql",
|
|
15385
15390
|
packageType: PackageType.MYSQL,
|
|
@@ -15556,7 +15561,7 @@ var TdMysql2ConnectionMock = class extends EventEmitter {
|
|
|
15556
15561
|
|
|
15557
15562
|
//#endregion
|
|
15558
15563
|
//#region src/instrumentation/libraries/mysql2/mocks/TdMysql2QueryMock.ts
|
|
15559
|
-
var import_src$
|
|
15564
|
+
var import_src$24 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
15560
15565
|
/**
|
|
15561
15566
|
* Handles replay mode for MySQL2 query operations
|
|
15562
15567
|
*/
|
|
@@ -15653,7 +15658,7 @@ var TdMysql2QueryMock = class {
|
|
|
15653
15658
|
packageName: "mysql2",
|
|
15654
15659
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
15655
15660
|
submoduleName,
|
|
15656
|
-
kind: import_src$
|
|
15661
|
+
kind: import_src$24.SpanKind.CLIENT,
|
|
15657
15662
|
stackTrace
|
|
15658
15663
|
},
|
|
15659
15664
|
tuskDrift: this.tuskDrift
|
|
@@ -15680,7 +15685,7 @@ var TdMysql2QueryMock = class {
|
|
|
15680
15685
|
|
|
15681
15686
|
//#endregion
|
|
15682
15687
|
//#region src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionEventMock.ts
|
|
15683
|
-
var import_src$
|
|
15688
|
+
var import_src$23 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
15684
15689
|
/**
|
|
15685
15690
|
* Mock for MySQL2 connection events (connect/error)
|
|
15686
15691
|
* Handles replay of recorded connection establishment events in REPLAY mode
|
|
@@ -15709,7 +15714,7 @@ var TdMysql2ConnectionEventMock = class {
|
|
|
15709
15714
|
packageName: "mysql2",
|
|
15710
15715
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
15711
15716
|
submoduleName: "connectEvent",
|
|
15712
|
-
kind: import_src$
|
|
15717
|
+
kind: import_src$23.SpanKind.CLIENT
|
|
15713
15718
|
},
|
|
15714
15719
|
tuskDrift: this.tuskDrift
|
|
15715
15720
|
});
|
|
@@ -15727,7 +15732,7 @@ var TdMysql2ConnectionEventMock = class {
|
|
|
15727
15732
|
|
|
15728
15733
|
//#endregion
|
|
15729
15734
|
//#region src/instrumentation/libraries/mysql2/Instrumentation.ts
|
|
15730
|
-
var import_src$
|
|
15735
|
+
var import_src$22 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
15731
15736
|
const COMPLETE_SUPPORTED_VERSIONS = ">=2.3.3 <4.0.0";
|
|
15732
15737
|
const V2_3_3_TO_3_11_4 = ">=2.3.3 <3.11.5";
|
|
15733
15738
|
const V3_11_5_TO_4_0 = ">=3.11.5 <4.0.0";
|
|
@@ -15955,7 +15960,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
15955
15960
|
const spanName = `mysql2.${clientType}.query`;
|
|
15956
15961
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
15957
15962
|
name: spanName,
|
|
15958
|
-
kind: import_src$
|
|
15963
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
15959
15964
|
submodule: "query",
|
|
15960
15965
|
packageType: PackageType.MYSQL,
|
|
15961
15966
|
packageName: "mysql2",
|
|
@@ -15973,7 +15978,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
15973
15978
|
const spanName = `mysql2.${clientType}.query`;
|
|
15974
15979
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalQuery.apply(this, args), {
|
|
15975
15980
|
name: spanName,
|
|
15976
|
-
kind: import_src$
|
|
15981
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
15977
15982
|
submodule: "query",
|
|
15978
15983
|
packageType: PackageType.MYSQL,
|
|
15979
15984
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -15984,7 +15989,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
15984
15989
|
return self._handleRecordQueryInSpan(spanInfo, originalQuery, queryConfig, args, this);
|
|
15985
15990
|
});
|
|
15986
15991
|
},
|
|
15987
|
-
spanKind: import_src$
|
|
15992
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
15988
15993
|
});
|
|
15989
15994
|
else return originalQuery.apply(this, args);
|
|
15990
15995
|
};
|
|
@@ -16020,7 +16025,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16020
16025
|
const spanName = `mysql2.${clientType}.execute`;
|
|
16021
16026
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExecute.apply(this, args), {
|
|
16022
16027
|
name: spanName,
|
|
16023
|
-
kind: import_src$
|
|
16028
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16024
16029
|
submodule: "execute",
|
|
16025
16030
|
packageType: PackageType.MYSQL,
|
|
16026
16031
|
packageName: "mysql2",
|
|
@@ -16038,7 +16043,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16038
16043
|
const spanName = `mysql2.${clientType}.execute`;
|
|
16039
16044
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExecute.apply(this, args), {
|
|
16040
16045
|
name: spanName,
|
|
16041
|
-
kind: import_src$
|
|
16046
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16042
16047
|
submodule: "execute",
|
|
16043
16048
|
packageType: PackageType.MYSQL,
|
|
16044
16049
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16049,7 +16054,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16049
16054
|
return self._handleRecordQueryInSpan(spanInfo, originalExecute, queryConfig, args, this);
|
|
16050
16055
|
});
|
|
16051
16056
|
},
|
|
16052
|
-
spanKind: import_src$
|
|
16057
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16053
16058
|
});
|
|
16054
16059
|
else return originalExecute.apply(this, args);
|
|
16055
16060
|
};
|
|
@@ -16068,7 +16073,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16068
16073
|
replayModeHandler: () => {
|
|
16069
16074
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
16070
16075
|
name: `mysql2.pool.getConnection`,
|
|
16071
|
-
kind: import_src$
|
|
16076
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16072
16077
|
submodule: "getConnection",
|
|
16073
16078
|
packageName: "mysql2",
|
|
16074
16079
|
packageType: PackageType.MYSQL,
|
|
@@ -16085,7 +16090,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16085
16090
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16086
16091
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGetConnection.apply(this, [callback]), {
|
|
16087
16092
|
name: `mysql2.pool.getConnection`,
|
|
16088
|
-
kind: import_src$
|
|
16093
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16089
16094
|
submodule: "getConnection",
|
|
16090
16095
|
packageName: "mysql2",
|
|
16091
16096
|
packageType: PackageType.MYSQL,
|
|
@@ -16096,7 +16101,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16096
16101
|
return self._handleRecordPoolGetConnectionInSpan(spanInfo, originalGetConnection, callback, this);
|
|
16097
16102
|
});
|
|
16098
16103
|
},
|
|
16099
|
-
spanKind: import_src$
|
|
16104
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16100
16105
|
});
|
|
16101
16106
|
else return originalGetConnection.apply(this, [callback]);
|
|
16102
16107
|
};
|
|
@@ -16119,7 +16124,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16119
16124
|
replayModeHandler: () => {
|
|
16120
16125
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
16121
16126
|
name: `mysql2.${clientType}.connect`,
|
|
16122
|
-
kind: import_src$
|
|
16127
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16123
16128
|
submodule: "connect",
|
|
16124
16129
|
packageName: "mysql2",
|
|
16125
16130
|
packageType: PackageType.MYSQL,
|
|
@@ -16140,7 +16145,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16140
16145
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16141
16146
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, [callback]), {
|
|
16142
16147
|
name: `mysql2.${clientType}.connect`,
|
|
16143
|
-
kind: import_src$
|
|
16148
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16144
16149
|
submodule: "connect",
|
|
16145
16150
|
packageName: "mysql2",
|
|
16146
16151
|
packageType: PackageType.MYSQL,
|
|
@@ -16151,7 +16156,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16151
16156
|
return self._handleSimpleCallbackMethod(spanInfo, originalConnect, callback, this);
|
|
16152
16157
|
});
|
|
16153
16158
|
},
|
|
16154
|
-
spanKind: import_src$
|
|
16159
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16155
16160
|
});
|
|
16156
16161
|
else return originalConnect.apply(this, [callback]);
|
|
16157
16162
|
};
|
|
@@ -16174,7 +16179,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16174
16179
|
replayModeHandler: () => {
|
|
16175
16180
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalPing.apply(this, [callback]), {
|
|
16176
16181
|
name: `mysql2.${clientType}.ping`,
|
|
16177
|
-
kind: import_src$
|
|
16182
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16178
16183
|
submodule: "ping",
|
|
16179
16184
|
packageName: "mysql2",
|
|
16180
16185
|
packageType: PackageType.MYSQL,
|
|
@@ -16195,7 +16200,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16195
16200
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16196
16201
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalPing.apply(this, [callback]), {
|
|
16197
16202
|
name: `mysql2.${clientType}.ping`,
|
|
16198
|
-
kind: import_src$
|
|
16203
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16199
16204
|
submodule: "ping",
|
|
16200
16205
|
packageName: "mysql2",
|
|
16201
16206
|
packageType: PackageType.MYSQL,
|
|
@@ -16206,7 +16211,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16206
16211
|
return self._handleSimpleCallbackMethod(spanInfo, originalPing, callback, this);
|
|
16207
16212
|
});
|
|
16208
16213
|
},
|
|
16209
|
-
spanKind: import_src$
|
|
16214
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16210
16215
|
});
|
|
16211
16216
|
else return originalPing.apply(this, [callback]);
|
|
16212
16217
|
};
|
|
@@ -16229,7 +16234,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16229
16234
|
replayModeHandler: () => {
|
|
16230
16235
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalEnd.apply(this, [callback]), {
|
|
16231
16236
|
name: `mysql2.${clientType}.end`,
|
|
16232
|
-
kind: import_src$
|
|
16237
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16233
16238
|
submodule: "end",
|
|
16234
16239
|
packageName: "mysql2",
|
|
16235
16240
|
packageType: PackageType.MYSQL,
|
|
@@ -16250,7 +16255,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16250
16255
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16251
16256
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalEnd.apply(this, [callback]), {
|
|
16252
16257
|
name: `mysql2.${clientType}.end`,
|
|
16253
|
-
kind: import_src$
|
|
16258
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16254
16259
|
submodule: "end",
|
|
16255
16260
|
packageName: "mysql2",
|
|
16256
16261
|
packageType: PackageType.MYSQL,
|
|
@@ -16261,7 +16266,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16261
16266
|
return self._handleSimpleCallbackMethod(spanInfo, originalEnd, callback, this);
|
|
16262
16267
|
});
|
|
16263
16268
|
},
|
|
16264
|
-
spanKind: import_src$
|
|
16269
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16265
16270
|
});
|
|
16266
16271
|
else return originalEnd.apply(this, [callback]);
|
|
16267
16272
|
};
|
|
@@ -16274,7 +16279,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16274
16279
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16275
16280
|
try {
|
|
16276
16281
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16277
|
-
code: import_src$
|
|
16282
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16278
16283
|
message: error.message
|
|
16279
16284
|
});
|
|
16280
16285
|
} catch (error$1) {
|
|
@@ -16284,7 +16289,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16284
16289
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16285
16290
|
try {
|
|
16286
16291
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { success: true } });
|
|
16287
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16292
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16288
16293
|
} catch (error$1) {
|
|
16289
16294
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error$1);
|
|
16290
16295
|
}
|
|
@@ -16298,7 +16303,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16298
16303
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16299
16304
|
try {
|
|
16300
16305
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { success: true } });
|
|
16301
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16306
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16302
16307
|
} catch (error) {
|
|
16303
16308
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error);
|
|
16304
16309
|
}
|
|
@@ -16306,7 +16311,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16306
16311
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16307
16312
|
try {
|
|
16308
16313
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16309
|
-
code: import_src$
|
|
16314
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16310
16315
|
message: error.message
|
|
16311
16316
|
});
|
|
16312
16317
|
} catch (error$1) {
|
|
@@ -16318,7 +16323,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16318
16323
|
logger.debug(`[Mysql2Instrumentation] MySQL2 method completed (non-promise) (${SpanUtils.getTraceInfo()})`);
|
|
16319
16324
|
try {
|
|
16320
16325
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { success: true } });
|
|
16321
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16326
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16322
16327
|
} catch (error) {
|
|
16323
16328
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error);
|
|
16324
16329
|
}
|
|
@@ -16353,7 +16358,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16353
16358
|
logger.debug(`[Mysql2Instrumentation] MySQL2 query error (hasCallback): ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16354
16359
|
try {
|
|
16355
16360
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16356
|
-
code: import_src$
|
|
16361
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16357
16362
|
message: error.message
|
|
16358
16363
|
});
|
|
16359
16364
|
} catch (error$1) {
|
|
@@ -16363,7 +16368,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16363
16368
|
logger.debug(`[Mysql2Instrumentation] MySQL2 query completed successfully (hasCallback) (${SpanUtils.getTraceInfo()})`);
|
|
16364
16369
|
try {
|
|
16365
16370
|
this._addOutputAttributesToSpan(spanInfo, results, fields);
|
|
16366
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16371
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16367
16372
|
} catch (error$1) {
|
|
16368
16373
|
logger.error(`[Mysql2Instrumentation] error processing response:`, error$1);
|
|
16369
16374
|
}
|
|
@@ -16393,7 +16398,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16393
16398
|
logger.debug(`[Mysql2Instrumentation] MySQL2 stream query error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16394
16399
|
try {
|
|
16395
16400
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16396
|
-
code: import_src$
|
|
16401
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16397
16402
|
message: error.message
|
|
16398
16403
|
});
|
|
16399
16404
|
} catch (error$1) {
|
|
@@ -16407,7 +16412,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16407
16412
|
logger.debug(`[Mysql2Instrumentation] MySQL2 stream query completed (${SpanUtils.getTraceInfo()})`);
|
|
16408
16413
|
try {
|
|
16409
16414
|
this._addOutputAttributesToSpan(spanInfo, streamResults, streamFields);
|
|
16410
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16415
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16411
16416
|
} catch (error) {
|
|
16412
16417
|
logger.error(`[Mysql2Instrumentation] error ending span:`, error);
|
|
16413
16418
|
}
|
|
@@ -16429,7 +16434,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16429
16434
|
logger.debug(`[Mysql2Instrumentation] MySQL2 Pool getConnection error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16430
16435
|
try {
|
|
16431
16436
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16432
|
-
code: import_src$
|
|
16437
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16433
16438
|
message: error.message
|
|
16434
16439
|
});
|
|
16435
16440
|
} catch (error$1) {
|
|
@@ -16442,7 +16447,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16442
16447
|
connected: true,
|
|
16443
16448
|
hasConnection: !!connection
|
|
16444
16449
|
} });
|
|
16445
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16450
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16446
16451
|
} catch (error$1) {
|
|
16447
16452
|
logger.error(`[Mysql2Instrumentation] error processing getConnection response:`, error$1);
|
|
16448
16453
|
}
|
|
@@ -16457,7 +16462,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16457
16462
|
connected: true,
|
|
16458
16463
|
hasConnection: !!connection
|
|
16459
16464
|
} });
|
|
16460
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16465
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16461
16466
|
} catch (error) {
|
|
16462
16467
|
logger.error(`[Mysql2Instrumentation] error processing getConnection response:`, error);
|
|
16463
16468
|
}
|
|
@@ -16466,7 +16471,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16466
16471
|
logger.debug(`[Mysql2Instrumentation] MySQL2 Pool getConnection error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16467
16472
|
try {
|
|
16468
16473
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16469
|
-
code: import_src$
|
|
16474
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16470
16475
|
message: error.message
|
|
16471
16476
|
});
|
|
16472
16477
|
} catch (error$1) {
|
|
@@ -16509,7 +16514,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16509
16514
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16510
16515
|
return SpanUtils.createAndExecuteSpan(self.mode, () => new OriginalConnection(...args), {
|
|
16511
16516
|
name: `mysql2.connection.create`,
|
|
16512
|
-
kind: import_src$
|
|
16517
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16513
16518
|
submodule: "connectEvent",
|
|
16514
16519
|
packageType: PackageType.MYSQL,
|
|
16515
16520
|
packageName: "mysql2",
|
|
@@ -16524,7 +16529,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16524
16529
|
connected: true,
|
|
16525
16530
|
connectionObj
|
|
16526
16531
|
} });
|
|
16527
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16532
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$22.SpanStatusCode.OK });
|
|
16528
16533
|
} catch {
|
|
16529
16534
|
logger.error(`[Mysql2Instrumentation] error adding span attributes:`);
|
|
16530
16535
|
}
|
|
@@ -16533,7 +16538,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16533
16538
|
try {
|
|
16534
16539
|
logger.debug(`[Mysql2Instrumentation] Connection error, recording: ${err.message}`);
|
|
16535
16540
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16536
|
-
code: import_src$
|
|
16541
|
+
code: import_src$22.SpanStatusCode.ERROR,
|
|
16537
16542
|
message: err.message
|
|
16538
16543
|
});
|
|
16539
16544
|
} catch {
|
|
@@ -16543,7 +16548,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16543
16548
|
return connection;
|
|
16544
16549
|
});
|
|
16545
16550
|
},
|
|
16546
|
-
spanKind: import_src$
|
|
16551
|
+
spanKind: import_src$22.SpanKind.CLIENT
|
|
16547
16552
|
});
|
|
16548
16553
|
if (self.mode === TuskDriftMode.REPLAY) return handleReplayMode({
|
|
16549
16554
|
noOpRequestHandler: () => {
|
|
@@ -16553,7 +16558,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16553
16558
|
replayModeHandler: () => {
|
|
16554
16559
|
return SpanUtils.createAndExecuteSpan(self.mode, () => new OriginalConnection(...args), {
|
|
16555
16560
|
name: `mysql2.connection.create`,
|
|
16556
|
-
kind: import_src$
|
|
16561
|
+
kind: import_src$22.SpanKind.CLIENT,
|
|
16557
16562
|
submodule: "connectEvent",
|
|
16558
16563
|
packageType: PackageType.MYSQL,
|
|
16559
16564
|
packageName: "mysql2",
|
|
@@ -16632,7 +16637,7 @@ var Mysql2Instrumentation = class extends TdInstrumentationBase {
|
|
|
16632
16637
|
|
|
16633
16638
|
//#endregion
|
|
16634
16639
|
//#region src/instrumentation/libraries/tcp/Instrumentation.ts
|
|
16635
|
-
var import_src$
|
|
16640
|
+
var import_src$21 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
16636
16641
|
/**
|
|
16637
16642
|
* TCP Instrumentation for Tusk Drift
|
|
16638
16643
|
*
|
|
@@ -16719,7 +16724,7 @@ var TcpInstrumentation = class extends TdInstrumentationBase {
|
|
|
16719
16724
|
const currentSpanInfo = SpanUtils.getCurrentSpanInfo();
|
|
16720
16725
|
if (!currentSpanInfo) return originalMethod.apply(socketContext, args);
|
|
16721
16726
|
const callingLibrary = currentSpanInfo.context.getValue(CALLING_LIBRARY_CONTEXT_KEY);
|
|
16722
|
-
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) === import_src$
|
|
16727
|
+
if (currentSpanInfo.context.getValue(SPAN_KIND_CONTEXT_KEY) === import_src$21.SpanKind.SERVER && callingLibrary !== "ProtobufCommunicator") this._logUnpatchedDependency(methodName, currentSpanInfo, socketContext);
|
|
16723
16728
|
return originalMethod.apply(socketContext, args);
|
|
16724
16729
|
}
|
|
16725
16730
|
_isHttpResponseSocket(socketContext) {
|
|
@@ -16729,7 +16734,7 @@ var TcpInstrumentation = class extends TdInstrumentationBase {
|
|
|
16729
16734
|
|
|
16730
16735
|
//#endregion
|
|
16731
16736
|
//#region src/instrumentation/libraries/jsonwebtoken/Instrumentation.ts
|
|
16732
|
-
var import_src$
|
|
16737
|
+
var import_src$20 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
16733
16738
|
var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
16734
16739
|
constructor(config = {}) {
|
|
16735
16740
|
super("jsonwebtoken", config);
|
|
@@ -16809,7 +16814,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16809
16814
|
replayModeHandler: () => {
|
|
16810
16815
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalVerify.apply(this, args), {
|
|
16811
16816
|
name: "jsonwebtoken.verify",
|
|
16812
|
-
kind: import_src$
|
|
16817
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16813
16818
|
submodule: "verify",
|
|
16814
16819
|
packageName: "jsonwebtoken",
|
|
16815
16820
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16825,7 +16830,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16825
16830
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16826
16831
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalVerify.apply(this, args), {
|
|
16827
16832
|
name: "jsonwebtoken.verify",
|
|
16828
|
-
kind: import_src$
|
|
16833
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16829
16834
|
submodule: "verify",
|
|
16830
16835
|
packageName: "jsonwebtoken",
|
|
16831
16836
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16835,7 +16840,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16835
16840
|
return self._handleRecordVerifyInSpan(spanInfo, originalVerify, verifyConfig, args, this);
|
|
16836
16841
|
});
|
|
16837
16842
|
},
|
|
16838
|
-
spanKind: import_src$
|
|
16843
|
+
spanKind: import_src$20.SpanKind.CLIENT
|
|
16839
16844
|
});
|
|
16840
16845
|
else return originalVerify.apply(this, args);
|
|
16841
16846
|
};
|
|
@@ -16873,7 +16878,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16873
16878
|
replayModeHandler: () => {
|
|
16874
16879
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSign.apply(this, args), {
|
|
16875
16880
|
name: "jsonwebtoken.sign",
|
|
16876
|
-
kind: import_src$
|
|
16881
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16877
16882
|
submodule: "sign",
|
|
16878
16883
|
packageName: "jsonwebtoken",
|
|
16879
16884
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16889,7 +16894,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16889
16894
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
16890
16895
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSign.apply(this, args), {
|
|
16891
16896
|
name: "jsonwebtoken.sign",
|
|
16892
|
-
kind: import_src$
|
|
16897
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
16893
16898
|
submodule: "sign",
|
|
16894
16899
|
packageName: "jsonwebtoken",
|
|
16895
16900
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
@@ -16899,7 +16904,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16899
16904
|
return self._handleRecordSignInSpan(spanInfo, originalSign, signConfig, args, this);
|
|
16900
16905
|
});
|
|
16901
16906
|
},
|
|
16902
|
-
spanKind: import_src$
|
|
16907
|
+
spanKind: import_src$20.SpanKind.CLIENT
|
|
16903
16908
|
});
|
|
16904
16909
|
else return originalSign.apply(this, args);
|
|
16905
16910
|
};
|
|
@@ -16938,7 +16943,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16938
16943
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16939
16944
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
16940
16945
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16941
|
-
code: import_src$
|
|
16946
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
16942
16947
|
message: error.message
|
|
16943
16948
|
});
|
|
16944
16949
|
} catch (error$1) {
|
|
@@ -16947,7 +16952,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16947
16952
|
else try {
|
|
16948
16953
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16949
16954
|
this._addOutputAttributesToSpan(spanInfo, decoded);
|
|
16950
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16955
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
16951
16956
|
} catch (error$1) {
|
|
16952
16957
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error$1);
|
|
16953
16958
|
}
|
|
@@ -16965,7 +16970,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16965
16970
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify sync error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16966
16971
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
16967
16972
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16968
|
-
code: import_src$
|
|
16973
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
16969
16974
|
message: error.message
|
|
16970
16975
|
});
|
|
16971
16976
|
} catch (error$1) {
|
|
@@ -16978,7 +16983,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16978
16983
|
try {
|
|
16979
16984
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
16980
16985
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
16981
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
16986
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
16982
16987
|
} catch (error) {
|
|
16983
16988
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error);
|
|
16984
16989
|
}
|
|
@@ -16988,7 +16993,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
16988
16993
|
logger.debug(`[JsonwebtokenInstrumentation] JWT verify error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
16989
16994
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
16990
16995
|
SpanUtils.endSpan(spanInfo.span, {
|
|
16991
|
-
code: import_src$
|
|
16996
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
16992
16997
|
message: error.message
|
|
16993
16998
|
});
|
|
16994
16999
|
} catch (error$1) {
|
|
@@ -17005,7 +17010,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17005
17010
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
17006
17011
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
17007
17012
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17008
|
-
code: import_src$
|
|
17013
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
17009
17014
|
message: error.message
|
|
17010
17015
|
});
|
|
17011
17016
|
} catch (error$1) {
|
|
@@ -17014,7 +17019,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17014
17019
|
else try {
|
|
17015
17020
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
17016
17021
|
this._addOutputAttributesToSpan(spanInfo, token);
|
|
17017
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
17022
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
17018
17023
|
} catch (error$1) {
|
|
17019
17024
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error$1);
|
|
17020
17025
|
}
|
|
@@ -17031,7 +17036,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17031
17036
|
try {
|
|
17032
17037
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
17033
17038
|
this._addOutputAttributesToSpan(spanInfo, result);
|
|
17034
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
17039
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$20.SpanStatusCode.OK });
|
|
17035
17040
|
} catch (error) {
|
|
17036
17041
|
logger.error(`[JsonwebtokenInstrumentation] error ending span:`, error);
|
|
17037
17042
|
}
|
|
@@ -17041,7 +17046,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17041
17046
|
logger.debug(`[JsonwebtokenInstrumentation] JWT sign error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
17042
17047
|
this._addErrorOutputAttributesToSpan(spanInfo, error);
|
|
17043
17048
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17044
|
-
code: import_src$
|
|
17049
|
+
code: import_src$20.SpanStatusCode.ERROR,
|
|
17045
17050
|
message: error.message
|
|
17046
17051
|
});
|
|
17047
17052
|
} catch (error$1) {
|
|
@@ -17050,9 +17055,9 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17050
17055
|
throw error;
|
|
17051
17056
|
}
|
|
17052
17057
|
}
|
|
17053
|
-
|
|
17058
|
+
handleReplayVerify(verifyConfig, inputValue, spanInfo, stackTrace) {
|
|
17054
17059
|
logger.debug(`[JsonwebtokenInstrumentation] Replaying JWT verify`);
|
|
17055
|
-
const mockData =
|
|
17060
|
+
const mockData = findMockResponseSync({
|
|
17056
17061
|
mockRequestData: {
|
|
17057
17062
|
traceId: spanInfo.traceId,
|
|
17058
17063
|
spanId: spanInfo.spanId,
|
|
@@ -17061,7 +17066,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17061
17066
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
17062
17067
|
submoduleName: "verify",
|
|
17063
17068
|
inputValue,
|
|
17064
|
-
kind: import_src$
|
|
17069
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
17065
17070
|
stackTrace
|
|
17066
17071
|
},
|
|
17067
17072
|
tuskDrift: this.tuskDrift
|
|
@@ -17093,9 +17098,9 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17093
17098
|
return;
|
|
17094
17099
|
} else return result;
|
|
17095
17100
|
}
|
|
17096
|
-
|
|
17101
|
+
handleReplaySign(signConfig, inputValue, spanInfo, stackTrace) {
|
|
17097
17102
|
logger.debug(`[JsonwebtokenInstrumentation] Replaying JWT sign`);
|
|
17098
|
-
const mockData =
|
|
17103
|
+
const mockData = findMockResponseSync({
|
|
17099
17104
|
mockRequestData: {
|
|
17100
17105
|
traceId: spanInfo?.traceId,
|
|
17101
17106
|
spanId: spanInfo?.spanId,
|
|
@@ -17104,7 +17109,7 @@ var JsonwebtokenInstrumentation = class extends TdInstrumentationBase {
|
|
|
17104
17109
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
17105
17110
|
submoduleName: "sign",
|
|
17106
17111
|
inputValue,
|
|
17107
|
-
kind: import_src$
|
|
17112
|
+
kind: import_src$20.SpanKind.CLIENT,
|
|
17108
17113
|
stackTrace
|
|
17109
17114
|
},
|
|
17110
17115
|
tuskDrift: this.tuskDrift
|
|
@@ -17206,7 +17211,7 @@ var JwksRsaInstrumentation = class extends TdInstrumentationBase {
|
|
|
17206
17211
|
|
|
17207
17212
|
//#endregion
|
|
17208
17213
|
//#region src/instrumentation/libraries/fetch/FetchTransformEngine.ts
|
|
17209
|
-
var import_src$
|
|
17214
|
+
var import_src$19 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
17210
17215
|
/**
|
|
17211
17216
|
* Creates an empty FetchInputValue object for dropped spans
|
|
17212
17217
|
*/
|
|
@@ -17281,7 +17286,7 @@ var FetchTransformEngine = class {
|
|
|
17281
17286
|
}
|
|
17282
17287
|
compileMatcher(matcher) {
|
|
17283
17288
|
const checks = [];
|
|
17284
|
-
checks.push((span) => span.kind === import_src$
|
|
17289
|
+
checks.push((span) => span.kind === import_src$19.SpanKind.CLIENT);
|
|
17285
17290
|
if (matcher.method) if (matcher.method.length === 0) {} else {
|
|
17286
17291
|
const methods = matcher.method.map((method) => method.toUpperCase());
|
|
17287
17292
|
checks.push((span) => {
|
|
@@ -17477,7 +17482,7 @@ var FetchTransformEngine = class {
|
|
|
17477
17482
|
|
|
17478
17483
|
//#endregion
|
|
17479
17484
|
//#region src/instrumentation/libraries/fetch/Instrumentation.ts
|
|
17480
|
-
var import_src$
|
|
17485
|
+
var import_src$18 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
17481
17486
|
/**
|
|
17482
17487
|
* Fetch API instrumentation for capturing requests made via fetch()
|
|
17483
17488
|
* This covers libraries like @octokit/rest, axios (when using fetch adapter), etc.
|
|
@@ -17539,7 +17544,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17539
17544
|
replayModeHandler: () => {
|
|
17540
17545
|
return SpanUtils.createAndExecuteSpan(this.mode, () => this.originalFetch(input, init), {
|
|
17541
17546
|
name: url,
|
|
17542
|
-
kind: import_src$
|
|
17547
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17543
17548
|
packageName: "fetch",
|
|
17544
17549
|
packageType: PackageType.HTTP,
|
|
17545
17550
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
@@ -17554,14 +17559,14 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17554
17559
|
else if (this.mode === TuskDriftMode.RECORD) return handleRecordMode({
|
|
17555
17560
|
originalFunctionCall: () => this.originalFetch(input, init),
|
|
17556
17561
|
recordModeHandler: ({ isPreAppStart }) => this._handleRecordFetch(input, inputValue, isPreAppStart, init),
|
|
17557
|
-
spanKind: import_src$
|
|
17562
|
+
spanKind: import_src$18.SpanKind.CLIENT
|
|
17558
17563
|
});
|
|
17559
17564
|
else return this.originalFetch(input, init);
|
|
17560
17565
|
}
|
|
17561
17566
|
_handleRecordFetch(input, inputValue, isPreAppStart, init) {
|
|
17562
17567
|
return SpanUtils.createAndExecuteSpan(this.mode, () => this.originalFetch(input, init), {
|
|
17563
17568
|
name: inputValue.url,
|
|
17564
|
-
kind: import_src$
|
|
17569
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17565
17570
|
packageName: "fetch",
|
|
17566
17571
|
packageType: PackageType.HTTP,
|
|
17567
17572
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
@@ -17590,7 +17595,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17590
17595
|
const spanData = {
|
|
17591
17596
|
traceId: spanInfo.traceId,
|
|
17592
17597
|
spanId: spanInfo.spanId,
|
|
17593
|
-
kind: import_src$
|
|
17598
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17594
17599
|
inputValue,
|
|
17595
17600
|
outputValue
|
|
17596
17601
|
};
|
|
@@ -17607,10 +17612,10 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17607
17612
|
},
|
|
17608
17613
|
...spanData.transformMetadata && { transformMetadata: spanData.transformMetadata }
|
|
17609
17614
|
});
|
|
17610
|
-
const status = response.status >=
|
|
17611
|
-
code: import_src$
|
|
17615
|
+
const status = response.status >= 300 ? {
|
|
17616
|
+
code: import_src$18.SpanStatusCode.ERROR,
|
|
17612
17617
|
message: `HTTP ${response.status}`
|
|
17613
|
-
} : { code: import_src$
|
|
17618
|
+
} : { code: import_src$18.SpanStatusCode.OK };
|
|
17614
17619
|
SpanUtils.endSpan(spanInfo.span, status);
|
|
17615
17620
|
} catch (error) {
|
|
17616
17621
|
logger.error(`[FetchInstrumentation] error processing response body:`, error);
|
|
@@ -17619,7 +17624,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17619
17624
|
}).catch((error) => {
|
|
17620
17625
|
try {
|
|
17621
17626
|
SpanUtils.endSpan(spanInfo.span, {
|
|
17622
|
-
code: import_src$
|
|
17627
|
+
code: import_src$18.SpanStatusCode.ERROR,
|
|
17623
17628
|
message: error.message
|
|
17624
17629
|
});
|
|
17625
17630
|
} catch (error$1) {
|
|
@@ -17640,7 +17645,7 @@ var FetchInstrumentation = class extends TdInstrumentationBase {
|
|
|
17640
17645
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
17641
17646
|
submoduleName: inputValue.method,
|
|
17642
17647
|
inputValue,
|
|
17643
|
-
kind: import_src$
|
|
17648
|
+
kind: import_src$18.SpanKind.CLIENT,
|
|
17644
17649
|
stackTrace
|
|
17645
17650
|
},
|
|
17646
17651
|
tuskDrift: this.tuskDrift,
|
|
@@ -17806,10 +17811,23 @@ function convertValueToJsonable(value) {
|
|
|
17806
17811
|
encoding: BufferEncoding.NONE
|
|
17807
17812
|
};
|
|
17808
17813
|
}
|
|
17814
|
+
/**
|
|
17815
|
+
* Recursively deserialize Buffer objects from JSON representation.
|
|
17816
|
+
* Converts {"type":"Buffer","data":[...]} back to actual Buffer instances.
|
|
17817
|
+
* This handles the format produced by JSON.stringify(Buffer).
|
|
17818
|
+
*/
|
|
17819
|
+
function deserializeBufferValue(value) {
|
|
17820
|
+
if (!value || typeof value !== "object") return value;
|
|
17821
|
+
if (value.type === "Buffer" && Array.isArray(value.data)) return Buffer.from(value.data);
|
|
17822
|
+
if (Array.isArray(value)) return value.map((item) => deserializeBufferValue(item));
|
|
17823
|
+
const result = {};
|
|
17824
|
+
for (const key of Object.keys(value)) result[key] = deserializeBufferValue(value[key]);
|
|
17825
|
+
return result;
|
|
17826
|
+
}
|
|
17809
17827
|
|
|
17810
17828
|
//#endregion
|
|
17811
17829
|
//#region src/instrumentation/libraries/ioredis/Instrumentation.ts
|
|
17812
|
-
var import_src$
|
|
17830
|
+
var import_src$17 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
17813
17831
|
const SUPPORTED_VERSIONS$1 = [">=4.11.0 <5", "5.*"];
|
|
17814
17832
|
var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
17815
17833
|
constructor(config = {}) {
|
|
@@ -17927,7 +17945,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17927
17945
|
replayModeHandler: () => {
|
|
17928
17946
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSendCommand.apply(this, arguments), {
|
|
17929
17947
|
name: `ioredis.${commandName}`,
|
|
17930
|
-
kind: import_src$
|
|
17948
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
17931
17949
|
submodule: commandName,
|
|
17932
17950
|
packageType: PackageType.REDIS,
|
|
17933
17951
|
packageName: "ioredis",
|
|
@@ -17944,7 +17962,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17944
17962
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
17945
17963
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSendCommand.apply(this, arguments), {
|
|
17946
17964
|
name: `ioredis.${commandName}`,
|
|
17947
|
-
kind: import_src$
|
|
17965
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
17948
17966
|
submodule: commandName,
|
|
17949
17967
|
packageType: PackageType.REDIS,
|
|
17950
17968
|
packageName: "ioredis",
|
|
@@ -17955,7 +17973,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17955
17973
|
return self._handleRecordSendCommand(spanInfo, originalSendCommand, cmd, this);
|
|
17956
17974
|
});
|
|
17957
17975
|
},
|
|
17958
|
-
spanKind: import_src$
|
|
17976
|
+
spanKind: import_src$17.SpanKind.CLIENT
|
|
17959
17977
|
});
|
|
17960
17978
|
else return originalSendCommand.apply(this, arguments);
|
|
17961
17979
|
};
|
|
@@ -17980,7 +17998,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17980
17998
|
replayModeHandler: () => {
|
|
17981
17999
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, arguments), {
|
|
17982
18000
|
name: "ioredis.connect",
|
|
17983
|
-
kind: import_src$
|
|
18001
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
17984
18002
|
submodule: "connect",
|
|
17985
18003
|
packageType: PackageType.REDIS,
|
|
17986
18004
|
packageName: "ioredis",
|
|
@@ -17997,7 +18015,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
17997
18015
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
17998
18016
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalConnect.apply(this, arguments), {
|
|
17999
18017
|
name: "ioredis.connect",
|
|
18000
|
-
kind: import_src$
|
|
18018
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18001
18019
|
submodule: "connect",
|
|
18002
18020
|
packageType: PackageType.REDIS,
|
|
18003
18021
|
packageName: "ioredis",
|
|
@@ -18008,7 +18026,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18008
18026
|
return self._handleRecordConnect(spanInfo, originalConnect, this);
|
|
18009
18027
|
});
|
|
18010
18028
|
},
|
|
18011
|
-
spanKind: import_src$
|
|
18029
|
+
spanKind: import_src$17.SpanKind.CLIENT
|
|
18012
18030
|
});
|
|
18013
18031
|
else return originalConnect.apply(this, arguments);
|
|
18014
18032
|
};
|
|
@@ -18056,7 +18074,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18056
18074
|
replayModeHandler: () => {
|
|
18057
18075
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExec.apply(this, args), {
|
|
18058
18076
|
name: "ioredis.pipeline.exec",
|
|
18059
|
-
kind: import_src$
|
|
18077
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18060
18078
|
submodule: "pipeline-exec",
|
|
18061
18079
|
packageType: PackageType.REDIS,
|
|
18062
18080
|
packageName: "ioredis",
|
|
@@ -18073,7 +18091,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18073
18091
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18074
18092
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalExec.apply(this, args), {
|
|
18075
18093
|
name: "ioredis.pipeline.exec",
|
|
18076
|
-
kind: import_src$
|
|
18094
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18077
18095
|
submodule: "pipeline-exec",
|
|
18078
18096
|
packageType: PackageType.REDIS,
|
|
18079
18097
|
packageName: "ioredis",
|
|
@@ -18084,7 +18102,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18084
18102
|
return self._handleRecordPipelineExec(spanInfo, originalExec, this, args);
|
|
18085
18103
|
});
|
|
18086
18104
|
},
|
|
18087
|
-
spanKind: import_src$
|
|
18105
|
+
spanKind: import_src$17.SpanKind.CLIENT
|
|
18088
18106
|
});
|
|
18089
18107
|
else return originalExec.apply(this, args);
|
|
18090
18108
|
};
|
|
@@ -18097,7 +18115,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18097
18115
|
logger.debug(`[IORedisInstrumentation] IORedis command ${cmd.name} completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
18098
18116
|
const outputValue = this._serializeOutput(result);
|
|
18099
18117
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
18100
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18118
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18101
18119
|
} catch (error) {
|
|
18102
18120
|
logger.error(`[IORedisInstrumentation] error processing command response:`, error);
|
|
18103
18121
|
}
|
|
@@ -18106,7 +18124,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18106
18124
|
try {
|
|
18107
18125
|
logger.debug(`[IORedisInstrumentation] IORedis command ${cmd.name} error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
18108
18126
|
SpanUtils.endSpan(spanInfo.span, {
|
|
18109
|
-
code: import_src$
|
|
18127
|
+
code: import_src$17.SpanStatusCode.ERROR,
|
|
18110
18128
|
message: error.message
|
|
18111
18129
|
});
|
|
18112
18130
|
} catch (spanError) {
|
|
@@ -18127,7 +18145,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18127
18145
|
packageName: "ioredis",
|
|
18128
18146
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
18129
18147
|
submoduleName: cmd.name,
|
|
18130
|
-
kind: import_src$
|
|
18148
|
+
kind: import_src$17.SpanKind.CLIENT,
|
|
18131
18149
|
stackTrace
|
|
18132
18150
|
},
|
|
18133
18151
|
tuskDrift: this.tuskDrift
|
|
@@ -18149,7 +18167,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18149
18167
|
try {
|
|
18150
18168
|
logger.debug(`[IORedisInstrumentation] IORedis connect completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
18151
18169
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
18152
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18170
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18153
18171
|
} catch {
|
|
18154
18172
|
logger.error(`[IORedisInstrumentation] error adding span attributes`);
|
|
18155
18173
|
}
|
|
@@ -18158,7 +18176,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18158
18176
|
try {
|
|
18159
18177
|
logger.debug(`[IORedisInstrumentation] IORedis connect error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
18160
18178
|
SpanUtils.endSpan(spanInfo.span, {
|
|
18161
|
-
code: import_src$
|
|
18179
|
+
code: import_src$17.SpanStatusCode.ERROR,
|
|
18162
18180
|
message: error.message
|
|
18163
18181
|
});
|
|
18164
18182
|
} catch {
|
|
@@ -18169,7 +18187,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18169
18187
|
try {
|
|
18170
18188
|
logger.debug(`[IORedisInstrumentation] IORedis connect completed (synchronous) (${SpanUtils.getTraceInfo()})`);
|
|
18171
18189
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: { connected: true } });
|
|
18172
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18190
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18173
18191
|
} catch {
|
|
18174
18192
|
logger.error(`[IORedisInstrumentation] error adding span attributes`);
|
|
18175
18193
|
}
|
|
@@ -18189,7 +18207,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18189
18207
|
logger.debug(`[IORedisInstrumentation] Pipeline exec completed successfully (${SpanUtils.getTraceInfo()})`);
|
|
18190
18208
|
const outputValue = this._serializePipelineOutput(results);
|
|
18191
18209
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
18192
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18210
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$17.SpanStatusCode.OK });
|
|
18193
18211
|
} catch {
|
|
18194
18212
|
logger.error(`[IORedisInstrumentation] error adding span attributes`);
|
|
18195
18213
|
}
|
|
@@ -18198,7 +18216,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18198
18216
|
try {
|
|
18199
18217
|
logger.debug(`[IORedisInstrumentation] Pipeline exec error: ${error.message} (${SpanUtils.getTraceInfo()})`);
|
|
18200
18218
|
SpanUtils.endSpan(spanInfo.span, {
|
|
18201
|
-
code: import_src$
|
|
18219
|
+
code: import_src$17.SpanStatusCode.ERROR,
|
|
18202
18220
|
message: error.message
|
|
18203
18221
|
});
|
|
18204
18222
|
} catch {
|
|
@@ -18219,7 +18237,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18219
18237
|
packageName: "ioredis",
|
|
18220
18238
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
18221
18239
|
submoduleName: "pipeline-exec",
|
|
18222
|
-
kind: import_src$
|
|
18240
|
+
kind: import_src$17.SpanKind.CLIENT
|
|
18223
18241
|
},
|
|
18224
18242
|
tuskDrift: this.tuskDrift
|
|
18225
18243
|
});
|
|
@@ -18259,12 +18277,12 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18259
18277
|
}
|
|
18260
18278
|
_deserializePipelineOutput(outputValue) {
|
|
18261
18279
|
if (!outputValue) return [];
|
|
18262
|
-
return outputValue.value || outputValue;
|
|
18280
|
+
return deserializeBufferValue(outputValue.value || outputValue);
|
|
18263
18281
|
}
|
|
18264
18282
|
_deserializeOutput(outputValue) {
|
|
18265
18283
|
if (!outputValue) return;
|
|
18266
|
-
if (typeof outputValue !== "object" || !("value" in outputValue)) return outputValue;
|
|
18267
|
-
return outputValue.value;
|
|
18284
|
+
if (typeof outputValue !== "object" || !("value" in outputValue)) return deserializeBufferValue(outputValue);
|
|
18285
|
+
return deserializeBufferValue(outputValue.value);
|
|
18268
18286
|
}
|
|
18269
18287
|
_wrap(target, propertyName, wrapper) {
|
|
18270
18288
|
wrap(target, propertyName, wrapper);
|
|
@@ -18273,7 +18291,7 @@ var IORedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18273
18291
|
|
|
18274
18292
|
//#endregion
|
|
18275
18293
|
//#region src/instrumentation/libraries/upstash-redis-js/Instrumentation.ts
|
|
18276
|
-
var import_src$
|
|
18294
|
+
var import_src$16 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
18277
18295
|
const SUPPORTED_VERSIONS = [">=1.0.0"];
|
|
18278
18296
|
const REDIS_COMMANDS = [
|
|
18279
18297
|
"get",
|
|
@@ -18530,7 +18548,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18530
18548
|
replayModeHandler: () => {
|
|
18531
18549
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalValue.apply(this === receiver ? target : this, args), {
|
|
18532
18550
|
name: operationName,
|
|
18533
|
-
kind: import_src$
|
|
18551
|
+
kind: import_src$16.SpanKind.CLIENT,
|
|
18534
18552
|
submodule: submoduleName,
|
|
18535
18553
|
packageType: PackageType.REDIS,
|
|
18536
18554
|
packageName: "@upstash/redis",
|
|
@@ -18547,7 +18565,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18547
18565
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18548
18566
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalValue.apply(this === receiver ? target : this, args), {
|
|
18549
18567
|
name: operationName,
|
|
18550
|
-
kind: import_src$
|
|
18568
|
+
kind: import_src$16.SpanKind.CLIENT,
|
|
18551
18569
|
submodule: submoduleName,
|
|
18552
18570
|
packageType: PackageType.REDIS,
|
|
18553
18571
|
packageName: "@upstash/redis",
|
|
@@ -18559,7 +18577,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18559
18577
|
return self._handleRecordCommand(spanInfo, originalValue, this === receiver ? target : this, args);
|
|
18560
18578
|
});
|
|
18561
18579
|
},
|
|
18562
|
-
spanKind: import_src$
|
|
18580
|
+
spanKind: import_src$16.SpanKind.CLIENT
|
|
18563
18581
|
});
|
|
18564
18582
|
else return originalValue.apply(this === receiver ? target : this, args);
|
|
18565
18583
|
};
|
|
@@ -18574,7 +18592,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18574
18592
|
const outputValue = { result };
|
|
18575
18593
|
try {
|
|
18576
18594
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
18577
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18595
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$16.SpanStatusCode.OK });
|
|
18578
18596
|
} catch (error) {
|
|
18579
18597
|
logger.error(`[UpstashRedisInstrumentation] Error adding span attributes: ${error}`);
|
|
18580
18598
|
}
|
|
@@ -18582,7 +18600,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18582
18600
|
} catch (error) {
|
|
18583
18601
|
logger.debug(`[UpstashRedisInstrumentation] Command error: ${error}`);
|
|
18584
18602
|
try {
|
|
18585
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
18603
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$16.SpanStatusCode.ERROR });
|
|
18586
18604
|
} catch (error$1) {
|
|
18587
18605
|
logger.error(`[UpstashRedisInstrumentation] Error ending span: ${error$1}`);
|
|
18588
18606
|
}
|
|
@@ -18600,7 +18618,7 @@ var UpstashRedisInstrumentation = class extends TdInstrumentationBase {
|
|
|
18600
18618
|
packageName: "@upstash/redis",
|
|
18601
18619
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
18602
18620
|
submoduleName,
|
|
18603
|
-
kind: import_src$
|
|
18621
|
+
kind: import_src$16.SpanKind.CLIENT,
|
|
18604
18622
|
stackTrace
|
|
18605
18623
|
},
|
|
18606
18624
|
tuskDrift: this.tuskDrift
|
|
@@ -18773,7 +18791,7 @@ function deepClone(obj) {
|
|
|
18773
18791
|
|
|
18774
18792
|
//#endregion
|
|
18775
18793
|
//#region src/instrumentation/libraries/grpc/Instrumentation.ts
|
|
18776
|
-
var import_src$
|
|
18794
|
+
var import_src$15 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
18777
18795
|
const GRPC_MODULE_NAME = "@grpc/grpc-js";
|
|
18778
18796
|
var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBase {
|
|
18779
18797
|
constructor(config = {}) {
|
|
@@ -18924,7 +18942,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
18924
18942
|
replayModeHandler: () => {
|
|
18925
18943
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
18926
18944
|
name: "grpc.client.unary",
|
|
18927
|
-
kind: import_src$
|
|
18945
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
18928
18946
|
submodule: "client",
|
|
18929
18947
|
packageType: PackageType.GRPC,
|
|
18930
18948
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -18941,7 +18959,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
18941
18959
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
18942
18960
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
18943
18961
|
name: "grpc.client.unary",
|
|
18944
|
-
kind: import_src$
|
|
18962
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
18945
18963
|
submodule: "client",
|
|
18946
18964
|
packageType: PackageType.GRPC,
|
|
18947
18965
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -18952,7 +18970,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
18952
18970
|
return self._handleRecordUnaryRequest(spanInfo, original, this, parsedParams, callback);
|
|
18953
18971
|
});
|
|
18954
18972
|
},
|
|
18955
|
-
spanKind: import_src$
|
|
18973
|
+
spanKind: import_src$15.SpanKind.CLIENT
|
|
18956
18974
|
});
|
|
18957
18975
|
else return original.apply(this, args);
|
|
18958
18976
|
};
|
|
@@ -19018,7 +19036,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19018
19036
|
replayModeHandler: () => {
|
|
19019
19037
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
19020
19038
|
name: "grpc.client.server_stream",
|
|
19021
|
-
kind: import_src$
|
|
19039
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
19022
19040
|
submodule: "client",
|
|
19023
19041
|
packageType: PackageType.GRPC,
|
|
19024
19042
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -19035,7 +19053,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19035
19053
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19036
19054
|
return SpanUtils.createAndExecuteSpan(self.mode, () => original.apply(this, args), {
|
|
19037
19055
|
name: "grpc.client.server_stream",
|
|
19038
|
-
kind: import_src$
|
|
19056
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
19039
19057
|
submodule: "client",
|
|
19040
19058
|
packageType: PackageType.GRPC,
|
|
19041
19059
|
packageName: GRPC_MODULE_NAME,
|
|
@@ -19046,7 +19064,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19046
19064
|
return self._handleRecordServerStreamRequest(spanInfo, original, this, parsedParams);
|
|
19047
19065
|
});
|
|
19048
19066
|
},
|
|
19049
|
-
spanKind: import_src$
|
|
19067
|
+
spanKind: import_src$15.SpanKind.CLIENT
|
|
19050
19068
|
});
|
|
19051
19069
|
else return original.apply(this, args);
|
|
19052
19070
|
};
|
|
@@ -19129,7 +19147,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19129
19147
|
status,
|
|
19130
19148
|
bufferMap: responseBufferMap,
|
|
19131
19149
|
jsonableStringMap: responseJsonableStringMap
|
|
19132
|
-
}, import_src$
|
|
19150
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19133
19151
|
else if (isStatusEmitted && hasErrorOccurred) completeSpan({
|
|
19134
19152
|
error: {
|
|
19135
19153
|
message: serviceError.message,
|
|
@@ -19138,7 +19156,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19138
19156
|
},
|
|
19139
19157
|
status,
|
|
19140
19158
|
metadata: responseMetadataInitial
|
|
19141
|
-
}, import_src$
|
|
19159
|
+
}, import_src$15.SpanStatusCode.ERROR, serviceError.message);
|
|
19142
19160
|
} catch (e) {
|
|
19143
19161
|
logger.error(`[GrpcInstrumentation] Error in patchedCallback:`, e);
|
|
19144
19162
|
}
|
|
@@ -19170,7 +19188,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19170
19188
|
status,
|
|
19171
19189
|
bufferMap: responseBufferMap,
|
|
19172
19190
|
jsonableStringMap: responseJsonableStringMap
|
|
19173
|
-
}, import_src$
|
|
19191
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19174
19192
|
else if (hasErrorOccurred) completeSpan({
|
|
19175
19193
|
error: {
|
|
19176
19194
|
message: serviceError.message,
|
|
@@ -19179,7 +19197,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19179
19197
|
},
|
|
19180
19198
|
status,
|
|
19181
19199
|
metadata: responseMetadataInitial
|
|
19182
|
-
}, import_src$
|
|
19200
|
+
}, import_src$15.SpanStatusCode.ERROR, serviceError.message);
|
|
19183
19201
|
});
|
|
19184
19202
|
return result;
|
|
19185
19203
|
}
|
|
@@ -19203,7 +19221,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19203
19221
|
packageType: PackageType.GRPC,
|
|
19204
19222
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
19205
19223
|
submoduleName: "client",
|
|
19206
|
-
kind: import_src$
|
|
19224
|
+
kind: import_src$15.SpanKind.CLIENT,
|
|
19207
19225
|
stackTrace
|
|
19208
19226
|
},
|
|
19209
19227
|
tuskDrift: this.tuskDrift
|
|
@@ -19307,14 +19325,14 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19307
19325
|
status,
|
|
19308
19326
|
bufferMap: {},
|
|
19309
19327
|
jsonableStringMap: {}
|
|
19310
|
-
}, import_src$
|
|
19328
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19311
19329
|
else if (!hasErrorOccurred && streamResponses.length === 0) completeSpan({
|
|
19312
19330
|
body: [],
|
|
19313
19331
|
metadata: responseMetadataInitial,
|
|
19314
19332
|
status,
|
|
19315
19333
|
bufferMap: {},
|
|
19316
19334
|
jsonableStringMap: {}
|
|
19317
|
-
}, import_src$
|
|
19335
|
+
}, import_src$15.SpanStatusCode.OK);
|
|
19318
19336
|
else if (hasErrorOccurred) completeSpan({
|
|
19319
19337
|
error: {
|
|
19320
19338
|
message: serviceError.message,
|
|
@@ -19323,7 +19341,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19323
19341
|
},
|
|
19324
19342
|
status,
|
|
19325
19343
|
metadata: responseMetadataInitial
|
|
19326
|
-
}, import_src$
|
|
19344
|
+
}, import_src$15.SpanStatusCode.ERROR, serviceError.message);
|
|
19327
19345
|
});
|
|
19328
19346
|
return stream;
|
|
19329
19347
|
}
|
|
@@ -19348,7 +19366,7 @@ var GrpcInstrumentation = class GrpcInstrumentation extends TdInstrumentationBas
|
|
|
19348
19366
|
packageType: PackageType.GRPC,
|
|
19349
19367
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
19350
19368
|
submoduleName: "client",
|
|
19351
|
-
kind: import_src$
|
|
19369
|
+
kind: import_src$15.SpanKind.CLIENT
|
|
19352
19370
|
},
|
|
19353
19371
|
tuskDrift: this.tuskDrift
|
|
19354
19372
|
}).then((mockData) => {
|
|
@@ -19620,7 +19638,7 @@ var TdFirestoreWriteResultMock = class {
|
|
|
19620
19638
|
|
|
19621
19639
|
//#endregion
|
|
19622
19640
|
//#region src/instrumentation/libraries/firestore/Instrumentation.ts
|
|
19623
|
-
var import_src$
|
|
19641
|
+
var import_src$14 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
19624
19642
|
const FIRESTORE_VERSION = "7.*";
|
|
19625
19643
|
const PACKAGE_NAME = "@google-cloud/firestore";
|
|
19626
19644
|
var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
@@ -19728,7 +19746,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19728
19746
|
replayModeHandler: () => {
|
|
19729
19747
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
19730
19748
|
name: "firestore.document.get",
|
|
19731
|
-
kind: import_src$
|
|
19749
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19732
19750
|
submodule: "document",
|
|
19733
19751
|
packageType: PackageType.FIRESTORE,
|
|
19734
19752
|
packageName: PACKAGE_NAME,
|
|
@@ -19746,7 +19764,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19746
19764
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19747
19765
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
19748
19766
|
name: "firestore.document.get",
|
|
19749
|
-
kind: import_src$
|
|
19767
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19750
19768
|
submodule: "document",
|
|
19751
19769
|
packageType: PackageType.FIRESTORE,
|
|
19752
19770
|
packageName: PACKAGE_NAME,
|
|
@@ -19758,7 +19776,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19758
19776
|
return self._handleRecordDocumentGet(spanInfo, originalGet, this);
|
|
19759
19777
|
});
|
|
19760
19778
|
},
|
|
19761
|
-
spanKind: import_src$
|
|
19779
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19762
19780
|
});
|
|
19763
19781
|
else return originalGet.call(this);
|
|
19764
19782
|
};
|
|
@@ -19786,7 +19804,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19786
19804
|
};
|
|
19787
19805
|
try {
|
|
19788
19806
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: documentResult });
|
|
19789
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
19807
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
19790
19808
|
} catch {
|
|
19791
19809
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for document.get`);
|
|
19792
19810
|
}
|
|
@@ -19803,7 +19821,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19803
19821
|
packageName: PACKAGE_NAME,
|
|
19804
19822
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
19805
19823
|
submoduleName: "document",
|
|
19806
|
-
kind: import_src$
|
|
19824
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
19807
19825
|
},
|
|
19808
19826
|
tuskDrift: this.tuskDrift
|
|
19809
19827
|
});
|
|
@@ -19835,7 +19853,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19835
19853
|
replayModeHandler: () => {
|
|
19836
19854
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCreate.call(this, data), {
|
|
19837
19855
|
name: "firestore.document.create",
|
|
19838
|
-
kind: import_src$
|
|
19856
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19839
19857
|
submodule: "document",
|
|
19840
19858
|
packageType: PackageType.FIRESTORE,
|
|
19841
19859
|
packageName: PACKAGE_NAME,
|
|
@@ -19853,7 +19871,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19853
19871
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19854
19872
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalCreate.call(this, data), {
|
|
19855
19873
|
name: "firestore.document.create",
|
|
19856
|
-
kind: import_src$
|
|
19874
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19857
19875
|
submodule: "document",
|
|
19858
19876
|
packageType: PackageType.FIRESTORE,
|
|
19859
19877
|
packageName: PACKAGE_NAME,
|
|
@@ -19865,7 +19883,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19865
19883
|
return self._handleRecordDocumentWrite(spanInfo, originalCreate, this, data);
|
|
19866
19884
|
});
|
|
19867
19885
|
},
|
|
19868
|
-
spanKind: import_src$
|
|
19886
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19869
19887
|
});
|
|
19870
19888
|
else return originalCreate.call(this, data);
|
|
19871
19889
|
};
|
|
@@ -19893,7 +19911,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19893
19911
|
replayModeHandler: () => {
|
|
19894
19912
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSet.call(this, data, options), {
|
|
19895
19913
|
name: "firestore.document.set",
|
|
19896
|
-
kind: import_src$
|
|
19914
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19897
19915
|
submodule: "document",
|
|
19898
19916
|
packageType: PackageType.FIRESTORE,
|
|
19899
19917
|
packageName: PACKAGE_NAME,
|
|
@@ -19911,7 +19929,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19911
19929
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19912
19930
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalSet.call(this, data, options), {
|
|
19913
19931
|
name: "firestore.document.set",
|
|
19914
|
-
kind: import_src$
|
|
19932
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19915
19933
|
submodule: "document",
|
|
19916
19934
|
packageType: PackageType.FIRESTORE,
|
|
19917
19935
|
packageName: PACKAGE_NAME,
|
|
@@ -19923,7 +19941,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19923
19941
|
return self._handleRecordDocumentWrite(spanInfo, originalSet, this, data, options);
|
|
19924
19942
|
});
|
|
19925
19943
|
},
|
|
19926
|
-
spanKind: import_src$
|
|
19944
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19927
19945
|
});
|
|
19928
19946
|
else return originalSet.call(this, data, options);
|
|
19929
19947
|
};
|
|
@@ -19950,7 +19968,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19950
19968
|
replayModeHandler: () => {
|
|
19951
19969
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalUpdate.apply(this, args), {
|
|
19952
19970
|
name: "firestore.document.update",
|
|
19953
|
-
kind: import_src$
|
|
19971
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19954
19972
|
submodule: "document",
|
|
19955
19973
|
packageType: PackageType.FIRESTORE,
|
|
19956
19974
|
packageName: PACKAGE_NAME,
|
|
@@ -19968,7 +19986,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19968
19986
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
19969
19987
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalUpdate.apply(this, args), {
|
|
19970
19988
|
name: "firestore.document.update",
|
|
19971
|
-
kind: import_src$
|
|
19989
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
19972
19990
|
submodule: "document",
|
|
19973
19991
|
packageType: PackageType.FIRESTORE,
|
|
19974
19992
|
packageName: PACKAGE_NAME,
|
|
@@ -19980,7 +19998,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
19980
19998
|
return self._handleRecordDocumentWrite(spanInfo, originalUpdate, this, ...args);
|
|
19981
19999
|
});
|
|
19982
20000
|
},
|
|
19983
|
-
spanKind: import_src$
|
|
20001
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
19984
20002
|
});
|
|
19985
20003
|
else return originalUpdate.apply(this, args);
|
|
19986
20004
|
};
|
|
@@ -20007,7 +20025,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20007
20025
|
replayModeHandler: () => {
|
|
20008
20026
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalDelete.call(this, precondition), {
|
|
20009
20027
|
name: "firestore.document.delete",
|
|
20010
|
-
kind: import_src$
|
|
20028
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20011
20029
|
submodule: "document",
|
|
20012
20030
|
packageType: PackageType.FIRESTORE,
|
|
20013
20031
|
packageName: PACKAGE_NAME,
|
|
@@ -20025,7 +20043,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20025
20043
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20026
20044
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalDelete.call(this, precondition), {
|
|
20027
20045
|
name: "firestore.document.delete",
|
|
20028
|
-
kind: import_src$
|
|
20046
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20029
20047
|
submodule: "document",
|
|
20030
20048
|
packageType: PackageType.FIRESTORE,
|
|
20031
20049
|
packageName: PACKAGE_NAME,
|
|
@@ -20037,7 +20055,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20037
20055
|
return self._handleRecordDocumentWrite(spanInfo, originalDelete, this, precondition);
|
|
20038
20056
|
});
|
|
20039
20057
|
},
|
|
20040
|
-
spanKind: import_src$
|
|
20058
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20041
20059
|
});
|
|
20042
20060
|
else return originalDelete.call(this, precondition);
|
|
20043
20061
|
};
|
|
@@ -20051,7 +20069,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20051
20069
|
} : void 0 };
|
|
20052
20070
|
try {
|
|
20053
20071
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: result });
|
|
20054
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20072
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20055
20073
|
} catch {
|
|
20056
20074
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for document.write`);
|
|
20057
20075
|
}
|
|
@@ -20068,7 +20086,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20068
20086
|
packageName: PACKAGE_NAME,
|
|
20069
20087
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20070
20088
|
submoduleName: "document",
|
|
20071
|
-
kind: import_src$
|
|
20089
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20072
20090
|
},
|
|
20073
20091
|
tuskDrift: this.tuskDrift
|
|
20074
20092
|
});
|
|
@@ -20100,7 +20118,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20100
20118
|
replayModeHandler: () => {
|
|
20101
20119
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalAdd.call(this, data), {
|
|
20102
20120
|
name: "firestore.collection.add",
|
|
20103
|
-
kind: import_src$
|
|
20121
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20104
20122
|
submodule: "collection",
|
|
20105
20123
|
packageType: PackageType.FIRESTORE,
|
|
20106
20124
|
packageName: PACKAGE_NAME,
|
|
@@ -20118,7 +20136,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20118
20136
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20119
20137
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalAdd.call(this, data), {
|
|
20120
20138
|
name: "firestore.collection.add",
|
|
20121
|
-
kind: import_src$
|
|
20139
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20122
20140
|
submodule: "collection",
|
|
20123
20141
|
packageType: PackageType.FIRESTORE,
|
|
20124
20142
|
packageName: PACKAGE_NAME,
|
|
@@ -20130,7 +20148,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20130
20148
|
return self._handleRecordCollectionAdd(spanInfo, originalAdd, this, data);
|
|
20131
20149
|
});
|
|
20132
20150
|
},
|
|
20133
|
-
spanKind: import_src$
|
|
20151
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20134
20152
|
});
|
|
20135
20153
|
else return originalAdd.call(this, data);
|
|
20136
20154
|
};
|
|
@@ -20144,7 +20162,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20144
20162
|
};
|
|
20145
20163
|
try {
|
|
20146
20164
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: result });
|
|
20147
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20165
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20148
20166
|
} catch {
|
|
20149
20167
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for collection.add`);
|
|
20150
20168
|
}
|
|
@@ -20161,7 +20179,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20161
20179
|
packageName: PACKAGE_NAME,
|
|
20162
20180
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20163
20181
|
submoduleName: "collection",
|
|
20164
|
-
kind: import_src$
|
|
20182
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20165
20183
|
},
|
|
20166
20184
|
tuskDrift: this.tuskDrift
|
|
20167
20185
|
});
|
|
@@ -20194,7 +20212,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20194
20212
|
replayModeHandler: () => {
|
|
20195
20213
|
return SpanUtils.createAndExecuteSpan(self.mode, () => documentPath ? originalDoc.call(this, documentPath) : originalDoc.call(this), {
|
|
20196
20214
|
name: "firestore.collection.doc",
|
|
20197
|
-
kind: import_src$
|
|
20215
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20198
20216
|
submodule: "collection",
|
|
20199
20217
|
packageType: PackageType.FIRESTORE,
|
|
20200
20218
|
packageName: PACKAGE_NAME,
|
|
@@ -20212,7 +20230,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20212
20230
|
packageName: PACKAGE_NAME,
|
|
20213
20231
|
instrumentationName: self.INSTRUMENTATION_NAME,
|
|
20214
20232
|
submoduleName: "collection",
|
|
20215
|
-
kind: import_src$
|
|
20233
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20216
20234
|
},
|
|
20217
20235
|
tuskDrift: self.tuskDrift
|
|
20218
20236
|
});
|
|
@@ -20233,7 +20251,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20233
20251
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20234
20252
|
return SpanUtils.createAndExecuteSpan(self.mode, () => documentPath ? originalDoc.call(this, documentPath) : originalDoc.call(this), {
|
|
20235
20253
|
name: "firestore.collection.doc",
|
|
20236
|
-
kind: import_src$
|
|
20254
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20237
20255
|
submodule: "collection",
|
|
20238
20256
|
packageType: PackageType.FIRESTORE,
|
|
20239
20257
|
packageName: PACKAGE_NAME,
|
|
@@ -20249,14 +20267,14 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20249
20267
|
};
|
|
20250
20268
|
try {
|
|
20251
20269
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: result });
|
|
20252
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20270
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20253
20271
|
} catch {
|
|
20254
20272
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for collection.doc`);
|
|
20255
20273
|
}
|
|
20256
20274
|
return docRef;
|
|
20257
20275
|
});
|
|
20258
20276
|
},
|
|
20259
|
-
spanKind: import_src$
|
|
20277
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20260
20278
|
});
|
|
20261
20279
|
else return documentPath ? originalDoc.call(this, documentPath) : originalDoc.call(this);
|
|
20262
20280
|
};
|
|
@@ -20282,7 +20300,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20282
20300
|
replayModeHandler: () => {
|
|
20283
20301
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
20284
20302
|
name: "firestore.query.get",
|
|
20285
|
-
kind: import_src$
|
|
20303
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20286
20304
|
submodule: "query",
|
|
20287
20305
|
packageType: PackageType.FIRESTORE,
|
|
20288
20306
|
packageName: PACKAGE_NAME,
|
|
@@ -20300,7 +20318,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20300
20318
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20301
20319
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalGet.call(this), {
|
|
20302
20320
|
name: "firestore.query.get",
|
|
20303
|
-
kind: import_src$
|
|
20321
|
+
kind: import_src$14.SpanKind.CLIENT,
|
|
20304
20322
|
submodule: "query",
|
|
20305
20323
|
packageType: PackageType.FIRESTORE,
|
|
20306
20324
|
packageName: PACKAGE_NAME,
|
|
@@ -20312,7 +20330,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20312
20330
|
return self._handleRecordQueryGet(spanInfo, originalGet, this);
|
|
20313
20331
|
});
|
|
20314
20332
|
},
|
|
20315
|
-
spanKind: import_src$
|
|
20333
|
+
spanKind: import_src$14.SpanKind.CLIENT
|
|
20316
20334
|
});
|
|
20317
20335
|
else return originalGet.call(this);
|
|
20318
20336
|
};
|
|
@@ -20348,7 +20366,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20348
20366
|
};
|
|
20349
20367
|
try {
|
|
20350
20368
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue: queryResult });
|
|
20351
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20369
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$14.SpanStatusCode.OK });
|
|
20352
20370
|
} catch {
|
|
20353
20371
|
logger.error(`[FirestoreInstrumentation] Error updating span attributes for query.get`);
|
|
20354
20372
|
}
|
|
@@ -20365,7 +20383,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20365
20383
|
packageName: PACKAGE_NAME,
|
|
20366
20384
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20367
20385
|
submoduleName: "query",
|
|
20368
|
-
kind: import_src$
|
|
20386
|
+
kind: import_src$14.SpanKind.CLIENT
|
|
20369
20387
|
},
|
|
20370
20388
|
tuskDrift: this.tuskDrift
|
|
20371
20389
|
});
|
|
@@ -20388,7 +20406,7 @@ var FirestoreInstrumentation = class extends TdInstrumentationBase {
|
|
|
20388
20406
|
|
|
20389
20407
|
//#endregion
|
|
20390
20408
|
//#region src/instrumentation/libraries/nextjs/Instrumentation.ts
|
|
20391
|
-
var import_src$
|
|
20409
|
+
var import_src$13 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
20392
20410
|
var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
20393
20411
|
constructor(config = {}) {
|
|
20394
20412
|
super("nextjs", config);
|
|
@@ -20474,10 +20492,10 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20474
20492
|
logger.debug(`[NextjsInstrumentation] Setting replay trace id`, replayTraceId);
|
|
20475
20493
|
const ctxWithReplayTraceId = SpanUtils.setCurrentReplayTraceId(replayTraceId);
|
|
20476
20494
|
if (!ctxWithReplayTraceId) throw new Error("Error setting current replay trace id");
|
|
20477
|
-
return import_src$
|
|
20495
|
+
return import_src$13.context.with(ctxWithReplayTraceId, () => {
|
|
20478
20496
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalHandleRequest.call(this, req, res, parsedUrl), {
|
|
20479
20497
|
name: url,
|
|
20480
|
-
kind: import_src$
|
|
20498
|
+
kind: import_src$13.SpanKind.SERVER,
|
|
20481
20499
|
packageName: "nextjs",
|
|
20482
20500
|
submodule: method,
|
|
20483
20501
|
packageType: PackageType.HTTP,
|
|
@@ -20513,7 +20531,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20513
20531
|
};
|
|
20514
20532
|
return SpanUtils.createAndExecuteSpan(self.mode, () => originalHandleRequest.call(this, req, res, parsedUrl), {
|
|
20515
20533
|
name: url,
|
|
20516
|
-
kind: import_src$
|
|
20534
|
+
kind: import_src$13.SpanKind.SERVER,
|
|
20517
20535
|
packageName: "nextjs",
|
|
20518
20536
|
packageType: PackageType.HTTP,
|
|
20519
20537
|
submodule: method,
|
|
@@ -20533,7 +20551,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20533
20551
|
});
|
|
20534
20552
|
});
|
|
20535
20553
|
},
|
|
20536
|
-
spanKind: import_src$
|
|
20554
|
+
spanKind: import_src$13.SpanKind.SERVER
|
|
20537
20555
|
});
|
|
20538
20556
|
} else return originalHandleRequest.call(this, req, res, parsedUrl);
|
|
20539
20557
|
};
|
|
@@ -20541,8 +20559,8 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20541
20559
|
}
|
|
20542
20560
|
async _handleNextjsRequestInSpan({ req, res, parsedUrl, originalHandleRequest, spanInfo, inputValue, thisContext }) {
|
|
20543
20561
|
const self = this;
|
|
20544
|
-
import_src$
|
|
20545
|
-
import_src$
|
|
20562
|
+
import_src$13.context.bind(spanInfo.context, req);
|
|
20563
|
+
import_src$13.context.bind(spanInfo.context, res);
|
|
20546
20564
|
let completeInputValue = inputValue;
|
|
20547
20565
|
this._captureRequestBody(req, spanInfo, inputValue, (updatedInputValue) => {
|
|
20548
20566
|
completeInputValue = updatedInputValue;
|
|
@@ -20583,7 +20601,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20583
20601
|
logger.error(`[NextjsInstrumentation] Error in Next.js request: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20584
20602
|
try {
|
|
20585
20603
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20586
|
-
code: import_src$
|
|
20604
|
+
code: import_src$13.SpanStatusCode.ERROR,
|
|
20587
20605
|
message: error instanceof Error ? error.message : "Unknown error"
|
|
20588
20606
|
});
|
|
20589
20607
|
} catch (e) {
|
|
@@ -20628,10 +20646,10 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20628
20646
|
headers: { matchImportance: 0 }
|
|
20629
20647
|
}
|
|
20630
20648
|
});
|
|
20631
|
-
const status = (capturedStatusCode || 200) >=
|
|
20632
|
-
code: import_src$
|
|
20649
|
+
const status = (capturedStatusCode || 200) >= 300 ? {
|
|
20650
|
+
code: import_src$13.SpanStatusCode.ERROR,
|
|
20633
20651
|
message: `HTTP ${capturedStatusCode}`
|
|
20634
|
-
} : { code: import_src$
|
|
20652
|
+
} : { code: import_src$13.SpanStatusCode.OK };
|
|
20635
20653
|
SpanUtils.setStatus(spanInfo.span, status);
|
|
20636
20654
|
const decodedType = getDecodedType(outputValue.headers?.["content-type"] || "");
|
|
20637
20655
|
if (decodedType && !ACCEPTABLE_CONTENT_TYPES.has(decodedType)) {
|
|
@@ -20673,11 +20691,11 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20673
20691
|
outputSchemaHash: JsonSchemaHelper.generateDeterministicHash(outputSchema),
|
|
20674
20692
|
inputValueHash,
|
|
20675
20693
|
outputValueHash,
|
|
20676
|
-
kind: import_src$
|
|
20694
|
+
kind: import_src$13.SpanKind.SERVER,
|
|
20677
20695
|
packageType: PackageType.HTTP,
|
|
20678
20696
|
status: {
|
|
20679
|
-
code: (capturedStatusCode || 200) >=
|
|
20680
|
-
message: (capturedStatusCode || 200) >=
|
|
20697
|
+
code: (capturedStatusCode || 200) >= 300 ? StatusCode.ERROR : StatusCode.OK,
|
|
20698
|
+
message: (capturedStatusCode || 200) >= 300 ? `HTTP ${capturedStatusCode}` : ""
|
|
20681
20699
|
},
|
|
20682
20700
|
timestamp: {
|
|
20683
20701
|
seconds: Math.floor(now.getTime() / 1e3),
|
|
@@ -20699,7 +20717,7 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
20699
20717
|
logger.error(`[NextjsInstrumentation] Error in Next.js request: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20700
20718
|
try {
|
|
20701
20719
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20702
|
-
code: import_src$
|
|
20720
|
+
code: import_src$13.SpanStatusCode.ERROR,
|
|
20703
20721
|
message: error instanceof Error ? error.message : "Unknown error"
|
|
20704
20722
|
});
|
|
20705
20723
|
} catch (e) {
|
|
@@ -20793,7 +20811,7 @@ let PrismaErrorClassName = /* @__PURE__ */ function(PrismaErrorClassName$1) {
|
|
|
20793
20811
|
|
|
20794
20812
|
//#endregion
|
|
20795
20813
|
//#region src/instrumentation/libraries/prisma/Instrumentation.ts
|
|
20796
|
-
var import_src$
|
|
20814
|
+
var import_src$12 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
20797
20815
|
var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
20798
20816
|
constructor(config = {}) {
|
|
20799
20817
|
super("@prisma/client", config);
|
|
@@ -20879,7 +20897,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20879
20897
|
recordModeHandler: ({ isPreAppStart }) => {
|
|
20880
20898
|
return SpanUtils.createAndExecuteSpan(this.mode, () => query(args), {
|
|
20881
20899
|
name: `prisma.${operation}`,
|
|
20882
|
-
kind: import_src$
|
|
20900
|
+
kind: import_src$12.SpanKind.CLIENT,
|
|
20883
20901
|
submodule: model,
|
|
20884
20902
|
packageType: PackageType.PRISMA,
|
|
20885
20903
|
packageName: "@prisma/client",
|
|
@@ -20890,7 +20908,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20890
20908
|
return this._handleRecordPrismaOperation(spanInfo, query, args);
|
|
20891
20909
|
});
|
|
20892
20910
|
},
|
|
20893
|
-
spanKind: import_src$
|
|
20911
|
+
spanKind: import_src$12.SpanKind.CLIENT
|
|
20894
20912
|
});
|
|
20895
20913
|
else if (this.mode === TuskDriftMode.REPLAY) {
|
|
20896
20914
|
const stackTrace = captureStackTrace(["PrismaInstrumentation"]);
|
|
@@ -20900,7 +20918,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20900
20918
|
replayModeHandler: () => {
|
|
20901
20919
|
return SpanUtils.createAndExecuteSpan(this.mode, () => query(args), {
|
|
20902
20920
|
name: `prisma.${operation}`,
|
|
20903
|
-
kind: import_src$
|
|
20921
|
+
kind: import_src$12.SpanKind.CLIENT,
|
|
20904
20922
|
submodule: model,
|
|
20905
20923
|
packageType: PackageType.PRISMA,
|
|
20906
20924
|
packageName: "@prisma/client",
|
|
@@ -20924,7 +20942,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20924
20942
|
};
|
|
20925
20943
|
try {
|
|
20926
20944
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
20927
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
20945
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$12.SpanStatusCode.OK });
|
|
20928
20946
|
} catch (spanError) {
|
|
20929
20947
|
logger.error(`[PrismaInstrumentation] error adding span attributes:`, spanError);
|
|
20930
20948
|
}
|
|
@@ -20941,7 +20959,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20941
20959
|
};
|
|
20942
20960
|
SpanUtils.addSpanAttributes(spanInfo.span, { outputValue });
|
|
20943
20961
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20944
|
-
code: import_src$
|
|
20962
|
+
code: import_src$12.SpanStatusCode.ERROR,
|
|
20945
20963
|
message: error.message
|
|
20946
20964
|
});
|
|
20947
20965
|
} catch (spanError) {
|
|
@@ -20960,7 +20978,7 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20960
20978
|
packageName: "@prisma/client",
|
|
20961
20979
|
instrumentationName: this.INSTRUMENTATION_NAME,
|
|
20962
20980
|
submoduleName: inputValue.model,
|
|
20963
|
-
kind: import_src$
|
|
20981
|
+
kind: import_src$12.SpanKind.CLIENT,
|
|
20964
20982
|
stackTrace
|
|
20965
20983
|
},
|
|
20966
20984
|
tuskDrift: this.tuskDrift
|
|
@@ -20978,12 +20996,12 @@ var PrismaInstrumentation = class extends TdInstrumentationBase {
|
|
|
20978
20996
|
if (errorClass) Object.setPrototypeOf(errorObj, errorClass.prototype);
|
|
20979
20997
|
}
|
|
20980
20998
|
SpanUtils.endSpan(spanInfo.span, {
|
|
20981
|
-
code: import_src$
|
|
20999
|
+
code: import_src$12.SpanStatusCode.ERROR,
|
|
20982
21000
|
message: errorObj.message || "Prisma error"
|
|
20983
21001
|
});
|
|
20984
21002
|
throw errorObj;
|
|
20985
21003
|
}
|
|
20986
|
-
SpanUtils.endSpan(spanInfo.span, { code: import_src$
|
|
21004
|
+
SpanUtils.endSpan(spanInfo.span, { code: import_src$12.SpanStatusCode.OK });
|
|
20987
21005
|
return outputValue.prismaResult;
|
|
20988
21006
|
}
|
|
20989
21007
|
_getPrismaErrorClassName(error) {
|
|
@@ -25144,8 +25162,8 @@ var require_src$6 = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/co
|
|
|
25144
25162
|
|
|
25145
25163
|
//#endregion
|
|
25146
25164
|
//#region src/core/tracing/SpanTransformer.ts
|
|
25147
|
-
var import_src$
|
|
25148
|
-
var import_src$
|
|
25165
|
+
var import_src$10 = /* @__PURE__ */ __toESM(require_src$6(), 1);
|
|
25166
|
+
var import_src$11 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25149
25167
|
/**
|
|
25150
25168
|
* Utility class for transforming OpenTelemetry spans to CleanSpanData
|
|
25151
25169
|
*/
|
|
@@ -25156,7 +25174,7 @@ var SpanTransformer = class SpanTransformer {
|
|
|
25156
25174
|
* We use JSON because serialized protobuf is extremely verbose and not readable.
|
|
25157
25175
|
*/
|
|
25158
25176
|
static transformSpanToCleanJSON(span, environment) {
|
|
25159
|
-
const isRootSpan =
|
|
25177
|
+
const isRootSpan = span.kind === import_src$11.SpanKind.SERVER;
|
|
25160
25178
|
const attributes = span.attributes;
|
|
25161
25179
|
const packageName = SpanTransformer.extractPackageName(attributes);
|
|
25162
25180
|
const instrumentationName = SpanTransformer.extractInstrumentationName(span, attributes);
|
|
@@ -25276,11 +25294,11 @@ var FilesystemSpanAdapter = class {
|
|
|
25276
25294
|
fs$1.appendFileSync(filePath, jsonLine, "utf8");
|
|
25277
25295
|
}
|
|
25278
25296
|
logger.debug(`Exported ${spans.length} span(s) to trace-specific files in ${this.baseDirectory}`);
|
|
25279
|
-
return { code: import_src$
|
|
25297
|
+
return { code: import_src$10.ExportResultCode.SUCCESS };
|
|
25280
25298
|
} catch (error) {
|
|
25281
25299
|
logger.error(`Failed to export spans to local files:`, error);
|
|
25282
25300
|
return {
|
|
25283
|
-
code: import_src$
|
|
25301
|
+
code: import_src$10.ExportResultCode.FAILED,
|
|
25284
25302
|
error: error instanceof Error ? error : /* @__PURE__ */ new Error("Filesystem export failed")
|
|
25285
25303
|
};
|
|
25286
25304
|
}
|
|
@@ -25635,9 +25653,9 @@ var require_commonjs = /* @__PURE__ */ __commonJS({ "node_modules/@protobuf-ts/t
|
|
|
25635
25653
|
|
|
25636
25654
|
//#endregion
|
|
25637
25655
|
//#region src/core/tracing/adapters/ApiSpanAdapter.ts
|
|
25638
|
-
var import_src$
|
|
25656
|
+
var import_src$8 = /* @__PURE__ */ __toESM(require_src$6(), 1);
|
|
25639
25657
|
var import_commonjs$2 = /* @__PURE__ */ __toESM(require_commonjs(), 1);
|
|
25640
|
-
var import_src$
|
|
25658
|
+
var import_src$9 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25641
25659
|
const DRIFT_API_PATH = "/api/drift";
|
|
25642
25660
|
/**
|
|
25643
25661
|
* Exports spans to Tusk backend API via protobuf
|
|
@@ -25671,11 +25689,11 @@ var ApiSpanAdapter = class {
|
|
|
25671
25689
|
const response = await this.spanExportClient.exportSpans(request);
|
|
25672
25690
|
if (!response.response.success) throw new Error(`Remote export failed: ${response.response.message}`);
|
|
25673
25691
|
logger.debug(`Successfully exported ${spans.length} spans to remote endpoint`);
|
|
25674
|
-
return { code: import_src$
|
|
25692
|
+
return { code: import_src$8.ExportResultCode.SUCCESS };
|
|
25675
25693
|
} catch (error) {
|
|
25676
25694
|
logger.error(`Failed to export spans to remote:`, error);
|
|
25677
25695
|
return {
|
|
25678
|
-
code: import_src$
|
|
25696
|
+
code: import_src$8.ExportResultCode.FAILED,
|
|
25679
25697
|
error: error instanceof Error ? error : /* @__PURE__ */ new Error("API export failed")
|
|
25680
25698
|
};
|
|
25681
25699
|
}
|
|
@@ -25716,12 +25734,12 @@ var ApiSpanAdapter = class {
|
|
|
25716
25734
|
}
|
|
25717
25735
|
mapSpanKind(kind) {
|
|
25718
25736
|
switch (kind) {
|
|
25719
|
-
case import_src$
|
|
25720
|
-
case import_src$
|
|
25721
|
-
case import_src$
|
|
25722
|
-
case import_src$
|
|
25723
|
-
case import_src$
|
|
25724
|
-
default: return SpanKind$
|
|
25737
|
+
case import_src$9.SpanKind.CLIENT: return SpanKind$2.CLIENT;
|
|
25738
|
+
case import_src$9.SpanKind.SERVER: return SpanKind$2.SERVER;
|
|
25739
|
+
case import_src$9.SpanKind.PRODUCER: return SpanKind$2.PRODUCER;
|
|
25740
|
+
case import_src$9.SpanKind.CONSUMER: return SpanKind$2.CONSUMER;
|
|
25741
|
+
case import_src$9.SpanKind.INTERNAL: return SpanKind$2.INTERNAL;
|
|
25742
|
+
default: return SpanKind$2.UNSPECIFIED;
|
|
25725
25743
|
}
|
|
25726
25744
|
}
|
|
25727
25745
|
async shutdown() {
|
|
@@ -25732,6 +25750,8 @@ var ApiSpanAdapter = class {
|
|
|
25732
25750
|
//#endregion
|
|
25733
25751
|
//#region src/core/tracing/TdSpanExporter.ts
|
|
25734
25752
|
var import_src$5 = /* @__PURE__ */ __toESM(require_src$6(), 1);
|
|
25753
|
+
var import_src$6 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25754
|
+
var import_src$7 = /* @__PURE__ */ __toESM(require_src$7(), 1);
|
|
25735
25755
|
var TdSpanExporter = class {
|
|
25736
25756
|
constructor(config) {
|
|
25737
25757
|
this.adapters = [];
|
|
@@ -25808,6 +25828,11 @@ var TdSpanExporter = class {
|
|
|
25808
25828
|
logger.debug(`Skipping span '${span.name}' (${span.spanContext().spanId}) - trace ${traceId} is blocked`);
|
|
25809
25829
|
return false;
|
|
25810
25830
|
}
|
|
25831
|
+
if (span.kind === import_src$7.SpanKind.SERVER && span.status.code === import_src$6.SpanStatusCode.ERROR) {
|
|
25832
|
+
traceBlockingManager.blockTrace(traceId);
|
|
25833
|
+
logger.debug(`Blocking trace ${traceId} - server span has error status`);
|
|
25834
|
+
return false;
|
|
25835
|
+
}
|
|
25811
25836
|
const inputValueString = span.attributes[TdSpanAttributes.INPUT_VALUE] || "";
|
|
25812
25837
|
const outputValueString = span.attributes[TdSpanAttributes.OUTPUT_VALUE] || "";
|
|
25813
25838
|
const estimatedTotalSize = Buffer.byteLength(inputValueString, "utf8") + Buffer.byteLength(outputValueString, "utf8") + 5e4;
|
|
@@ -32971,7 +32996,7 @@ var require_src = /* @__PURE__ */ __commonJS({ "node_modules/@opentelemetry/sdk-
|
|
|
32971
32996
|
//#endregion
|
|
32972
32997
|
//#region package.json
|
|
32973
32998
|
var import_src$1 = /* @__PURE__ */ __toESM(require_src(), 1);
|
|
32974
|
-
var version = "0.1.
|
|
32999
|
+
var version = "0.1.21";
|
|
32975
33000
|
|
|
32976
33001
|
//#endregion
|
|
32977
33002
|
//#region src/version.ts
|
|
@@ -34870,14 +34895,8 @@ var TuskDriftCore = class TuskDriftCore {
|
|
|
34870
34895
|
logger.debug(`Using TCP connection to CLI: ${mockHost}:${mockPort}`);
|
|
34871
34896
|
} else {
|
|
34872
34897
|
const socketPath = mockSocket || path.join(os.tmpdir(), "tusk-connect.sock");
|
|
34873
|
-
|
|
34874
|
-
|
|
34875
|
-
if (!fs.statSync(socketPath).isSocket()) throw new Error(`Path exists but is not a socket: ${socketPath}`);
|
|
34876
|
-
logger.debug("Socket found and verified at", socketPath);
|
|
34877
|
-
} catch (error) {
|
|
34878
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") throw new Error(`Socket not found at ${socketPath}. Make sure Tusk CLI is running.`);
|
|
34879
|
-
throw new Error(`Socket check failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
34880
|
-
}
|
|
34898
|
+
if (!fs.existsSync(socketPath)) throw new Error(`Socket not found at ${socketPath}. Make sure Tusk CLI is running.`);
|
|
34899
|
+
logger.debug("Socket found at", socketPath);
|
|
34881
34900
|
connectionInfo = { socketPath };
|
|
34882
34901
|
}
|
|
34883
34902
|
this.cliConnectionPromise = this.communicator.connect(connectionInfo, this.config.service?.id || "unknown").then(() => {
|