autotel 2.25.3 → 2.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FXKB7EPR.cjs → chunk-A5ZUL2RZ.cjs} +5 -5
- package/dist/{chunk-FXKB7EPR.cjs.map → chunk-A5ZUL2RZ.cjs.map} +1 -1
- package/dist/{chunk-SR35DG5A.js → chunk-BBBWDIYQ.js} +27 -13
- package/dist/chunk-BBBWDIYQ.js.map +1 -0
- package/dist/{chunk-3ZLYWPMY.js → chunk-CMUM4JQI.js} +3 -3
- package/dist/{chunk-3ZLYWPMY.js.map → chunk-CMUM4JQI.js.map} +1 -1
- package/dist/{chunk-AQXPGGQK.cjs → chunk-EEJGUBWV.cjs} +5 -5
- package/dist/{chunk-AQXPGGQK.cjs.map → chunk-EEJGUBWV.cjs.map} +1 -1
- package/dist/{chunk-W4EUTSB2.cjs → chunk-HZ3FYBJG.cjs} +27 -12
- package/dist/chunk-HZ3FYBJG.cjs.map +1 -0
- package/dist/{chunk-WOWTZ4EB.cjs → chunk-I6JPSD4R.cjs} +5 -5
- package/dist/{chunk-WOWTZ4EB.cjs.map → chunk-I6JPSD4R.cjs.map} +1 -1
- package/dist/{chunk-XRKAL7WJ.cjs → chunk-JSNUWSBH.cjs} +6 -6
- package/dist/chunk-JSNUWSBH.cjs.map +1 -0
- package/dist/{chunk-OWXXS4JB.cjs → chunk-MN6PZ4AN.cjs} +7 -7
- package/dist/{chunk-OWXXS4JB.cjs.map → chunk-MN6PZ4AN.cjs.map} +1 -1
- package/dist/{chunk-JM63D22M.js → chunk-OPTGXEVN.js} +368 -349
- package/dist/chunk-OPTGXEVN.js.map +1 -0
- package/dist/{chunk-PKXD2RMI.js → chunk-QDREXAD7.js} +3 -3
- package/dist/{chunk-PKXD2RMI.js.map → chunk-QDREXAD7.js.map} +1 -1
- package/dist/{chunk-RMGSBMQF.cjs → chunk-QQLP4M6W.cjs} +372 -353
- package/dist/chunk-QQLP4M6W.cjs.map +1 -0
- package/dist/{chunk-USSL3D6L.js → chunk-S4OFEXLA.js} +6 -6
- package/dist/chunk-S4OFEXLA.js.map +1 -0
- package/dist/{chunk-VVYSQXQL.js → chunk-WYP6OOCT.js} +3 -3
- package/dist/{chunk-VVYSQXQL.js.map → chunk-WYP6OOCT.js.map} +1 -1
- package/dist/{chunk-IFKDBL65.js → chunk-XB2GITM5.js} +3 -3
- package/dist/{chunk-IFKDBL65.js.map → chunk-XB2GITM5.js.map} +1 -1
- package/dist/correlation-id.cjs +10 -9
- package/dist/correlation-id.d.cts +4 -1
- package/dist/correlation-id.d.ts +4 -1
- package/dist/correlation-id.js +2 -1
- package/dist/decorators.cjs +4 -4
- package/dist/decorators.js +3 -3
- package/dist/event.cjs +6 -5
- package/dist/event.js +3 -2
- package/dist/functional.cjs +10 -10
- package/dist/functional.js +3 -3
- package/dist/http.cjs +2 -2
- package/dist/http.js +1 -1
- package/dist/index.cjs +45 -45
- package/dist/index.js +10 -10
- package/dist/messaging.cjs +7 -7
- package/dist/messaging.js +4 -4
- package/dist/semantic-helpers.cjs +8 -8
- package/dist/semantic-helpers.js +4 -4
- package/dist/webhook.cjs +4 -4
- package/dist/webhook.js +3 -3
- package/dist/workflow-distributed.cjs +5 -5
- package/dist/workflow-distributed.js +3 -3
- package/dist/workflow.cjs +8 -8
- package/dist/workflow.js +4 -4
- package/package.json +1 -1
- package/src/correlation-id.ts +10 -5
- package/src/functional.ts +440 -420
- package/src/trace-context.test.ts +73 -0
- package/src/trace-context.ts +44 -12
- package/dist/chunk-JM63D22M.js.map +0 -1
- package/dist/chunk-RMGSBMQF.cjs.map +0 -1
- package/dist/chunk-SR35DG5A.js.map +0 -1
- package/dist/chunk-USSL3D6L.js.map +0 -1
- package/dist/chunk-W4EUTSB2.cjs.map +0 -1
- package/dist/chunk-XRKAL7WJ.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkW4EUTSB2_cjs = require('./chunk-W4EUTSB2.cjs');
|
|
4
3
|
var chunkGML3FBOT_cjs = require('./chunk-GML3FBOT.cjs');
|
|
5
4
|
var chunkD5LMF53P_cjs = require('./chunk-D5LMF53P.cjs');
|
|
6
|
-
var
|
|
5
|
+
var chunkJSNUWSBH_cjs = require('./chunk-JSNUWSBH.cjs');
|
|
6
|
+
var chunkHZ3FYBJG_cjs = require('./chunk-HZ3FYBJG.cjs');
|
|
7
7
|
var chunkITYASFHQ_cjs = require('./chunk-ITYASFHQ.cjs');
|
|
8
8
|
var chunk7FIGORWI_cjs = require('./chunk-7FIGORWI.cjs');
|
|
9
9
|
var chunkESLWRGAG_cjs = require('./chunk-ESLWRGAG.cjs');
|
|
@@ -304,7 +304,7 @@ var EventQueue = class {
|
|
|
304
304
|
}
|
|
305
305
|
const enrichedEvent = {
|
|
306
306
|
...event,
|
|
307
|
-
_correlationId: event._correlationId ||
|
|
307
|
+
_correlationId: event._correlationId || chunkJSNUWSBH_cjs.getOrCreateCorrelationId()
|
|
308
308
|
};
|
|
309
309
|
this.queue.push(enrichedEvent);
|
|
310
310
|
this.scheduleBatchFlush();
|
|
@@ -546,7 +546,7 @@ var eventsQueue = null;
|
|
|
546
546
|
function buildAutotelContext(span2) {
|
|
547
547
|
const eventsConfig = chunkITYASFHQ_cjs.getEventsConfig();
|
|
548
548
|
const config = chunkITYASFHQ_cjs.getConfig();
|
|
549
|
-
const correlationId =
|
|
549
|
+
const correlationId = chunkJSNUWSBH_cjs.getOrCreateCorrelationId();
|
|
550
550
|
if (!eventsConfig?.includeTraceContext) {
|
|
551
551
|
return {
|
|
552
552
|
correlation_id: correlationId
|
|
@@ -969,7 +969,7 @@ function shouldSkip(key, fn, skip) {
|
|
|
969
969
|
function getCtxValue() {
|
|
970
970
|
const activeSpan = api.trace.getActiveSpan();
|
|
971
971
|
if (!activeSpan) return null;
|
|
972
|
-
return
|
|
972
|
+
return chunkHZ3FYBJG_cjs.createTraceContext(activeSpan);
|
|
973
973
|
}
|
|
974
974
|
var ctx = new Proxy(
|
|
975
975
|
{},
|
|
@@ -1078,113 +1078,119 @@ function wrapWithTracing(fnFactory, options, variableName) {
|
|
|
1078
1078
|
if (options.spanKind !== void 0) {
|
|
1079
1079
|
spanOptions.kind = options.spanKind;
|
|
1080
1080
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
if (needsTailSampling && "shouldKeepTrace" in sampler && typeof sampler.shouldKeepTrace === "function") {
|
|
1095
|
-
shouldKeepSpan = sampler.shouldKeepTrace(samplingContext, {
|
|
1096
|
-
success,
|
|
1097
|
-
duration,
|
|
1098
|
-
error
|
|
1099
|
-
});
|
|
1100
|
-
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
|
|
1101
|
-
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
|
|
1081
|
+
const parentContext = chunkHZ3FYBJG_cjs.getActiveContextWithBaggage();
|
|
1082
|
+
return tracer.startActiveSpan(
|
|
1083
|
+
spanName,
|
|
1084
|
+
spanOptions,
|
|
1085
|
+
parentContext,
|
|
1086
|
+
async (span2) => {
|
|
1087
|
+
return chunkD5LMF53P_cjs.runInOperationContext(spanName, async () => {
|
|
1088
|
+
let shouldKeepSpan = true;
|
|
1089
|
+
chunkGML3FBOT_cjs.setSpanName(span2, spanName);
|
|
1090
|
+
const initialContext = api.context.active();
|
|
1091
|
+
const contextStorage = chunkHZ3FYBJG_cjs.getContextStorage();
|
|
1092
|
+
if (!contextStorage.getStore()) {
|
|
1093
|
+
chunkHZ3FYBJG_cjs.enterOrRun(contextStorage, initialContext);
|
|
1102
1094
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
operation: spanName,
|
|
1137
|
-
status: "error"
|
|
1138
|
-
});
|
|
1139
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1140
|
-
const truncatedMessage = truncateErrorMessage(errorMessage);
|
|
1141
|
-
span2.setStatus({
|
|
1142
|
-
code: api.SpanStatusCode.ERROR,
|
|
1143
|
-
message: truncatedMessage
|
|
1144
|
-
});
|
|
1145
|
-
span2.setAttributes({
|
|
1146
|
-
...argsAttributes,
|
|
1147
|
-
"operation.name": spanName,
|
|
1148
|
-
"code.function": spanName,
|
|
1149
|
-
"operation.duration": duration,
|
|
1150
|
-
"operation.success": false,
|
|
1151
|
-
error: true,
|
|
1152
|
-
"exception.type": error instanceof Error ? error.constructor.name : "Error",
|
|
1153
|
-
"exception.message": truncatedMessage
|
|
1154
|
-
});
|
|
1155
|
-
if (error instanceof Error && error.stack) {
|
|
1156
|
-
span2.setAttribute(
|
|
1157
|
-
"exception.stack",
|
|
1158
|
-
error.stack.slice(0, MAX_ERROR_MESSAGE_LENGTH)
|
|
1159
|
-
);
|
|
1160
|
-
}
|
|
1161
|
-
span2.recordException(
|
|
1162
|
-
error instanceof Error ? error : new Error(String(error))
|
|
1163
|
-
);
|
|
1164
|
-
handleTailSampling(false, duration, error);
|
|
1165
|
-
span2.end();
|
|
1166
|
-
await flushIfNeeded();
|
|
1167
|
-
throw error;
|
|
1168
|
-
};
|
|
1169
|
-
try {
|
|
1170
|
-
callCounter?.add(1, {
|
|
1171
|
-
operation: spanName,
|
|
1172
|
-
status: "started"
|
|
1173
|
-
});
|
|
1174
|
-
const executeWithContext = async () => {
|
|
1175
|
-
const currentContext = chunkW4EUTSB2_cjs.getActiveContextWithBaggage();
|
|
1176
|
-
return api.context.with(currentContext, async () => {
|
|
1177
|
-
return fn.call(this, ...args);
|
|
1095
|
+
const ctxValue = chunkHZ3FYBJG_cjs.createTraceContext(span2);
|
|
1096
|
+
const fn = fnFactory(ctxValue);
|
|
1097
|
+
const argsAttributes = options.attributesFromArgs ? options.attributesFromArgs(args) : {};
|
|
1098
|
+
const handleTailSampling = (success, duration, error) => {
|
|
1099
|
+
if (needsTailSampling && "shouldKeepTrace" in sampler && typeof sampler.shouldKeepTrace === "function") {
|
|
1100
|
+
shouldKeepSpan = sampler.shouldKeepTrace(samplingContext, {
|
|
1101
|
+
success,
|
|
1102
|
+
duration,
|
|
1103
|
+
error
|
|
1104
|
+
});
|
|
1105
|
+
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
|
|
1106
|
+
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
const onSuccess = async (result) => {
|
|
1110
|
+
const duration = performance.now() - startTime;
|
|
1111
|
+
callCounter?.add(1, {
|
|
1112
|
+
operation: spanName,
|
|
1113
|
+
status: "success"
|
|
1114
|
+
});
|
|
1115
|
+
durationHistogram?.record(duration, {
|
|
1116
|
+
operation: spanName,
|
|
1117
|
+
status: "success"
|
|
1118
|
+
});
|
|
1119
|
+
const resultAttributes = options.attributesFromResult ? options.attributesFromResult(result) : {};
|
|
1120
|
+
span2.setStatus({ code: api.SpanStatusCode.OK });
|
|
1121
|
+
span2.setAttributes({
|
|
1122
|
+
...argsAttributes,
|
|
1123
|
+
...resultAttributes,
|
|
1124
|
+
"operation.name": spanName,
|
|
1125
|
+
"code.function": spanName,
|
|
1126
|
+
"operation.duration": duration,
|
|
1127
|
+
"operation.success": true
|
|
1178
1128
|
});
|
|
1129
|
+
handleTailSampling(true, duration);
|
|
1130
|
+
span2.end();
|
|
1131
|
+
await flushIfNeeded();
|
|
1132
|
+
return result;
|
|
1179
1133
|
};
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1134
|
+
const onError = async (error) => {
|
|
1135
|
+
const duration = performance.now() - startTime;
|
|
1136
|
+
callCounter?.add(1, {
|
|
1137
|
+
operation: spanName,
|
|
1138
|
+
status: "error"
|
|
1139
|
+
});
|
|
1140
|
+
durationHistogram?.record(duration, {
|
|
1141
|
+
operation: spanName,
|
|
1142
|
+
status: "error"
|
|
1143
|
+
});
|
|
1144
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1145
|
+
const truncatedMessage = truncateErrorMessage(errorMessage);
|
|
1146
|
+
span2.setStatus({
|
|
1147
|
+
code: api.SpanStatusCode.ERROR,
|
|
1148
|
+
message: truncatedMessage
|
|
1149
|
+
});
|
|
1150
|
+
span2.setAttributes({
|
|
1151
|
+
...argsAttributes,
|
|
1152
|
+
"operation.name": spanName,
|
|
1153
|
+
"code.function": spanName,
|
|
1154
|
+
"operation.duration": duration,
|
|
1155
|
+
"operation.success": false,
|
|
1156
|
+
error: true,
|
|
1157
|
+
"exception.type": error instanceof Error ? error.constructor.name : "Error",
|
|
1158
|
+
"exception.message": truncatedMessage
|
|
1159
|
+
});
|
|
1160
|
+
if (error instanceof Error && error.stack) {
|
|
1161
|
+
span2.setAttribute(
|
|
1162
|
+
"exception.stack",
|
|
1163
|
+
error.stack.slice(0, MAX_ERROR_MESSAGE_LENGTH)
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
span2.recordException(
|
|
1167
|
+
error instanceof Error ? error : new Error(String(error))
|
|
1168
|
+
);
|
|
1169
|
+
handleTailSampling(false, duration, error);
|
|
1170
|
+
span2.end();
|
|
1171
|
+
await flushIfNeeded();
|
|
1172
|
+
throw error;
|
|
1173
|
+
};
|
|
1174
|
+
try {
|
|
1175
|
+
callCounter?.add(1, {
|
|
1176
|
+
operation: spanName,
|
|
1177
|
+
status: "started"
|
|
1178
|
+
});
|
|
1179
|
+
const executeWithContext = async () => {
|
|
1180
|
+
const currentContext = chunkHZ3FYBJG_cjs.getActiveContextWithBaggage();
|
|
1181
|
+
return api.context.with(currentContext, async () => {
|
|
1182
|
+
return fn.call(this, ...args);
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1185
|
+
const result = await executeWithContext();
|
|
1186
|
+
return await onSuccess(result);
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
await onError(error);
|
|
1189
|
+
throw error;
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
);
|
|
1188
1194
|
};
|
|
1189
1195
|
wrappedFunction[INSTRUMENTED_SYMBOL] = true;
|
|
1190
1196
|
Object.defineProperty(wrappedFunction, "name", {
|
|
@@ -1276,98 +1282,104 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
|
|
|
1276
1282
|
if (options.spanKind !== void 0) {
|
|
1277
1283
|
spanOptions.kind = options.spanKind;
|
|
1278
1284
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1285
|
+
const parentContext = chunkHZ3FYBJG_cjs.getActiveContextWithBaggage();
|
|
1286
|
+
return tracer.startActiveSpan(
|
|
1287
|
+
spanName,
|
|
1288
|
+
spanOptions,
|
|
1289
|
+
parentContext,
|
|
1290
|
+
(span2) => {
|
|
1291
|
+
return chunkD5LMF53P_cjs.runInOperationContext(spanName, () => {
|
|
1292
|
+
let shouldKeepSpan = true;
|
|
1293
|
+
chunkGML3FBOT_cjs.setSpanName(span2, spanName);
|
|
1294
|
+
const ctxValue = chunkHZ3FYBJG_cjs.createTraceContext(span2);
|
|
1295
|
+
const fn = fnFactory(ctxValue);
|
|
1296
|
+
const argsAttributes = options.attributesFromArgs ? options.attributesFromArgs(args) : {};
|
|
1297
|
+
const handleTailSampling = (success, duration, error) => {
|
|
1298
|
+
if (needsTailSampling && "shouldKeepTrace" in sampler && typeof sampler.shouldKeepTrace === "function") {
|
|
1299
|
+
shouldKeepSpan = sampler.shouldKeepTrace(samplingContext, {
|
|
1300
|
+
success,
|
|
1301
|
+
duration,
|
|
1302
|
+
error
|
|
1303
|
+
});
|
|
1304
|
+
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
|
|
1305
|
+
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
const onSuccess = (result) => {
|
|
1309
|
+
const duration = performance.now() - startTime;
|
|
1310
|
+
callCounter?.add(1, {
|
|
1311
|
+
operation: spanName,
|
|
1312
|
+
status: "success"
|
|
1292
1313
|
});
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
error
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
operation: spanName,
|
|
1359
|
-
status: "started"
|
|
1360
|
-
});
|
|
1361
|
-
const result = fn.call(this, ...args);
|
|
1362
|
-
if (result instanceof Promise) {
|
|
1363
|
-
return result.then(onSuccess, onError);
|
|
1314
|
+
durationHistogram?.record(duration, {
|
|
1315
|
+
operation: spanName,
|
|
1316
|
+
status: "success"
|
|
1317
|
+
});
|
|
1318
|
+
const resultAttributes = options.attributesFromResult ? options.attributesFromResult(result) : {};
|
|
1319
|
+
span2.setStatus({ code: api.SpanStatusCode.OK });
|
|
1320
|
+
span2.setAttributes({
|
|
1321
|
+
...argsAttributes,
|
|
1322
|
+
...resultAttributes,
|
|
1323
|
+
"operation.name": spanName,
|
|
1324
|
+
"code.function": spanName,
|
|
1325
|
+
"operation.duration": duration,
|
|
1326
|
+
"operation.success": true
|
|
1327
|
+
});
|
|
1328
|
+
handleTailSampling(true, duration);
|
|
1329
|
+
span2.end();
|
|
1330
|
+
void flushIfNeeded();
|
|
1331
|
+
return result;
|
|
1332
|
+
};
|
|
1333
|
+
const onError = (error) => {
|
|
1334
|
+
const duration = performance.now() - startTime;
|
|
1335
|
+
callCounter?.add(1, {
|
|
1336
|
+
operation: spanName,
|
|
1337
|
+
status: "error"
|
|
1338
|
+
});
|
|
1339
|
+
durationHistogram?.record(duration, {
|
|
1340
|
+
operation: spanName,
|
|
1341
|
+
status: "error"
|
|
1342
|
+
});
|
|
1343
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1344
|
+
const truncatedMessage = truncateErrorMessage(errorMessage);
|
|
1345
|
+
span2.setStatus({
|
|
1346
|
+
code: api.SpanStatusCode.ERROR,
|
|
1347
|
+
message: truncatedMessage
|
|
1348
|
+
});
|
|
1349
|
+
span2.setAttributes({
|
|
1350
|
+
...argsAttributes,
|
|
1351
|
+
"operation.name": spanName,
|
|
1352
|
+
"code.function": spanName,
|
|
1353
|
+
"operation.duration": duration,
|
|
1354
|
+
"operation.success": false,
|
|
1355
|
+
error: true,
|
|
1356
|
+
"exception.type": error instanceof Error ? error.constructor.name : "Error",
|
|
1357
|
+
"exception.message": truncatedMessage
|
|
1358
|
+
});
|
|
1359
|
+
span2.recordException(
|
|
1360
|
+
error instanceof Error ? error : new Error(String(error))
|
|
1361
|
+
);
|
|
1362
|
+
handleTailSampling(false, duration, error);
|
|
1363
|
+
span2.end();
|
|
1364
|
+
void flushIfNeeded();
|
|
1365
|
+
throw error;
|
|
1366
|
+
};
|
|
1367
|
+
try {
|
|
1368
|
+
callCounter?.add(1, {
|
|
1369
|
+
operation: spanName,
|
|
1370
|
+
status: "started"
|
|
1371
|
+
});
|
|
1372
|
+
const result = fn.call(this, ...args);
|
|
1373
|
+
if (result instanceof Promise) {
|
|
1374
|
+
return result.then(onSuccess, onError);
|
|
1375
|
+
}
|
|
1376
|
+
return onSuccess(result);
|
|
1377
|
+
} catch (error) {
|
|
1378
|
+
return onError(error);
|
|
1364
1379
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
}
|
|
1369
|
-
});
|
|
1370
|
-
});
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
);
|
|
1371
1383
|
}
|
|
1372
1384
|
wrappedFunction[INSTRUMENTED_SYMBOL] = true;
|
|
1373
1385
|
Object.defineProperty(wrappedFunction, "name", {
|
|
@@ -1446,159 +1458,165 @@ function executeImmediately(fn, options) {
|
|
|
1446
1458
|
if (options.spanKind !== void 0) {
|
|
1447
1459
|
spanOptions.kind = options.spanKind;
|
|
1448
1460
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1461
|
+
const parentContext = chunkHZ3FYBJG_cjs.getActiveContextWithBaggage();
|
|
1462
|
+
return tracer.startActiveSpan(
|
|
1463
|
+
spanName,
|
|
1464
|
+
spanOptions,
|
|
1465
|
+
parentContext,
|
|
1466
|
+
(span2) => {
|
|
1467
|
+
return chunkD5LMF53P_cjs.runInOperationContext(spanName, () => {
|
|
1468
|
+
let shouldKeepSpan = true;
|
|
1469
|
+
chunkGML3FBOT_cjs.setSpanName(span2, spanName);
|
|
1470
|
+
const ctxValue = chunkHZ3FYBJG_cjs.createTraceContext(span2);
|
|
1471
|
+
const handleTailSampling = (success, duration, error) => {
|
|
1472
|
+
if (needsTailSampling && "shouldKeepTrace" in sampler && typeof sampler.shouldKeepTrace === "function") {
|
|
1473
|
+
shouldKeepSpan = sampler.shouldKeepTrace(samplingContext, {
|
|
1474
|
+
success,
|
|
1475
|
+
duration,
|
|
1476
|
+
error
|
|
1477
|
+
});
|
|
1478
|
+
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
|
|
1479
|
+
span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
const onSuccessSync = (result) => {
|
|
1483
|
+
const duration = performance.now() - startTime;
|
|
1484
|
+
callCounter?.add(1, {
|
|
1485
|
+
operation: spanName,
|
|
1486
|
+
status: "success"
|
|
1460
1487
|
});
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
"exception.message": truncatedMessage
|
|
1511
|
-
});
|
|
1512
|
-
if (error instanceof Error && error.stack) {
|
|
1513
|
-
span2.setAttribute(
|
|
1514
|
-
"exception.stack",
|
|
1515
|
-
error.stack.slice(0, MAX_ERROR_MESSAGE_LENGTH)
|
|
1488
|
+
durationHistogram?.record(duration, {
|
|
1489
|
+
operation: spanName,
|
|
1490
|
+
status: "success"
|
|
1491
|
+
});
|
|
1492
|
+
span2.setStatus({ code: api.SpanStatusCode.OK });
|
|
1493
|
+
span2.setAttributes({
|
|
1494
|
+
"operation.name": spanName,
|
|
1495
|
+
"code.function": spanName,
|
|
1496
|
+
"operation.duration": duration,
|
|
1497
|
+
"operation.success": true
|
|
1498
|
+
});
|
|
1499
|
+
handleTailSampling(true, duration);
|
|
1500
|
+
span2.end();
|
|
1501
|
+
void flushIfNeeded();
|
|
1502
|
+
return result;
|
|
1503
|
+
};
|
|
1504
|
+
const onErrorSync = (error) => {
|
|
1505
|
+
const duration = performance.now() - startTime;
|
|
1506
|
+
callCounter?.add(1, {
|
|
1507
|
+
operation: spanName,
|
|
1508
|
+
status: "error"
|
|
1509
|
+
});
|
|
1510
|
+
durationHistogram?.record(duration, {
|
|
1511
|
+
operation: spanName,
|
|
1512
|
+
status: "error"
|
|
1513
|
+
});
|
|
1514
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1515
|
+
const truncatedMessage = truncateErrorMessage(errorMessage);
|
|
1516
|
+
span2.setStatus({
|
|
1517
|
+
code: api.SpanStatusCode.ERROR,
|
|
1518
|
+
message: truncatedMessage
|
|
1519
|
+
});
|
|
1520
|
+
span2.setAttributes({
|
|
1521
|
+
"operation.name": spanName,
|
|
1522
|
+
"code.function": spanName,
|
|
1523
|
+
"operation.duration": duration,
|
|
1524
|
+
"operation.success": false,
|
|
1525
|
+
error: true,
|
|
1526
|
+
"exception.type": error instanceof Error ? error.constructor.name : "Error",
|
|
1527
|
+
"exception.message": truncatedMessage
|
|
1528
|
+
});
|
|
1529
|
+
if (error instanceof Error && error.stack) {
|
|
1530
|
+
span2.setAttribute(
|
|
1531
|
+
"exception.stack",
|
|
1532
|
+
error.stack.slice(0, MAX_ERROR_MESSAGE_LENGTH)
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
span2.recordException(
|
|
1536
|
+
error instanceof Error ? error : new Error(String(error))
|
|
1516
1537
|
);
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
error
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
error
|
|
1538
|
+
handleTailSampling(false, duration, error);
|
|
1539
|
+
span2.end();
|
|
1540
|
+
void flushIfNeeded();
|
|
1541
|
+
throw error;
|
|
1542
|
+
};
|
|
1543
|
+
const onSuccessAsync = async (result) => {
|
|
1544
|
+
const duration = performance.now() - startTime;
|
|
1545
|
+
callCounter?.add(1, {
|
|
1546
|
+
operation: spanName,
|
|
1547
|
+
status: "success"
|
|
1548
|
+
});
|
|
1549
|
+
durationHistogram?.record(duration, {
|
|
1550
|
+
operation: spanName,
|
|
1551
|
+
status: "success"
|
|
1552
|
+
});
|
|
1553
|
+
span2.setStatus({ code: api.SpanStatusCode.OK });
|
|
1554
|
+
span2.setAttributes({
|
|
1555
|
+
"operation.name": spanName,
|
|
1556
|
+
"code.function": spanName,
|
|
1557
|
+
"operation.duration": duration,
|
|
1558
|
+
"operation.success": true
|
|
1559
|
+
});
|
|
1560
|
+
handleTailSampling(true, duration);
|
|
1561
|
+
span2.end();
|
|
1562
|
+
await flushIfNeeded();
|
|
1563
|
+
return result;
|
|
1564
|
+
};
|
|
1565
|
+
const onErrorAsync = async (error) => {
|
|
1566
|
+
const duration = performance.now() - startTime;
|
|
1567
|
+
callCounter?.add(1, {
|
|
1568
|
+
operation: spanName,
|
|
1569
|
+
status: "error"
|
|
1570
|
+
});
|
|
1571
|
+
durationHistogram?.record(duration, {
|
|
1572
|
+
operation: spanName,
|
|
1573
|
+
status: "error"
|
|
1574
|
+
});
|
|
1575
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1576
|
+
const truncatedMessage = truncateErrorMessage(errorMessage);
|
|
1577
|
+
span2.setStatus({
|
|
1578
|
+
code: api.SpanStatusCode.ERROR,
|
|
1579
|
+
message: truncatedMessage
|
|
1580
|
+
});
|
|
1581
|
+
span2.setAttributes({
|
|
1582
|
+
"operation.name": spanName,
|
|
1583
|
+
"code.function": spanName,
|
|
1584
|
+
"operation.duration": duration,
|
|
1585
|
+
"operation.success": false,
|
|
1586
|
+
error: true,
|
|
1587
|
+
"exception.type": error instanceof Error ? error.constructor.name : "Error",
|
|
1588
|
+
"exception.message": truncatedMessage
|
|
1589
|
+
});
|
|
1590
|
+
if (error instanceof Error && error.stack) {
|
|
1591
|
+
span2.setAttribute(
|
|
1592
|
+
"exception.stack",
|
|
1593
|
+
error.stack.slice(0, MAX_ERROR_MESSAGE_LENGTH)
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1596
|
+
span2.recordException(
|
|
1597
|
+
error instanceof Error ? error : new Error(String(error))
|
|
1577
1598
|
);
|
|
1599
|
+
handleTailSampling(false, duration, error);
|
|
1600
|
+
span2.end();
|
|
1601
|
+
await flushIfNeeded();
|
|
1602
|
+
throw error;
|
|
1603
|
+
};
|
|
1604
|
+
try {
|
|
1605
|
+
callCounter?.add(1, {
|
|
1606
|
+
operation: spanName,
|
|
1607
|
+
status: "started"
|
|
1608
|
+
});
|
|
1609
|
+
const result = fn(ctxValue);
|
|
1610
|
+
if (result instanceof Promise) {
|
|
1611
|
+
return result.then(onSuccessAsync, onErrorAsync);
|
|
1612
|
+
}
|
|
1613
|
+
return onSuccessSync(result);
|
|
1614
|
+
} catch (error) {
|
|
1615
|
+
return onErrorSync(error);
|
|
1578
1616
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
handleTailSampling(false, duration, error);
|
|
1583
|
-
span2.end();
|
|
1584
|
-
await flushIfNeeded();
|
|
1585
|
-
throw error;
|
|
1586
|
-
};
|
|
1587
|
-
try {
|
|
1588
|
-
callCounter?.add(1, {
|
|
1589
|
-
operation: spanName,
|
|
1590
|
-
status: "started"
|
|
1591
|
-
});
|
|
1592
|
-
const result = fn(ctxValue);
|
|
1593
|
-
if (result instanceof Promise) {
|
|
1594
|
-
return result.then(onSuccessAsync, onErrorAsync);
|
|
1595
|
-
}
|
|
1596
|
-
return onSuccessSync(result);
|
|
1597
|
-
} catch (error) {
|
|
1598
|
-
return onErrorSync(error);
|
|
1599
|
-
}
|
|
1600
|
-
});
|
|
1601
|
-
});
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
);
|
|
1602
1620
|
}
|
|
1603
1621
|
function trace2(fnOrNameOrOptions, maybeFn) {
|
|
1604
1622
|
if (typeof fnOrNameOrOptions === "function") {
|
|
@@ -1730,7 +1748,8 @@ function span(options, fn) {
|
|
|
1730
1748
|
}
|
|
1731
1749
|
});
|
|
1732
1750
|
};
|
|
1733
|
-
const
|
|
1751
|
+
const parentContext = chunkHZ3FYBJG_cjs.getActiveContextWithBaggage();
|
|
1752
|
+
const result = tracer.startActiveSpan(name, {}, parentContext, executeSpan);
|
|
1734
1753
|
if (result instanceof Promise) {
|
|
1735
1754
|
return result;
|
|
1736
1755
|
}
|
|
@@ -1764,9 +1783,9 @@ function withBaggage(options) {
|
|
|
1764
1783
|
updatedBaggage = updatedBaggage.setEntry(key, { value });
|
|
1765
1784
|
}
|
|
1766
1785
|
const newContext = api.propagation.setBaggage(currentContext, updatedBaggage);
|
|
1767
|
-
const ctxStorage =
|
|
1786
|
+
const ctxStorage = chunkHZ3FYBJG_cjs.getContextStorage();
|
|
1768
1787
|
const previousStored = ctxStorage.getStore();
|
|
1769
|
-
const baggageEnrichedStored = previousStored ? api.propagation.setBaggage(previousStored, updatedBaggage) : newContext;
|
|
1788
|
+
const baggageEnrichedStored = previousStored ? { value: api.propagation.setBaggage(previousStored.value, updatedBaggage) } : { value: newContext };
|
|
1770
1789
|
const result = previousStored ? ctxStorage.run(baggageEnrichedStored, () => api.context.with(newContext, fn)) : api.context.with(newContext, fn);
|
|
1771
1790
|
if (result instanceof Promise) {
|
|
1772
1791
|
return result.then(
|
|
@@ -1799,5 +1818,5 @@ exports.track = track;
|
|
|
1799
1818
|
exports.withBaggage = withBaggage;
|
|
1800
1819
|
exports.withNewContext = withNewContext;
|
|
1801
1820
|
exports.withTracing = withTracing;
|
|
1802
|
-
//# sourceMappingURL=chunk-
|
|
1803
|
-
//# sourceMappingURL=chunk-
|
|
1821
|
+
//# sourceMappingURL=chunk-QQLP4M6W.cjs.map
|
|
1822
|
+
//# sourceMappingURL=chunk-QQLP4M6W.cjs.map
|