bitfab 0.57.8 → 0.58.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/{chunk-CPVOJHEH.js → chunk-3GFX56CU.js} +2 -2
- package/dist/{chunk-SSEXCJHP.js → chunk-BU5DXLSB.js} +3 -3
- package/dist/{chunk-HKRCT4OE.js → chunk-D6WGJZWM.js} +22 -17
- package/dist/chunk-D6WGJZWM.js.map +1 -0
- package/dist/{chunk-2E7Q52KB.js → chunk-RLBJUZDC.js} +21 -113
- package/dist/chunk-RLBJUZDC.js.map +1 -0
- package/dist/{chunk-GUE4W5QV.js → chunk-SKOFROXF.js} +4 -13
- package/dist/chunk-SKOFROXF.js.map +1 -0
- package/dist/{http-2EGLRQUQ.js → http-M46BKIVV.js} +2 -2
- package/dist/{http-PDTDCLCH.js → http-QLUKFCM5.js} +2 -2
- package/dist/index.cjs +35 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +3 -3
- package/dist/node.cjs +35 -120
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-BWUZ2NDQ.js → replay-BUVA7EM5.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-2E7Q52KB.js.map +0 -1
- package/dist/chunk-GUE4W5QV.js.map +0 -1
- package/dist/chunk-HKRCT4OE.js.map +0 -1
- /package/dist/{chunk-CPVOJHEH.js.map → chunk-3GFX56CU.js.map} +0 -0
- /package/dist/{chunk-SSEXCJHP.js.map → chunk-BU5DXLSB.js.map} +0 -0
- /package/dist/{http-2EGLRQUQ.js.map → http-M46BKIVV.js.map} +0 -0
- /package/dist/{http-PDTDCLCH.js.map → http-QLUKFCM5.js.map} +0 -0
- /package/dist/{replay-BWUZ2NDQ.js.map → replay-BUVA7EM5.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -441,7 +441,6 @@ declare class HttpClient {
|
|
|
441
441
|
private closed;
|
|
442
442
|
private closing;
|
|
443
443
|
externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit, drop: () => void) => void) | undefined;
|
|
444
|
-
frameworkSpanStart: ((traceId: string, spanId: string, parentSpanId: string | null) => void) | undefined;
|
|
445
444
|
externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
446
445
|
releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
|
|
447
446
|
stopSimulationPlan: (() => void) | undefined;
|
|
@@ -571,7 +570,6 @@ declare class HttpClient {
|
|
|
571
570
|
* the OTLP carrier has no path to carry it.
|
|
572
571
|
*/
|
|
573
572
|
sendInternalTrace(functionId: string, payload: Record<string, unknown>): void;
|
|
574
|
-
reserveFrameworkSpan(traceId: string, spanId: string, parentSpanId: string | null | undefined): void;
|
|
575
573
|
sendExternalSpan(payload: Record<string, unknown>): void;
|
|
576
574
|
submitExternalSpan(payload: Record<string, unknown>): void;
|
|
577
575
|
/**
|
|
@@ -2887,7 +2885,6 @@ interface TraceOptions {
|
|
|
2887
2885
|
mockOnReplayDefault?: boolean;
|
|
2888
2886
|
/** Maximum number of recorded descendant levels. Defaults to 30. */
|
|
2889
2887
|
maxDepth?: number;
|
|
2890
|
-
maxSpans?: number;
|
|
2891
2888
|
maxCapturedSubtreeSpans?: number;
|
|
2892
2889
|
/** Qualified or simple function names to leave out of the subtree. */
|
|
2893
2890
|
exclude?: readonly string[] | ReadonlySet<string>;
|
|
@@ -3625,7 +3622,7 @@ interface CommitRef {
|
|
|
3625
3622
|
/**
|
|
3626
3623
|
* SDK version from package.json (injected at build time)
|
|
3627
3624
|
*/
|
|
3628
|
-
declare const __version__ = "0.
|
|
3625
|
+
declare const __version__ = "0.58.0";
|
|
3629
3626
|
|
|
3630
3627
|
/**
|
|
3631
3628
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -441,7 +441,6 @@ declare class HttpClient {
|
|
|
441
441
|
private closed;
|
|
442
442
|
private closing;
|
|
443
443
|
externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit, drop: () => void) => void) | undefined;
|
|
444
|
-
frameworkSpanStart: ((traceId: string, spanId: string, parentSpanId: string | null) => void) | undefined;
|
|
445
444
|
externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
446
445
|
releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
|
|
447
446
|
stopSimulationPlan: (() => void) | undefined;
|
|
@@ -571,7 +570,6 @@ declare class HttpClient {
|
|
|
571
570
|
* the OTLP carrier has no path to carry it.
|
|
572
571
|
*/
|
|
573
572
|
sendInternalTrace(functionId: string, payload: Record<string, unknown>): void;
|
|
574
|
-
reserveFrameworkSpan(traceId: string, spanId: string, parentSpanId: string | null | undefined): void;
|
|
575
573
|
sendExternalSpan(payload: Record<string, unknown>): void;
|
|
576
574
|
submitExternalSpan(payload: Record<string, unknown>): void;
|
|
577
575
|
/**
|
|
@@ -2887,7 +2885,6 @@ interface TraceOptions {
|
|
|
2887
2885
|
mockOnReplayDefault?: boolean;
|
|
2888
2886
|
/** Maximum number of recorded descendant levels. Defaults to 30. */
|
|
2889
2887
|
maxDepth?: number;
|
|
2890
|
-
maxSpans?: number;
|
|
2891
2888
|
maxCapturedSubtreeSpans?: number;
|
|
2892
2889
|
/** Qualified or simple function names to leave out of the subtree. */
|
|
2893
2890
|
exclude?: readonly string[] | ReadonlySet<string>;
|
|
@@ -3625,7 +3622,7 @@ interface CommitRef {
|
|
|
3625
3622
|
/**
|
|
3626
3623
|
* SDK version from package.json (injected at build time)
|
|
3627
3624
|
*/
|
|
3628
|
-
declare const __version__ = "0.
|
|
3625
|
+
declare const __version__ = "0.58.0";
|
|
3629
3626
|
|
|
3630
3627
|
/**
|
|
3631
3628
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
getCurrentTrace,
|
|
31
31
|
reseedFromRegistry,
|
|
32
32
|
seedFromRegistry
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-RLBJUZDC.js";
|
|
34
34
|
import "./chunk-RCHSYWKI.js";
|
|
35
35
|
import {
|
|
36
36
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
ReplayError,
|
|
40
40
|
reportReplayProgress,
|
|
41
41
|
serializeReplayResult
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-3GFX56CU.js";
|
|
43
43
|
import {
|
|
44
44
|
BitfabError,
|
|
45
45
|
DEFAULT_SERVICE_URL,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
MixedTracingError,
|
|
48
48
|
__version__,
|
|
49
49
|
flushTraces
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-D6WGJZWM.js";
|
|
51
51
|
import "./chunk-VCRFFCLY.js";
|
|
52
52
|
export {
|
|
53
53
|
AssertionCategoriesClient,
|
package/dist/node.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var __version__, __packageName__;
|
|
|
97
97
|
var init_version_generated = __esm({
|
|
98
98
|
"src/version.generated.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
__version__ = "0.
|
|
100
|
+
__version__ = "0.58.0";
|
|
101
101
|
__packageName__ = "bitfab";
|
|
102
102
|
}
|
|
103
103
|
});
|
|
@@ -1055,7 +1055,14 @@ function isTraceRootSpan(payload) {
|
|
|
1055
1055
|
const parentId = rawSpanOf(payload)?.parent_id;
|
|
1056
1056
|
return parentId === void 0 || parentId === null;
|
|
1057
1057
|
}
|
|
1058
|
-
|
|
1058
|
+
function declaredInCode(payload) {
|
|
1059
|
+
return payload[DECLARED_NODE_FIELD] === true;
|
|
1060
|
+
}
|
|
1061
|
+
function recordedError(payload) {
|
|
1062
|
+
const error = spanDataOf(payload)?.error;
|
|
1063
|
+
return error !== void 0 && error !== null;
|
|
1064
|
+
}
|
|
1065
|
+
var SIMULATION_PLAN_REFRESH_MS, SIMULATION_PLAN_RETRY_MS, SIMULATION_PLAN_READ_TIMEOUT_MS, SIMULATION_PLAN_MAX_HELD, DISABLE_SIMULATION_PLAN_ENV, ROOT_TRACE_FUNCTION_KEY_FIELD, DECLARED_NODE_FIELD, CONTENT_OFF_KEY, CONTENT_KEYS, SimulationPlan;
|
|
1059
1066
|
var init_simulationPlan = __esm({
|
|
1060
1067
|
"src/simulationPlan.ts"() {
|
|
1061
1068
|
"use strict";
|
|
@@ -1070,6 +1077,7 @@ var init_simulationPlan = __esm({
|
|
|
1070
1077
|
SIMULATION_PLAN_MAX_HELD = 1e3;
|
|
1071
1078
|
DISABLE_SIMULATION_PLAN_ENV = "BITFAB_DISABLE_SIM_PLAN";
|
|
1072
1079
|
ROOT_TRACE_FUNCTION_KEY_FIELD = "rootTraceFunctionKey";
|
|
1080
|
+
DECLARED_NODE_FIELD = "declaredNode";
|
|
1073
1081
|
CONTENT_OFF_KEY = "content_off_by_simulation_plan";
|
|
1074
1082
|
CONTENT_KEYS = [
|
|
1075
1083
|
"input",
|
|
@@ -1241,7 +1249,7 @@ var init_simulationPlan = __esm({
|
|
|
1241
1249
|
}
|
|
1242
1250
|
}
|
|
1243
1251
|
payloadToSend(entry) {
|
|
1244
|
-
if (entry.traceFunctionKey === void 0) {
|
|
1252
|
+
if (entry.traceFunctionKey === void 0 || declaredInCode(entry.payload)) {
|
|
1245
1253
|
return entry.payload;
|
|
1246
1254
|
}
|
|
1247
1255
|
if (this.contentOffByKey !== void 0) {
|
|
@@ -1253,6 +1261,10 @@ var init_simulationPlan = __esm({
|
|
|
1253
1261
|
return stripContent(entry.payload);
|
|
1254
1262
|
}
|
|
1255
1263
|
submitEntry(entry) {
|
|
1264
|
+
if (entry.traceFunctionKey !== void 0 && this.skipsSpan(entry.payload, entry.traceFunctionKey)) {
|
|
1265
|
+
entry.drop?.();
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1256
1268
|
try {
|
|
1257
1269
|
entry.submit(this.payloadToSend(entry));
|
|
1258
1270
|
} catch (error) {
|
|
@@ -1315,8 +1327,12 @@ var init_simulationPlan = __esm({
|
|
|
1315
1327
|
contentOffNow(traceFunctionKey, spanName) {
|
|
1316
1328
|
return !this.stopped && !this.disabled() && this.contentOff(traceFunctionKey, spanName);
|
|
1317
1329
|
}
|
|
1330
|
+
skipsSpan(payload, traceFunctionKey) {
|
|
1331
|
+
const name = spanNameOf(payload);
|
|
1332
|
+
return name !== void 0 && this.contentOff(traceFunctionKey, name) && !isTraceRootSpan(payload) && !declaredInCode(payload) && spanInstrumentationOf(payload) !== void 0 && !recordedByFramework(payload) && !recordedError(payload);
|
|
1333
|
+
}
|
|
1318
1334
|
apply(payload, traceFunctionKey) {
|
|
1319
|
-
if (recordedByFramework(payload)) {
|
|
1335
|
+
if (recordedByFramework(payload) || declaredInCode(payload)) {
|
|
1320
1336
|
return payload;
|
|
1321
1337
|
}
|
|
1322
1338
|
const name = spanNameOf(payload);
|
|
@@ -2595,7 +2611,6 @@ var init_http = __esm({
|
|
|
2595
2611
|
this.closed = true;
|
|
2596
2612
|
this.externalSpanTransform = void 0;
|
|
2597
2613
|
this.externalTraceTransform = void 0;
|
|
2598
|
-
this.frameworkSpanStart = void 0;
|
|
2599
2614
|
this.releaseHeldExternalSpans = void 0;
|
|
2600
2615
|
this.stopSimulationPlan = void 0;
|
|
2601
2616
|
const transport = this.traceTransport;
|
|
@@ -2778,16 +2793,6 @@ var init_http = __esm({
|
|
|
2778
2793
|
carrierMeta("internal_trace", body, void 0)
|
|
2779
2794
|
);
|
|
2780
2795
|
}
|
|
2781
|
-
reserveFrameworkSpan(traceId, spanId, parentSpanId) {
|
|
2782
|
-
try {
|
|
2783
|
-
this.frameworkSpanStart?.(traceId, spanId, parentSpanId ?? null);
|
|
2784
|
-
} catch (error) {
|
|
2785
|
-
warnOnce(
|
|
2786
|
-
"framework-span-reservation-failed",
|
|
2787
|
-
`a framework span could not be counted toward its trace's span limit: ${describeError(error)}`
|
|
2788
|
-
);
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
2796
|
sendExternalSpan(payload) {
|
|
2792
2797
|
const ref2 = carrierRef(payload);
|
|
2793
2798
|
if (ref2?.spanId !== void 0) {
|
|
@@ -2816,6 +2821,7 @@ var init_http = __esm({
|
|
|
2816
2821
|
sdkVersion: __version__
|
|
2817
2822
|
};
|
|
2818
2823
|
delete body[ROOT_TRACE_FUNCTION_KEY_FIELD];
|
|
2824
|
+
delete body[DECLARED_NODE_FIELD];
|
|
2819
2825
|
this.getTraceTransport()?.submit(
|
|
2820
2826
|
"external_span",
|
|
2821
2827
|
body,
|
|
@@ -4699,11 +4705,6 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4699
4705
|
}
|
|
4700
4706
|
this.runToSpan.set(spanId, spanInfo);
|
|
4701
4707
|
this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
|
|
4702
|
-
this.httpClient.reserveFrameworkSpan(
|
|
4703
|
-
spanInfo.traceId,
|
|
4704
|
-
spanInfo.spanId,
|
|
4705
|
-
spanInfo.parentId
|
|
4706
|
-
);
|
|
4707
4708
|
return spanInfo;
|
|
4708
4709
|
}
|
|
4709
4710
|
completeSpan(spanId, output, error, extraContexts) {
|
|
@@ -4983,11 +4984,6 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4983
4984
|
this.conversationHistory.push(...this.pendingMessages);
|
|
4984
4985
|
this.pendingMessages = [];
|
|
4985
4986
|
this.currentLlmSpanId = randomUuid();
|
|
4986
|
-
this.httpClient.reserveFrameworkSpan(
|
|
4987
|
-
this.ensureTrace(),
|
|
4988
|
-
this.currentLlmSpanId,
|
|
4989
|
-
this.getParentId()
|
|
4990
|
-
);
|
|
4991
4987
|
this.currentLlmMessageId = messageId ?? null;
|
|
4992
4988
|
this.currentLlmContent = [];
|
|
4993
4989
|
this.currentLlmModel = inner.model ?? null;
|
|
@@ -6398,11 +6394,6 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
6398
6394
|
this.runToSpan.set(runId, spanInfo);
|
|
6399
6395
|
if (spanInfo.hidden !== true) {
|
|
6400
6396
|
this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
|
|
6401
|
-
this.httpClient.reserveFrameworkSpan(
|
|
6402
|
-
spanInfo.traceId,
|
|
6403
|
-
spanInfo.spanId,
|
|
6404
|
-
spanInfo.parentId
|
|
6405
|
-
);
|
|
6406
6397
|
}
|
|
6407
6398
|
if (isRootInvocation) {
|
|
6408
6399
|
this.sendTraceStart(spanInfo);
|
|
@@ -7951,11 +7942,6 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
7951
7942
|
const mapping = this.activeSpanMappings[span.traceId];
|
|
7952
7943
|
const traceId = mapping?.traceId ?? span.traceId;
|
|
7953
7944
|
this.httpClient.traceCompletion.start(traceId, span.spanId);
|
|
7954
|
-
this.httpClient.reserveFrameworkSpan(
|
|
7955
|
-
traceId,
|
|
7956
|
-
span.spanId,
|
|
7957
|
-
span.parentId ?? mapping?.spanId
|
|
7958
|
-
);
|
|
7959
7945
|
}
|
|
7960
7946
|
}
|
|
7961
7947
|
/**
|
|
@@ -8344,56 +8330,9 @@ var BitfabVercelAiHandler = class {
|
|
|
8344
8330
|
init_warnOnce();
|
|
8345
8331
|
var TRUNCATION_LIMIT_ORDER = [
|
|
8346
8332
|
"max_depth",
|
|
8347
|
-
"max_spans",
|
|
8348
8333
|
"max_captured_subtree_spans"
|
|
8349
8334
|
];
|
|
8350
8335
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
8351
|
-
var REFUSED_FRAMEWORK_SPAN_TRACES_RETAINED = 1024;
|
|
8352
|
-
var refusedFrameworkSpans = /* @__PURE__ */ new Map();
|
|
8353
|
-
function frameworkSpanRefused(traceId, spanId) {
|
|
8354
|
-
return refusedFrameworkSpans.get(traceId)?.has(spanId) === true;
|
|
8355
|
-
}
|
|
8356
|
-
function refuseFrameworkSpan(traceId, spanId) {
|
|
8357
|
-
const refused = refusedFrameworkSpans.get(traceId);
|
|
8358
|
-
if (refused !== void 0) {
|
|
8359
|
-
refused.add(spanId);
|
|
8360
|
-
return;
|
|
8361
|
-
}
|
|
8362
|
-
refusedFrameworkSpans.set(traceId, /* @__PURE__ */ new Set([spanId]));
|
|
8363
|
-
while (refusedFrameworkSpans.size > REFUSED_FRAMEWORK_SPAN_TRACES_RETAINED) {
|
|
8364
|
-
const oldest = refusedFrameworkSpans.keys().next();
|
|
8365
|
-
if (oldest.done) {
|
|
8366
|
-
return;
|
|
8367
|
-
}
|
|
8368
|
-
refusedFrameworkSpans.delete(oldest.value);
|
|
8369
|
-
}
|
|
8370
|
-
}
|
|
8371
|
-
function reserveFrameworkSpan(traceId, spanId, parentSpanId) {
|
|
8372
|
-
const spanBudget = activeTraceStates.get(traceId)?.spanBudget;
|
|
8373
|
-
const parentRefused = parentSpanId !== null && frameworkSpanRefused(traceId, parentSpanId);
|
|
8374
|
-
if (!parentRefused && (spanBudget === void 0 || spanBudget.spansUsed < spanBudget.maxSpans)) {
|
|
8375
|
-
if (spanBudget !== void 0) {
|
|
8376
|
-
spanBudget.spansUsed += 1;
|
|
8377
|
-
}
|
|
8378
|
-
return;
|
|
8379
|
-
}
|
|
8380
|
-
refuseFrameworkSpan(traceId, spanId);
|
|
8381
|
-
spanBudget?.truncate("max_spans");
|
|
8382
|
-
}
|
|
8383
|
-
function isRefusedFrameworkSpan(payload) {
|
|
8384
|
-
if (!recordedByFramework(payload)) {
|
|
8385
|
-
return false;
|
|
8386
|
-
}
|
|
8387
|
-
const rawSpan = payload.rawSpan;
|
|
8388
|
-
const spanId = rawSpan?.id;
|
|
8389
|
-
if (typeof spanId !== "string") {
|
|
8390
|
-
return false;
|
|
8391
|
-
}
|
|
8392
|
-
const traceIds = [payload.sourceTraceId, traceIdOf(payload)];
|
|
8393
|
-
return traceIds.some(
|
|
8394
|
-
(traceId) => typeof traceId === "string" && frameworkSpanRefused(traceId, spanId)
|
|
8395
|
-
);
|
|
8396
|
-
}
|
|
8397
8336
|
function truncationMetadata(truncation) {
|
|
8398
8337
|
if (truncation === void 0 || truncation.limits.size === 0) {
|
|
8399
8338
|
return void 0;
|
|
@@ -8783,7 +8722,6 @@ function readBooleanEnv(name) {
|
|
|
8783
8722
|
return void 0;
|
|
8784
8723
|
}
|
|
8785
8724
|
var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
|
|
8786
|
-
var DEFAULT_AUTO_TRACE_MAX_SPANS = 1e4;
|
|
8787
8725
|
var DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS = 500;
|
|
8788
8726
|
function spanOwnerName(receiver) {
|
|
8789
8727
|
if (typeof receiver === "function") {
|
|
@@ -8851,7 +8789,6 @@ var Bitfab = class {
|
|
|
8851
8789
|
config.simulationPlan ?? true
|
|
8852
8790
|
);
|
|
8853
8791
|
this.httpClient.externalSpanTransform = (payload, submit, drop) => this.applySimulationPlan(payload, submit, drop);
|
|
8854
|
-
this.httpClient.frameworkSpanStart = reserveFrameworkSpan;
|
|
8855
8792
|
this.httpClient.externalTraceTransform = (payload, submit) => this.simulationPlan.sendTrace(payload, submit);
|
|
8856
8793
|
this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
|
|
8857
8794
|
this.httpClient.stopSimulationPlan = () => this.simulationPlan.stop();
|
|
@@ -9014,21 +8951,9 @@ var Bitfab = class {
|
|
|
9014
8951
|
options.maxDepth,
|
|
9015
8952
|
DEFAULT_AUTO_TRACE_MAX_DEPTH
|
|
9016
8953
|
);
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
);
|
|
9021
|
-
}
|
|
9022
|
-
const maxSpans = autoTraceLimit(
|
|
9023
|
-
options.maxSpans,
|
|
9024
|
-
DEFAULT_AUTO_TRACE_MAX_SPANS
|
|
9025
|
-
);
|
|
9026
|
-
const maxCapturedSubtreeSpans = Math.min(
|
|
9027
|
-
autoTraceLimit(
|
|
9028
|
-
options.maxCapturedSubtreeSpans,
|
|
9029
|
-
DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS
|
|
9030
|
-
),
|
|
9031
|
-
maxSpans
|
|
8954
|
+
const maxCapturedSubtreeSpans = autoTraceLimit(
|
|
8955
|
+
options.maxCapturedSubtreeSpans,
|
|
8956
|
+
DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS
|
|
9032
8957
|
);
|
|
9033
8958
|
const rootIsAsync = fn.constructor.name === "AsyncFunction";
|
|
9034
8959
|
const excluded = new Set(options.exclude ?? []);
|
|
@@ -9059,19 +8984,11 @@ var Bitfab = class {
|
|
|
9059
8984
|
truncation.droppedSpans += 1;
|
|
9060
8985
|
warnOnce(
|
|
9061
8986
|
`auto-trace-truncated:${traceFunctionKey}`,
|
|
9062
|
-
`"${traceFunctionKey}" hit an automatic subtree capture limit (maxDepth=${maxDepth}, maxCapturedSubtreeSpans=${maxCapturedSubtreeSpans}
|
|
8987
|
+
`"${traceFunctionKey}" hit an automatic subtree capture limit (maxDepth=${maxDepth}, maxCapturedSubtreeSpans=${maxCapturedSubtreeSpans}); its trace is incomplete. Raise the limits, declare the calls you need with node(), or narrow the subtree with exclude.`
|
|
9063
8988
|
);
|
|
9064
8989
|
};
|
|
9065
|
-
const spanBudget = {
|
|
9066
|
-
spansUsed: 1,
|
|
9067
|
-
maxSpans,
|
|
9068
|
-
truncate
|
|
9069
|
-
};
|
|
9070
8990
|
if (rootTraceState !== void 0) {
|
|
9071
8991
|
rootTraceState.truncation = truncation;
|
|
9072
|
-
if (rootTraceState.spanBudget === void 0) {
|
|
9073
|
-
rootTraceState.spanBudget = spanBudget;
|
|
9074
|
-
}
|
|
9075
8992
|
}
|
|
9076
8993
|
const spanStackOf = (entry) => entry.spanStack;
|
|
9077
8994
|
const openChild = (entry, childOptions, inputs, isAsync, invokeFn) => {
|
|
@@ -9107,16 +9024,16 @@ var Bitfab = class {
|
|
|
9107
9024
|
return innermost === void 0 ? traceFunctionKey : rootTraceFunctionKeyOfTrace(innermost.traceId, traceFunctionKey);
|
|
9108
9025
|
};
|
|
9109
9026
|
const recordsSpan = (entry, spanName, declared) => {
|
|
9110
|
-
const
|
|
9027
|
+
const contentOff = !declared && self.simulationPlan.contentOffNow(
|
|
9111
9028
|
rootTraceFunctionKeyOfEntry(entry),
|
|
9112
9029
|
spanName
|
|
9113
9030
|
);
|
|
9114
|
-
const
|
|
9031
|
+
const countsTowardCapturedSubtree = !declared && !contentOff;
|
|
9032
|
+
const refusedBy = entry.depth >= maxDepth ? "max_depth" : countsTowardCapturedSubtree && capturedSubtreeCount >= maxCapturedSubtreeSpans ? "max_captured_subtree_spans" : void 0;
|
|
9115
9033
|
if (refusedBy !== void 0) {
|
|
9116
9034
|
truncate(refusedBy);
|
|
9117
9035
|
return false;
|
|
9118
9036
|
}
|
|
9119
|
-
spanBudget.spansUsed += 1;
|
|
9120
9037
|
if (countsTowardCapturedSubtree) {
|
|
9121
9038
|
capturedSubtreeCount += 1;
|
|
9122
9039
|
}
|
|
@@ -9135,7 +9052,8 @@ var Bitfab = class {
|
|
|
9135
9052
|
return clearAutoTraceNodeConfiguration(invokeFn);
|
|
9136
9053
|
}
|
|
9137
9054
|
const spanName = nodeConfiguration?.name ?? definition.name;
|
|
9138
|
-
|
|
9055
|
+
const declaredNode = nodeConfiguration !== void 0;
|
|
9056
|
+
if (!recordsSpan(entry, spanName, declaredNode)) {
|
|
9139
9057
|
return invokeWithoutNode();
|
|
9140
9058
|
}
|
|
9141
9059
|
const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
|
|
@@ -9148,6 +9066,7 @@ var Bitfab = class {
|
|
|
9148
9066
|
functionId: definition.id,
|
|
9149
9067
|
captureContent: true,
|
|
9150
9068
|
autoTraceDefinition: definition,
|
|
9069
|
+
...declaredNode && { declaredNode },
|
|
9151
9070
|
...nodeConfiguration?.testRunId !== void 0 && {
|
|
9152
9071
|
testRunId: nodeConfiguration.testRunId
|
|
9153
9072
|
},
|
|
@@ -9177,6 +9096,7 @@ var Bitfab = class {
|
|
|
9177
9096
|
surface: "opt-out",
|
|
9178
9097
|
instrumentation: "trace",
|
|
9179
9098
|
captureContent: true,
|
|
9099
|
+
declaredNode: true,
|
|
9180
9100
|
...link !== void 0 && { nestedTrace: link }
|
|
9181
9101
|
};
|
|
9182
9102
|
return openChild(entry, childOptions, inputs, false, invokeFn);
|
|
@@ -9248,10 +9168,6 @@ var Bitfab = class {
|
|
|
9248
9168
|
return autoTraceRoot;
|
|
9249
9169
|
}
|
|
9250
9170
|
applySimulationPlan(payload, submit, drop) {
|
|
9251
|
-
if (isRefusedFrameworkSpan(payload)) {
|
|
9252
|
-
drop();
|
|
9253
|
-
return;
|
|
9254
|
-
}
|
|
9255
9171
|
this.simulationPlan.send(
|
|
9256
9172
|
payload,
|
|
9257
9173
|
rootTraceFunctionKeyOf(payload),
|
|
@@ -9926,9 +9842,6 @@ var Bitfab = class {
|
|
|
9926
9842
|
registeredTraceId = traceId;
|
|
9927
9843
|
}
|
|
9928
9844
|
self.httpClient.traceCompletion.start(traceId, spanId);
|
|
9929
|
-
if (isFrameworkInstrumentation(options.instrumentation)) {
|
|
9930
|
-
reserveFrameworkSpan(traceId, spanId, parentSpanId);
|
|
9931
|
-
}
|
|
9932
9845
|
startedSpan = { traceId, spanId };
|
|
9933
9846
|
const functionName = fn.name !== "" ? fn.name : void 0;
|
|
9934
9847
|
const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
|
|
@@ -9950,6 +9863,7 @@ var Bitfab = class {
|
|
|
9950
9863
|
functionId: options.functionId,
|
|
9951
9864
|
captureContent: options.captureContent ?? true,
|
|
9952
9865
|
autoTraceDefinition: options.autoTraceDefinition,
|
|
9866
|
+
declaredNode: options.declaredNode === true,
|
|
9953
9867
|
nestedTrace: options.nestedTrace,
|
|
9954
9868
|
enclosingTrace: options.enclosingTrace
|
|
9955
9869
|
};
|
|
@@ -10475,7 +10389,7 @@ var Bitfab = class {
|
|
|
10475
10389
|
* Queued on the client's span transport; delivery is the transport's job.
|
|
10476
10390
|
*/
|
|
10477
10391
|
sendWrapperSpan(params) {
|
|
10478
|
-
const contentOff = this.contentOffBySimulationPlan(params);
|
|
10392
|
+
const contentOff = params.declaredNode !== true && this.contentOffBySimulationPlan(params);
|
|
10479
10393
|
const buildsContent = params.captureContent && !contentOff;
|
|
10480
10394
|
const serializedInputs = buildsContent ? serializeValue(params.inputs) : void 0;
|
|
10481
10395
|
const serializedResult = buildsContent ? serializeValue(params.result) : void 0;
|
|
@@ -10549,6 +10463,7 @@ var Bitfab = class {
|
|
|
10549
10463
|
...params.rootTraceFunctionKey !== void 0 && {
|
|
10550
10464
|
[ROOT_TRACE_FUNCTION_KEY_FIELD]: params.rootTraceFunctionKey
|
|
10551
10465
|
},
|
|
10466
|
+
...params.declaredNode === true && { [DECLARED_NODE_FIELD]: true },
|
|
10552
10467
|
rawSpan: externalSpan,
|
|
10553
10468
|
...params.testRunId && { testRunId: params.testRunId },
|
|
10554
10469
|
...params.mocked && { mocked: true },
|