bitfab 0.52.5 → 0.53.0
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/autoTrace.cjs +84 -34
- package/dist/autoTrace.cjs.map +1 -1
- package/dist/autoTrace.d.cts +19 -4
- package/dist/autoTrace.d.ts +19 -4
- package/dist/autoTrace.js +9 -3
- package/dist/{chunk-CAE7HE4C.js → chunk-6IMGAODW.js} +2 -2
- package/dist/{chunk-CAE7HE4C.js.map → chunk-6IMGAODW.js.map} +1 -1
- package/dist/{chunk-3D7FNJ5R.js → chunk-CBRO6BP7.js} +2 -2
- package/dist/{chunk-3D7FNJ5R.js.map → chunk-CBRO6BP7.js.map} +1 -1
- package/dist/{chunk-3QXNM62Y.js → chunk-DTC6SIXW.js} +3 -3
- package/dist/{chunk-ZUD7OFYB.js → chunk-E5BLYL5X.js} +81 -34
- package/dist/chunk-E5BLYL5X.js.map +1 -0
- package/dist/{chunk-EMRHO6YW.js → chunk-SCXR43UF.js} +160 -33
- package/dist/chunk-SCXR43UF.js.map +1 -0
- package/dist/{chunk-6DRFQJ75.js → chunk-SJKWUQ3G.js} +2 -2
- package/dist/{http-UQT6QVBC.js → http-KP7DVTOD.js} +2 -2
- package/dist/{http-Q6UEKZRF.js → http-SEN3PUXX.js} +2 -2
- package/dist/index.cjs +206 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/node.cjs +206 -50
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +4 -4
- package/dist/{replay-UVSZFZW7.js → replay-Y5RIJOWE.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-EMRHO6YW.js.map +0 -1
- package/dist/chunk-ZUD7OFYB.js.map +0 -1
- /package/dist/{chunk-3QXNM62Y.js.map → chunk-DTC6SIXW.js.map} +0 -0
- /package/dist/{chunk-6DRFQJ75.js.map → chunk-SJKWUQ3G.js.map} +0 -0
- /package/dist/{http-Q6UEKZRF.js.map → http-KP7DVTOD.js.map} +0 -0
- /package/dist/{http-UQT6QVBC.js.map → http-SEN3PUXX.js.map} +0 -0
- /package/dist/{replay-UVSZFZW7.js.map → replay-Y5RIJOWE.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
replayContextReady,
|
|
6
6
|
runWithReplayContext,
|
|
7
7
|
warnOnce
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6IMGAODW.js";
|
|
9
9
|
|
|
10
10
|
// src/gitCommand.ts
|
|
11
11
|
var EXIT_GRACE_MS = 500;
|
|
@@ -1303,4 +1303,4 @@ export {
|
|
|
1303
1303
|
sleepForReplayPersistence,
|
|
1304
1304
|
replay
|
|
1305
1305
|
};
|
|
1306
|
-
//# sourceMappingURL=chunk-
|
|
1306
|
+
//# sourceMappingURL=chunk-SJKWUQ3G.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CBRO6BP7.js";
|
|
10
10
|
export {
|
|
11
11
|
BitfabError,
|
|
12
12
|
HttpClient,
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
parseRetryAfterMs,
|
|
17
17
|
serializePayloadBody
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=http-
|
|
19
|
+
//# sourceMappingURL=http-KP7DVTOD.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
flushTraces,
|
|
7
7
|
parseRetryAfterMs,
|
|
8
8
|
serializePayloadBody
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6IMGAODW.js";
|
|
10
10
|
import "./chunk-H6LZRFMN.js";
|
|
11
11
|
export {
|
|
12
12
|
BitfabError,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
parseRetryAfterMs,
|
|
18
18
|
serializePayloadBody
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=http-
|
|
20
|
+
//# sourceMappingURL=http-SEN3PUXX.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,7 @@ var __version__, __packageName__;
|
|
|
51
51
|
var init_version_generated = __esm({
|
|
52
52
|
"src/version.generated.ts"() {
|
|
53
53
|
"use strict";
|
|
54
|
-
__version__ = "0.
|
|
54
|
+
__version__ = "0.53.0";
|
|
55
55
|
__packageName__ = "bitfab";
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -4207,19 +4207,18 @@ init_asyncStorage();
|
|
|
4207
4207
|
// src/autoTrace.ts
|
|
4208
4208
|
init_asyncStorage();
|
|
4209
4209
|
var autoTraceGlobal = globalThis;
|
|
4210
|
-
var autoTraceState = autoTraceGlobal.
|
|
4210
|
+
var autoTraceState = autoTraceGlobal.__bitfabAutoTraceStateV4 ?? {
|
|
4211
4211
|
storage: null,
|
|
4212
4212
|
browserScope: void 0,
|
|
4213
4213
|
capturePolicies: /* @__PURE__ */ new WeakMap(),
|
|
4214
4214
|
activeRoots: 0
|
|
4215
4215
|
};
|
|
4216
|
-
autoTraceGlobal.
|
|
4216
|
+
autoTraceGlobal.__bitfabAutoTraceStateV4 = autoTraceState;
|
|
4217
4217
|
function initializeAutoTraceStorage() {
|
|
4218
4218
|
autoTraceState.storage ?? (autoTraceState.storage = createAsyncLocalStorage());
|
|
4219
4219
|
}
|
|
4220
|
-
function
|
|
4220
|
+
function runWithAutoTraceScope(scope, fn) {
|
|
4221
4221
|
initializeAutoTraceStorage();
|
|
4222
|
-
const scope = { context, depth };
|
|
4223
4222
|
if (autoTraceState.storage) {
|
|
4224
4223
|
return autoTraceState.storage.run(scope, fn);
|
|
4225
4224
|
}
|
|
@@ -4231,41 +4230,65 @@ function runWithAutoTraceContext(context, fn, depth = 0) {
|
|
|
4231
4230
|
autoTraceState.browserScope = previous;
|
|
4232
4231
|
}
|
|
4233
4232
|
}
|
|
4233
|
+
function currentAutoTraceEntries() {
|
|
4234
|
+
return currentAutoTraceScope()?.entries ?? [];
|
|
4235
|
+
}
|
|
4236
|
+
function replaceEntry(entries, previous, updated) {
|
|
4237
|
+
return entries.map((entry) => entry === previous ? updated : entry);
|
|
4238
|
+
}
|
|
4239
|
+
function runWithAutoTraceEntry(previous, updated, fn) {
|
|
4240
|
+
const result = runWithAutoTraceScope(
|
|
4241
|
+
{ entries: replaceEntry(currentAutoTraceEntries(), previous, updated) },
|
|
4242
|
+
fn
|
|
4243
|
+
);
|
|
4244
|
+
if (isAutoTraceAsyncGenerator(result)) {
|
|
4245
|
+
return wrapAutoTraceEntryAsyncGenerator(previous, updated, result);
|
|
4246
|
+
}
|
|
4247
|
+
return result;
|
|
4248
|
+
}
|
|
4249
|
+
function wrapAutoTraceEntryAsyncGenerator(previous, updated, source) {
|
|
4250
|
+
const step = (method, value) => runWithAutoTraceScope(
|
|
4251
|
+
{ entries: replaceEntry(currentAutoTraceEntries(), previous, updated) },
|
|
4252
|
+
() => source[method](value)
|
|
4253
|
+
);
|
|
4254
|
+
const wrapped = {
|
|
4255
|
+
next: (value) => step("next", value),
|
|
4256
|
+
return: (value) => step("return", value),
|
|
4257
|
+
throw: (error) => step("throw", error),
|
|
4258
|
+
[Symbol.asyncIterator]: () => wrapped
|
|
4259
|
+
};
|
|
4260
|
+
return wrapped;
|
|
4261
|
+
}
|
|
4262
|
+
function clearAutoTraceNodeConfiguration(fn) {
|
|
4263
|
+
return runWithAutoTraceScope({ entries: currentAutoTraceEntries() }, fn);
|
|
4264
|
+
}
|
|
4234
4265
|
function runWithAutoTraceNodeConfiguration(nodeConfiguration, fn) {
|
|
4235
4266
|
const scope = currentAutoTraceScope();
|
|
4236
|
-
if (!scope) {
|
|
4267
|
+
if (!scope || scope.entries.length === 0) {
|
|
4237
4268
|
return fn();
|
|
4238
4269
|
}
|
|
4239
|
-
const
|
|
4240
|
-
let result;
|
|
4241
|
-
if (autoTraceState.storage) {
|
|
4242
|
-
result = autoTraceState.storage.run(configuredScope, fn);
|
|
4243
|
-
} else {
|
|
4244
|
-
const previous = autoTraceState.browserScope;
|
|
4245
|
-
autoTraceState.browserScope = configuredScope;
|
|
4246
|
-
try {
|
|
4247
|
-
result = fn();
|
|
4248
|
-
} finally {
|
|
4249
|
-
autoTraceState.browserScope = previous;
|
|
4250
|
-
}
|
|
4251
|
-
}
|
|
4270
|
+
const result = runWithAutoTraceScope({ ...scope, nodeConfiguration }, fn);
|
|
4252
4271
|
if (isAutoTraceAsyncGenerator(result)) {
|
|
4253
4272
|
return wrapAutoTraceNodeAsyncGenerator(nodeConfiguration, result);
|
|
4254
4273
|
}
|
|
4255
4274
|
return result;
|
|
4256
4275
|
}
|
|
4257
|
-
function runWithAutoTraceRootContext(context, fn) {
|
|
4276
|
+
function runWithAutoTraceRootContext(context, spanStack, fn) {
|
|
4258
4277
|
autoTraceState.activeRoots += 1;
|
|
4278
|
+
const entries = [
|
|
4279
|
+
...currentAutoTraceEntries(),
|
|
4280
|
+
{ context, depth: 0, spanStack }
|
|
4281
|
+
];
|
|
4259
4282
|
let result;
|
|
4260
4283
|
try {
|
|
4261
|
-
result =
|
|
4284
|
+
result = runWithAutoTraceScope({ entries }, fn);
|
|
4262
4285
|
} catch (error) {
|
|
4263
4286
|
autoTraceState.activeRoots -= 1;
|
|
4264
4287
|
throw error;
|
|
4265
4288
|
}
|
|
4266
4289
|
if (isAutoTraceAsyncGenerator(result)) {
|
|
4267
4290
|
autoTraceState.activeRoots -= 1;
|
|
4268
|
-
return wrapAutoTraceAsyncGenerator(context, result);
|
|
4291
|
+
return wrapAutoTraceAsyncGenerator(context, spanStack, result);
|
|
4269
4292
|
}
|
|
4270
4293
|
if (result instanceof Promise) {
|
|
4271
4294
|
return result.finally(() => {
|
|
@@ -4275,6 +4298,15 @@ function runWithAutoTraceRootContext(context, fn) {
|
|
|
4275
4298
|
autoTraceState.activeRoots -= 1;
|
|
4276
4299
|
return result;
|
|
4277
4300
|
}
|
|
4301
|
+
function invokeThroughAutoTraceEntries(entries, step, fn) {
|
|
4302
|
+
let run = fn;
|
|
4303
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
4304
|
+
const entry = entries[index];
|
|
4305
|
+
const next = run;
|
|
4306
|
+
run = () => step(entry, next);
|
|
4307
|
+
}
|
|
4308
|
+
return run();
|
|
4309
|
+
}
|
|
4278
4310
|
function isAutoTraceAsyncGenerator(value) {
|
|
4279
4311
|
if (value === null || typeof value !== "object") {
|
|
4280
4312
|
return false;
|
|
@@ -4282,8 +4314,8 @@ function isAutoTraceAsyncGenerator(value) {
|
|
|
4282
4314
|
const candidate = value;
|
|
4283
4315
|
return typeof candidate.next === "function" && typeof candidate.return === "function" && typeof candidate.throw === "function" && typeof candidate[Symbol.asyncIterator] === "function";
|
|
4284
4316
|
}
|
|
4285
|
-
function wrapAutoTraceAsyncGenerator(context, source) {
|
|
4286
|
-
const step = (method, value) => runWithAutoTraceRootContext(context, () => source[method](value));
|
|
4317
|
+
function wrapAutoTraceAsyncGenerator(context, spanStack, source) {
|
|
4318
|
+
const step = (method, value) => runWithAutoTraceRootContext(context, spanStack, () => source[method](value));
|
|
4287
4319
|
const wrapped = {
|
|
4288
4320
|
next: (value) => step("next", value),
|
|
4289
4321
|
return: (value) => step("return", value),
|
|
@@ -4309,7 +4341,7 @@ function __bitfabAutoTraceActive() {
|
|
|
4309
4341
|
if (autoTraceState.activeRoots === 0) {
|
|
4310
4342
|
return false;
|
|
4311
4343
|
}
|
|
4312
|
-
return
|
|
4344
|
+
return currentAutoTraceEntries().length > 0;
|
|
4313
4345
|
}
|
|
4314
4346
|
function currentAutoTraceScope() {
|
|
4315
4347
|
initializeAutoTraceStorage();
|
|
@@ -6855,6 +6887,26 @@ var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
|
|
|
6855
6887
|
var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
|
|
6856
6888
|
var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
|
|
6857
6889
|
var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
|
|
6890
|
+
function spanOwnerName(receiver) {
|
|
6891
|
+
if (typeof receiver === "function") {
|
|
6892
|
+
return receiver.name !== "" ? receiver.name : void 0;
|
|
6893
|
+
}
|
|
6894
|
+
if (typeof receiver !== "object" || receiver === null) {
|
|
6895
|
+
return void 0;
|
|
6896
|
+
}
|
|
6897
|
+
const owner = receiver.constructor;
|
|
6898
|
+
if (typeof owner !== "function" || owner === Object || owner.name === "") {
|
|
6899
|
+
return void 0;
|
|
6900
|
+
}
|
|
6901
|
+
return owner.name;
|
|
6902
|
+
}
|
|
6903
|
+
function qualifiedSpanName(receiver, functionName) {
|
|
6904
|
+
if (functionName === void 0) {
|
|
6905
|
+
return void 0;
|
|
6906
|
+
}
|
|
6907
|
+
const owner = spanOwnerName(receiver);
|
|
6908
|
+
return owner === void 0 ? functionName : `${owner}.${functionName}`;
|
|
6909
|
+
}
|
|
6858
6910
|
function autoTraceLimit(value, fallback) {
|
|
6859
6911
|
return value !== void 0 && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;
|
|
6860
6912
|
}
|
|
@@ -7057,16 +7109,21 @@ var Bitfab = class {
|
|
|
7057
7109
|
);
|
|
7058
7110
|
const excluded = new Set(options.exclude ?? []);
|
|
7059
7111
|
const includeWrappers = options.includeWrappers ?? false;
|
|
7112
|
+
const rootNameFor = (receiver) => options.name ?? (fn.name !== "" ? qualifiedSpanName(receiver, name) ?? name : name);
|
|
7060
7113
|
const rootOptions = {
|
|
7061
|
-
name: options.name
|
|
7114
|
+
name: options.name,
|
|
7115
|
+
nameFor: rootNameFor,
|
|
7062
7116
|
type: options.type ?? "custom",
|
|
7063
7117
|
surface: "opt-out"
|
|
7064
7118
|
};
|
|
7065
|
-
const
|
|
7119
|
+
const buildTracedRoot = (spanOptions) => this.withSpan(
|
|
7066
7120
|
traceFunctionKey,
|
|
7067
|
-
|
|
7121
|
+
spanOptions,
|
|
7068
7122
|
function(...args) {
|
|
7069
|
-
const capturePolicy = getAutoTraceCapturePolicy(
|
|
7123
|
+
const capturePolicy = getAutoTraceCapturePolicy(
|
|
7124
|
+
self,
|
|
7125
|
+
traceFunctionKey
|
|
7126
|
+
);
|
|
7070
7127
|
self.refreshAutoTraceCapturePolicy(traceFunctionKey);
|
|
7071
7128
|
let spansUsed = 0;
|
|
7072
7129
|
let truncated = false;
|
|
@@ -7087,19 +7144,54 @@ var Bitfab = class {
|
|
|
7087
7144
|
`"${traceFunctionKey}" hit an automatic subtree capture limit (maxDepth=${maxDepth}, maxSpans=${maxSpans}); its trace is incomplete. Raise the limits or narrow the subtree with exclude.`
|
|
7088
7145
|
);
|
|
7089
7146
|
};
|
|
7147
|
+
const spanStackOf = (entry) => entry.spanStack;
|
|
7148
|
+
const openChild = (entry, childOptions, inputs, isAsync, invokeFn) => {
|
|
7149
|
+
const runInside = () => runWithAutoTraceEntry(
|
|
7150
|
+
entry,
|
|
7151
|
+
{
|
|
7152
|
+
context: autoTraceContext,
|
|
7153
|
+
depth: entry.depth + 1,
|
|
7154
|
+
spanStack: getSpanStack()
|
|
7155
|
+
},
|
|
7156
|
+
invokeFn
|
|
7157
|
+
);
|
|
7158
|
+
return runWithSpanStack(spanStackOf(entry), () => {
|
|
7159
|
+
if (isAsync) {
|
|
7160
|
+
const tracedAsyncChild = self.withSpan(
|
|
7161
|
+
traceFunctionKey,
|
|
7162
|
+
childOptions,
|
|
7163
|
+
async (..._inputs) => await runInside()
|
|
7164
|
+
);
|
|
7165
|
+
return tracedAsyncChild(...inputs);
|
|
7166
|
+
}
|
|
7167
|
+
const tracedChild = self.withSpan(
|
|
7168
|
+
traceFunctionKey,
|
|
7169
|
+
childOptions,
|
|
7170
|
+
(..._inputs) => runInside()
|
|
7171
|
+
);
|
|
7172
|
+
return tracedChild(...inputs);
|
|
7173
|
+
});
|
|
7174
|
+
};
|
|
7175
|
+
const overBudget = (entry) => {
|
|
7176
|
+
if (entry.depth < maxDepth && spansUsed < maxSpans) {
|
|
7177
|
+
return false;
|
|
7178
|
+
}
|
|
7179
|
+
runWithSpanStack(spanStackOf(entry), warnTruncated);
|
|
7180
|
+
return true;
|
|
7181
|
+
};
|
|
7090
7182
|
const autoTraceContext = {
|
|
7091
|
-
|
|
7183
|
+
traceFunctionKey,
|
|
7184
|
+
invoke(definition, inputs, invokeFn, entry, nodeConfiguration) {
|
|
7092
7185
|
const nameParts = definition.name.split(".");
|
|
7093
7186
|
const simpleName = nameParts[nameParts.length - 1];
|
|
7094
|
-
const invokeWithoutNode = () => nodeConfiguration === void 0 ? invokeFn() :
|
|
7187
|
+
const invokeWithoutNode = () => nodeConfiguration === void 0 ? invokeFn() : clearAutoTraceNodeConfiguration(invokeFn);
|
|
7095
7188
|
if (excluded.has(definition.name) || simpleName !== void 0 && excluded.has(simpleName) || nodeConfiguration === void 0 && definition.wrapper === true && !includeWrappers) {
|
|
7096
7189
|
return invokeWithoutNode();
|
|
7097
7190
|
}
|
|
7098
7191
|
if (nodeConfiguration?.capture === false) {
|
|
7099
|
-
return
|
|
7192
|
+
return clearAutoTraceNodeConfiguration(invokeFn);
|
|
7100
7193
|
}
|
|
7101
|
-
if (
|
|
7102
|
-
warnTruncated();
|
|
7194
|
+
if (overBudget(entry)) {
|
|
7103
7195
|
return invokeWithoutNode();
|
|
7104
7196
|
}
|
|
7105
7197
|
spansUsed += 1;
|
|
@@ -7122,34 +7214,82 @@ var Bitfab = class {
|
|
|
7122
7214
|
finalize: nodeConfiguration.finalize
|
|
7123
7215
|
}
|
|
7124
7216
|
};
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
const tracedAsyncChild = self.withSpan(
|
|
7128
|
-
traceFunctionKey,
|
|
7129
|
-
childOptions,
|
|
7130
|
-
async (..._inputs) => await invokeWithAutoTraceContext()
|
|
7131
|
-
);
|
|
7132
|
-
return tracedAsyncChild(...inputs);
|
|
7133
|
-
}
|
|
7134
|
-
const tracedChild = self.withSpan(
|
|
7135
|
-
traceFunctionKey,
|
|
7217
|
+
return openChild(
|
|
7218
|
+
entry,
|
|
7136
7219
|
childOptions,
|
|
7137
|
-
|
|
7220
|
+
inputs,
|
|
7221
|
+
definition.async === true,
|
|
7222
|
+
invokeFn
|
|
7138
7223
|
);
|
|
7139
|
-
|
|
7224
|
+
},
|
|
7225
|
+
invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link) {
|
|
7226
|
+
if (excluded.has(nestedName) || excluded.has(nestedFunctionName) || overBudget(entry)) {
|
|
7227
|
+
return invokeFn();
|
|
7228
|
+
}
|
|
7229
|
+
spansUsed += 1;
|
|
7230
|
+
const childOptions = {
|
|
7231
|
+
name: nestedName,
|
|
7232
|
+
type: "function",
|
|
7233
|
+
captureWhen: "nested",
|
|
7234
|
+
surface: "opt-out",
|
|
7235
|
+
captureContent: true,
|
|
7236
|
+
...link !== void 0 && { nestedTrace: link }
|
|
7237
|
+
};
|
|
7238
|
+
return openChild(entry, childOptions, inputs, false, invokeFn);
|
|
7140
7239
|
}
|
|
7141
7240
|
};
|
|
7142
7241
|
return runWithAutoTraceRootContext(
|
|
7143
7242
|
autoTraceContext,
|
|
7243
|
+
getSpanStack(),
|
|
7144
7244
|
() => fn.apply(this, args)
|
|
7145
7245
|
);
|
|
7146
7246
|
}
|
|
7147
7247
|
);
|
|
7248
|
+
const tracedRoot = buildTracedRoot(rootOptions);
|
|
7148
7249
|
const autoTraceRoot = function(...args) {
|
|
7149
7250
|
if (!self.shouldRecord()) {
|
|
7150
7251
|
return fn.apply(this, args);
|
|
7151
7252
|
}
|
|
7152
|
-
|
|
7253
|
+
const enclosing = currentAutoTraceEntries();
|
|
7254
|
+
if (enclosing.length === 0) {
|
|
7255
|
+
return tracedRoot.apply(this, args);
|
|
7256
|
+
}
|
|
7257
|
+
const link = getReplayContext() || inSeedScope() ? void 0 : { traceFunctionKey };
|
|
7258
|
+
const rootName = rootNameFor(this);
|
|
7259
|
+
return invokeThroughAutoTraceEntries(
|
|
7260
|
+
enclosing,
|
|
7261
|
+
(entry, next) => entry.context.invokeNestedRoot(
|
|
7262
|
+
rootName,
|
|
7263
|
+
name,
|
|
7264
|
+
args,
|
|
7265
|
+
next,
|
|
7266
|
+
entry,
|
|
7267
|
+
link
|
|
7268
|
+
),
|
|
7269
|
+
() => {
|
|
7270
|
+
if (link === void 0) {
|
|
7271
|
+
return fn.apply(this, args);
|
|
7272
|
+
}
|
|
7273
|
+
const innermost = enclosing[enclosing.length - 1];
|
|
7274
|
+
const innermostNow = currentAutoTraceEntries().find(
|
|
7275
|
+
(entry) => entry.context === innermost.context
|
|
7276
|
+
) ?? innermost;
|
|
7277
|
+
const innermostStack = innermostNow.spanStack;
|
|
7278
|
+
const copy = innermostStack[innermostStack.length - 1];
|
|
7279
|
+
const detachedRoot = buildTracedRoot({
|
|
7280
|
+
...rootOptions,
|
|
7281
|
+
...copy !== void 0 && {
|
|
7282
|
+
enclosingTrace: {
|
|
7283
|
+
traceId: copy.traceId,
|
|
7284
|
+
spanId: copy.spanId,
|
|
7285
|
+
traceFunctionKey: innermost.context.traceFunctionKey,
|
|
7286
|
+
link
|
|
7287
|
+
}
|
|
7288
|
+
}
|
|
7289
|
+
});
|
|
7290
|
+
return runWithSpanStack([], () => detachedRoot.apply(this, args));
|
|
7291
|
+
}
|
|
7292
|
+
);
|
|
7153
7293
|
};
|
|
7154
7294
|
Object.defineProperty(autoTraceRoot, "_bitfabTraceFunctionKey", {
|
|
7155
7295
|
value: traceFunctionKey
|
|
@@ -7738,6 +7878,10 @@ var Bitfab = class {
|
|
|
7738
7878
|
const spanId = randomUuid();
|
|
7739
7879
|
const parentSpanId = parentContext?.spanId ?? null;
|
|
7740
7880
|
const isRootSpan = parentSpanId === null;
|
|
7881
|
+
if (options.enclosingTrace !== void 0) {
|
|
7882
|
+
options.enclosingTrace.link.traceId = traceId;
|
|
7883
|
+
options.enclosingTrace.link.rootSpanId = spanId;
|
|
7884
|
+
}
|
|
7741
7885
|
const requestedSurface = options.surface ?? DEFAULT_SURFACE;
|
|
7742
7886
|
const surface = resolveSurface(requestedSurface, parentContext?.surface);
|
|
7743
7887
|
assertSurfacesCompatible(
|
|
@@ -7778,7 +7922,7 @@ var Bitfab = class {
|
|
|
7778
7922
|
const baseSpanParams = {
|
|
7779
7923
|
traceFunctionKey,
|
|
7780
7924
|
functionName,
|
|
7781
|
-
spanName: options.name ?? functionName ?? traceFunctionKey,
|
|
7925
|
+
spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionName) ?? traceFunctionKey,
|
|
7782
7926
|
traceId,
|
|
7783
7927
|
spanId,
|
|
7784
7928
|
parentSpanId,
|
|
@@ -7787,7 +7931,9 @@ var Bitfab = class {
|
|
|
7787
7931
|
spanType: options.type ?? "custom",
|
|
7788
7932
|
functionId: options.functionId,
|
|
7789
7933
|
captureContent: options.captureContent ?? true,
|
|
7790
|
-
autoTraceDefinition: options.autoTraceDefinition
|
|
7934
|
+
autoTraceDefinition: options.autoTraceDefinition,
|
|
7935
|
+
nestedTrace: options.nestedTrace,
|
|
7936
|
+
enclosingTrace: options.enclosingTrace
|
|
7791
7937
|
};
|
|
7792
7938
|
const sendSpan = async (params) => {
|
|
7793
7939
|
const replayCtx = getReplayContext();
|
|
@@ -8297,6 +8443,16 @@ var Bitfab = class {
|
|
|
8297
8443
|
function_line: params.autoTraceDefinition.line,
|
|
8298
8444
|
function_column: params.autoTraceDefinition.column
|
|
8299
8445
|
},
|
|
8446
|
+
...params.nestedTrace?.traceId !== void 0 && {
|
|
8447
|
+
nested_trace_id: params.nestedTrace.traceId,
|
|
8448
|
+
nested_trace_function_key: params.nestedTrace.traceFunctionKey,
|
|
8449
|
+
nested_root_span_id: params.nestedTrace.rootSpanId
|
|
8450
|
+
},
|
|
8451
|
+
...params.enclosingTrace !== void 0 && {
|
|
8452
|
+
enclosing_trace_id: params.enclosingTrace.traceId,
|
|
8453
|
+
enclosing_trace_function_key: params.enclosingTrace.traceFunctionKey,
|
|
8454
|
+
enclosing_span_id: params.enclosingTrace.spanId
|
|
8455
|
+
},
|
|
8300
8456
|
...serializedInputs !== void 0 && {
|
|
8301
8457
|
input: serializedInputs.json,
|
|
8302
8458
|
...serializedInputs.meta !== void 0 && {
|