@bitfab/sdk 0.57.8 → 0.58.1
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-O5OSC57C.js → chunk-FJRILDSJ.js} +3 -3
- package/dist/{chunk-7OU35MBA.js → chunk-HWRU7JIH.js} +21 -113
- package/dist/chunk-HWRU7JIH.js.map +1 -0
- package/dist/{chunk-PU6RWSKB.js → chunk-KTDGHM36.js} +23 -18
- package/dist/chunk-KTDGHM36.js.map +1 -0
- package/dist/{chunk-TOAH2RTF.js → chunk-SVTMTBTK.js} +5 -14
- package/dist/chunk-SVTMTBTK.js.map +1 -0
- package/dist/{chunk-SSUEN63V.js → chunk-UFN6S5N4.js} +2 -2
- package/dist/{http-7CM3YGQZ.js → http-TYON36K5.js} +2 -2
- package/dist/{http-ZYEYOCJ2.js → http-WVARIJG2.js} +2 -2
- package/dist/index.cjs +36 -121
- 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 +36 -121
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-BPMNUWI5.js → replay-WMDA3YG2.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7OU35MBA.js.map +0 -1
- package/dist/chunk-PU6RWSKB.js.map +0 -1
- package/dist/chunk-TOAH2RTF.js.map +0 -1
- /package/dist/{chunk-O5OSC57C.js.map → chunk-FJRILDSJ.js.map} +0 -0
- /package/dist/{chunk-SSUEN63V.js.map → chunk-UFN6S5N4.js.map} +0 -0
- /package/dist/{http-7CM3YGQZ.js.map → http-TYON36K5.js.map} +0 -0
- /package/dist/{http-ZYEYOCJ2.js.map → http-WVARIJG2.js.map} +0 -0
- /package/dist/{replay-BPMNUWI5.js.map → replay-WMDA3YG2.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.1";
|
|
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.1";
|
|
3629
3626
|
|
|
3630
3627
|
/**
|
|
3631
3628
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
getCurrentTrace,
|
|
22
22
|
reseedFromRegistry,
|
|
23
23
|
seedFromRegistry
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-HWRU7JIH.js";
|
|
25
25
|
import "./chunk-RCHSYWKI.js";
|
|
26
26
|
import {
|
|
27
27
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
ReplayError,
|
|
31
31
|
reportReplayProgress,
|
|
32
32
|
serializeReplayResult
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-UFN6S5N4.js";
|
|
34
34
|
import {
|
|
35
35
|
BitfabError,
|
|
36
36
|
DEFAULT_SERVICE_URL,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
MixedTracingError,
|
|
39
39
|
__version__,
|
|
40
40
|
flushTraces
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-KTDGHM36.js";
|
|
42
42
|
import "./chunk-VCRFFCLY.js";
|
|
43
43
|
export {
|
|
44
44
|
AssertionCategoriesClient,
|
package/dist/node.cjs
CHANGED
|
@@ -88,7 +88,7 @@ var __version__, __packageName__;
|
|
|
88
88
|
var init_version_generated = __esm({
|
|
89
89
|
"src/version.generated.ts"() {
|
|
90
90
|
"use strict";
|
|
91
|
-
__version__ = "0.
|
|
91
|
+
__version__ = "0.58.1";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -1046,7 +1046,14 @@ function isTraceRootSpan(payload) {
|
|
|
1046
1046
|
const parentId = rawSpanOf(payload)?.parent_id;
|
|
1047
1047
|
return parentId === void 0 || parentId === null;
|
|
1048
1048
|
}
|
|
1049
|
-
|
|
1049
|
+
function declaredInCode(payload) {
|
|
1050
|
+
return payload[DECLARED_NODE_FIELD] === true;
|
|
1051
|
+
}
|
|
1052
|
+
function recordedError(payload) {
|
|
1053
|
+
const error = spanDataOf(payload)?.error;
|
|
1054
|
+
return error !== void 0 && error !== null;
|
|
1055
|
+
}
|
|
1056
|
+
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;
|
|
1050
1057
|
var init_simulationPlan = __esm({
|
|
1051
1058
|
"src/simulationPlan.ts"() {
|
|
1052
1059
|
"use strict";
|
|
@@ -1061,6 +1068,7 @@ var init_simulationPlan = __esm({
|
|
|
1061
1068
|
SIMULATION_PLAN_MAX_HELD = 1e3;
|
|
1062
1069
|
DISABLE_SIMULATION_PLAN_ENV = "BITFAB_DISABLE_SIM_PLAN";
|
|
1063
1070
|
ROOT_TRACE_FUNCTION_KEY_FIELD = "rootTraceFunctionKey";
|
|
1071
|
+
DECLARED_NODE_FIELD = "declaredNode";
|
|
1064
1072
|
CONTENT_OFF_KEY = "content_off_by_simulation_plan";
|
|
1065
1073
|
CONTENT_KEYS = [
|
|
1066
1074
|
"input",
|
|
@@ -1232,7 +1240,7 @@ var init_simulationPlan = __esm({
|
|
|
1232
1240
|
}
|
|
1233
1241
|
}
|
|
1234
1242
|
payloadToSend(entry) {
|
|
1235
|
-
if (entry.traceFunctionKey === void 0) {
|
|
1243
|
+
if (entry.traceFunctionKey === void 0 || declaredInCode(entry.payload)) {
|
|
1236
1244
|
return entry.payload;
|
|
1237
1245
|
}
|
|
1238
1246
|
if (this.contentOffByKey !== void 0) {
|
|
@@ -1244,6 +1252,10 @@ var init_simulationPlan = __esm({
|
|
|
1244
1252
|
return stripContent(entry.payload);
|
|
1245
1253
|
}
|
|
1246
1254
|
submitEntry(entry) {
|
|
1255
|
+
if (entry.traceFunctionKey !== void 0 && this.skipsSpan(entry.payload, entry.traceFunctionKey)) {
|
|
1256
|
+
entry.drop?.();
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1247
1259
|
try {
|
|
1248
1260
|
entry.submit(this.payloadToSend(entry));
|
|
1249
1261
|
} catch (error) {
|
|
@@ -1306,8 +1318,12 @@ var init_simulationPlan = __esm({
|
|
|
1306
1318
|
contentOffNow(traceFunctionKey, spanName) {
|
|
1307
1319
|
return !this.stopped && !this.disabled() && this.contentOff(traceFunctionKey, spanName);
|
|
1308
1320
|
}
|
|
1321
|
+
skipsSpan(payload, traceFunctionKey) {
|
|
1322
|
+
const name = spanNameOf(payload);
|
|
1323
|
+
return name !== void 0 && this.contentOff(traceFunctionKey, name) && !isTraceRootSpan(payload) && !declaredInCode(payload) && spanInstrumentationOf(payload) !== void 0 && !recordedByFramework(payload) && !recordedError(payload);
|
|
1324
|
+
}
|
|
1309
1325
|
apply(payload, traceFunctionKey) {
|
|
1310
|
-
if (recordedByFramework(payload)) {
|
|
1326
|
+
if (recordedByFramework(payload) || declaredInCode(payload)) {
|
|
1311
1327
|
return payload;
|
|
1312
1328
|
}
|
|
1313
1329
|
const name = spanNameOf(payload);
|
|
@@ -1703,7 +1719,7 @@ var init_otel = __esm({
|
|
|
1703
1719
|
EXPORT_CONCURRENCY_ENV = "BITFAB_OTEL_EXPORT_CONCURRENCY";
|
|
1704
1720
|
MAX_QUEUE_SIZE = 16384;
|
|
1705
1721
|
DIRECT_MAX_EXPORT_BATCH_SIZE = 512;
|
|
1706
|
-
DIRECT_MAX_REQUEST_BATCH_SIZE =
|
|
1722
|
+
DIRECT_MAX_REQUEST_BATCH_SIZE = 256;
|
|
1707
1723
|
DEFAULT_EXPORT_CONCURRENCY = 32;
|
|
1708
1724
|
MAX_EXPORT_CONCURRENCY = 64;
|
|
1709
1725
|
SCHEDULE_DELAY_MILLIS = 5e3;
|
|
@@ -2586,7 +2602,6 @@ var init_http = __esm({
|
|
|
2586
2602
|
this.closed = true;
|
|
2587
2603
|
this.externalSpanTransform = void 0;
|
|
2588
2604
|
this.externalTraceTransform = void 0;
|
|
2589
|
-
this.frameworkSpanStart = void 0;
|
|
2590
2605
|
this.releaseHeldExternalSpans = void 0;
|
|
2591
2606
|
this.stopSimulationPlan = void 0;
|
|
2592
2607
|
const transport = this.traceTransport;
|
|
@@ -2769,16 +2784,6 @@ var init_http = __esm({
|
|
|
2769
2784
|
carrierMeta("internal_trace", body, void 0)
|
|
2770
2785
|
);
|
|
2771
2786
|
}
|
|
2772
|
-
reserveFrameworkSpan(traceId, spanId, parentSpanId) {
|
|
2773
|
-
try {
|
|
2774
|
-
this.frameworkSpanStart?.(traceId, spanId, parentSpanId ?? null);
|
|
2775
|
-
} catch (error) {
|
|
2776
|
-
warnOnce(
|
|
2777
|
-
"framework-span-reservation-failed",
|
|
2778
|
-
`a framework span could not be counted toward its trace's span limit: ${describeError(error)}`
|
|
2779
|
-
);
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
2787
|
sendExternalSpan(payload) {
|
|
2783
2788
|
const ref2 = carrierRef(payload);
|
|
2784
2789
|
if (ref2?.spanId !== void 0) {
|
|
@@ -2807,6 +2812,7 @@ var init_http = __esm({
|
|
|
2807
2812
|
sdkVersion: __version__
|
|
2808
2813
|
};
|
|
2809
2814
|
delete body[ROOT_TRACE_FUNCTION_KEY_FIELD];
|
|
2815
|
+
delete body[DECLARED_NODE_FIELD];
|
|
2810
2816
|
this.getTraceTransport()?.submit(
|
|
2811
2817
|
"external_span",
|
|
2812
2818
|
body,
|
|
@@ -4690,11 +4696,6 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4690
4696
|
}
|
|
4691
4697
|
this.runToSpan.set(spanId, spanInfo);
|
|
4692
4698
|
this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
|
|
4693
|
-
this.httpClient.reserveFrameworkSpan(
|
|
4694
|
-
spanInfo.traceId,
|
|
4695
|
-
spanInfo.spanId,
|
|
4696
|
-
spanInfo.parentId
|
|
4697
|
-
);
|
|
4698
4699
|
return spanInfo;
|
|
4699
4700
|
}
|
|
4700
4701
|
completeSpan(spanId, output, error, extraContexts) {
|
|
@@ -4974,11 +4975,6 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4974
4975
|
this.conversationHistory.push(...this.pendingMessages);
|
|
4975
4976
|
this.pendingMessages = [];
|
|
4976
4977
|
this.currentLlmSpanId = randomUuid();
|
|
4977
|
-
this.httpClient.reserveFrameworkSpan(
|
|
4978
|
-
this.ensureTrace(),
|
|
4979
|
-
this.currentLlmSpanId,
|
|
4980
|
-
this.getParentId()
|
|
4981
|
-
);
|
|
4982
4978
|
this.currentLlmMessageId = messageId ?? null;
|
|
4983
4979
|
this.currentLlmContent = [];
|
|
4984
4980
|
this.currentLlmModel = inner.model ?? null;
|
|
@@ -6389,11 +6385,6 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
6389
6385
|
this.runToSpan.set(runId, spanInfo);
|
|
6390
6386
|
if (spanInfo.hidden !== true) {
|
|
6391
6387
|
this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
|
|
6392
|
-
this.httpClient.reserveFrameworkSpan(
|
|
6393
|
-
spanInfo.traceId,
|
|
6394
|
-
spanInfo.spanId,
|
|
6395
|
-
spanInfo.parentId
|
|
6396
|
-
);
|
|
6397
6388
|
}
|
|
6398
6389
|
if (isRootInvocation) {
|
|
6399
6390
|
this.sendTraceStart(spanInfo);
|
|
@@ -7942,11 +7933,6 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
7942
7933
|
const mapping = this.activeSpanMappings[span.traceId];
|
|
7943
7934
|
const traceId = mapping?.traceId ?? span.traceId;
|
|
7944
7935
|
this.httpClient.traceCompletion.start(traceId, span.spanId);
|
|
7945
|
-
this.httpClient.reserveFrameworkSpan(
|
|
7946
|
-
traceId,
|
|
7947
|
-
span.spanId,
|
|
7948
|
-
span.parentId ?? mapping?.spanId
|
|
7949
|
-
);
|
|
7950
7936
|
}
|
|
7951
7937
|
}
|
|
7952
7938
|
/**
|
|
@@ -8335,56 +8321,9 @@ var BitfabVercelAiHandler = class {
|
|
|
8335
8321
|
init_warnOnce();
|
|
8336
8322
|
var TRUNCATION_LIMIT_ORDER = [
|
|
8337
8323
|
"max_depth",
|
|
8338
|
-
"max_spans",
|
|
8339
8324
|
"max_captured_subtree_spans"
|
|
8340
8325
|
];
|
|
8341
8326
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
8342
|
-
var REFUSED_FRAMEWORK_SPAN_TRACES_RETAINED = 1024;
|
|
8343
|
-
var refusedFrameworkSpans = /* @__PURE__ */ new Map();
|
|
8344
|
-
function frameworkSpanRefused(traceId, spanId) {
|
|
8345
|
-
return refusedFrameworkSpans.get(traceId)?.has(spanId) === true;
|
|
8346
|
-
}
|
|
8347
|
-
function refuseFrameworkSpan(traceId, spanId) {
|
|
8348
|
-
const refused = refusedFrameworkSpans.get(traceId);
|
|
8349
|
-
if (refused !== void 0) {
|
|
8350
|
-
refused.add(spanId);
|
|
8351
|
-
return;
|
|
8352
|
-
}
|
|
8353
|
-
refusedFrameworkSpans.set(traceId, /* @__PURE__ */ new Set([spanId]));
|
|
8354
|
-
while (refusedFrameworkSpans.size > REFUSED_FRAMEWORK_SPAN_TRACES_RETAINED) {
|
|
8355
|
-
const oldest = refusedFrameworkSpans.keys().next();
|
|
8356
|
-
if (oldest.done) {
|
|
8357
|
-
return;
|
|
8358
|
-
}
|
|
8359
|
-
refusedFrameworkSpans.delete(oldest.value);
|
|
8360
|
-
}
|
|
8361
|
-
}
|
|
8362
|
-
function reserveFrameworkSpan(traceId, spanId, parentSpanId) {
|
|
8363
|
-
const spanBudget = activeTraceStates.get(traceId)?.spanBudget;
|
|
8364
|
-
const parentRefused = parentSpanId !== null && frameworkSpanRefused(traceId, parentSpanId);
|
|
8365
|
-
if (!parentRefused && (spanBudget === void 0 || spanBudget.spansUsed < spanBudget.maxSpans)) {
|
|
8366
|
-
if (spanBudget !== void 0) {
|
|
8367
|
-
spanBudget.spansUsed += 1;
|
|
8368
|
-
}
|
|
8369
|
-
return;
|
|
8370
|
-
}
|
|
8371
|
-
refuseFrameworkSpan(traceId, spanId);
|
|
8372
|
-
spanBudget?.truncate("max_spans");
|
|
8373
|
-
}
|
|
8374
|
-
function isRefusedFrameworkSpan(payload) {
|
|
8375
|
-
if (!recordedByFramework(payload)) {
|
|
8376
|
-
return false;
|
|
8377
|
-
}
|
|
8378
|
-
const rawSpan = payload.rawSpan;
|
|
8379
|
-
const spanId = rawSpan?.id;
|
|
8380
|
-
if (typeof spanId !== "string") {
|
|
8381
|
-
return false;
|
|
8382
|
-
}
|
|
8383
|
-
const traceIds = [payload.sourceTraceId, traceIdOf(payload)];
|
|
8384
|
-
return traceIds.some(
|
|
8385
|
-
(traceId) => typeof traceId === "string" && frameworkSpanRefused(traceId, spanId)
|
|
8386
|
-
);
|
|
8387
|
-
}
|
|
8388
8327
|
function truncationMetadata(truncation) {
|
|
8389
8328
|
if (truncation === void 0 || truncation.limits.size === 0) {
|
|
8390
8329
|
return void 0;
|
|
@@ -8774,7 +8713,6 @@ function readBooleanEnv(name) {
|
|
|
8774
8713
|
return void 0;
|
|
8775
8714
|
}
|
|
8776
8715
|
var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
|
|
8777
|
-
var DEFAULT_AUTO_TRACE_MAX_SPANS = 1e4;
|
|
8778
8716
|
var DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS = 500;
|
|
8779
8717
|
function spanOwnerName(receiver) {
|
|
8780
8718
|
if (typeof receiver === "function") {
|
|
@@ -8842,7 +8780,6 @@ var Bitfab = class {
|
|
|
8842
8780
|
config.simulationPlan ?? true
|
|
8843
8781
|
);
|
|
8844
8782
|
this.httpClient.externalSpanTransform = (payload, submit, drop) => this.applySimulationPlan(payload, submit, drop);
|
|
8845
|
-
this.httpClient.frameworkSpanStart = reserveFrameworkSpan;
|
|
8846
8783
|
this.httpClient.externalTraceTransform = (payload, submit) => this.simulationPlan.sendTrace(payload, submit);
|
|
8847
8784
|
this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
|
|
8848
8785
|
this.httpClient.stopSimulationPlan = () => this.simulationPlan.stop();
|
|
@@ -9005,21 +8942,9 @@ var Bitfab = class {
|
|
|
9005
8942
|
options.maxDepth,
|
|
9006
8943
|
DEFAULT_AUTO_TRACE_MAX_DEPTH
|
|
9007
8944
|
);
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
);
|
|
9012
|
-
}
|
|
9013
|
-
const maxSpans = autoTraceLimit(
|
|
9014
|
-
options.maxSpans,
|
|
9015
|
-
DEFAULT_AUTO_TRACE_MAX_SPANS
|
|
9016
|
-
);
|
|
9017
|
-
const maxCapturedSubtreeSpans = Math.min(
|
|
9018
|
-
autoTraceLimit(
|
|
9019
|
-
options.maxCapturedSubtreeSpans,
|
|
9020
|
-
DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS
|
|
9021
|
-
),
|
|
9022
|
-
maxSpans
|
|
8945
|
+
const maxCapturedSubtreeSpans = autoTraceLimit(
|
|
8946
|
+
options.maxCapturedSubtreeSpans,
|
|
8947
|
+
DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS
|
|
9023
8948
|
);
|
|
9024
8949
|
const rootIsAsync = fn.constructor.name === "AsyncFunction";
|
|
9025
8950
|
const excluded = new Set(options.exclude ?? []);
|
|
@@ -9050,19 +8975,11 @@ var Bitfab = class {
|
|
|
9050
8975
|
truncation.droppedSpans += 1;
|
|
9051
8976
|
warnOnce(
|
|
9052
8977
|
`auto-trace-truncated:${traceFunctionKey}`,
|
|
9053
|
-
`"${traceFunctionKey}" hit an automatic subtree capture limit (maxDepth=${maxDepth}, maxCapturedSubtreeSpans=${maxCapturedSubtreeSpans}
|
|
8978
|
+
`"${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.`
|
|
9054
8979
|
);
|
|
9055
8980
|
};
|
|
9056
|
-
const spanBudget = {
|
|
9057
|
-
spansUsed: 1,
|
|
9058
|
-
maxSpans,
|
|
9059
|
-
truncate
|
|
9060
|
-
};
|
|
9061
8981
|
if (rootTraceState !== void 0) {
|
|
9062
8982
|
rootTraceState.truncation = truncation;
|
|
9063
|
-
if (rootTraceState.spanBudget === void 0) {
|
|
9064
|
-
rootTraceState.spanBudget = spanBudget;
|
|
9065
|
-
}
|
|
9066
8983
|
}
|
|
9067
8984
|
const spanStackOf = (entry) => entry.spanStack;
|
|
9068
8985
|
const openChild = (entry, childOptions, inputs, isAsync, invokeFn) => {
|
|
@@ -9098,16 +9015,16 @@ var Bitfab = class {
|
|
|
9098
9015
|
return innermost === void 0 ? traceFunctionKey : rootTraceFunctionKeyOfTrace(innermost.traceId, traceFunctionKey);
|
|
9099
9016
|
};
|
|
9100
9017
|
const recordsSpan = (entry, spanName, declared) => {
|
|
9101
|
-
const
|
|
9018
|
+
const contentOff = !declared && self.simulationPlan.contentOffNow(
|
|
9102
9019
|
rootTraceFunctionKeyOfEntry(entry),
|
|
9103
9020
|
spanName
|
|
9104
9021
|
);
|
|
9105
|
-
const
|
|
9022
|
+
const countsTowardCapturedSubtree = !declared && !contentOff;
|
|
9023
|
+
const refusedBy = entry.depth >= maxDepth ? "max_depth" : countsTowardCapturedSubtree && capturedSubtreeCount >= maxCapturedSubtreeSpans ? "max_captured_subtree_spans" : void 0;
|
|
9106
9024
|
if (refusedBy !== void 0) {
|
|
9107
9025
|
truncate(refusedBy);
|
|
9108
9026
|
return false;
|
|
9109
9027
|
}
|
|
9110
|
-
spanBudget.spansUsed += 1;
|
|
9111
9028
|
if (countsTowardCapturedSubtree) {
|
|
9112
9029
|
capturedSubtreeCount += 1;
|
|
9113
9030
|
}
|
|
@@ -9126,7 +9043,8 @@ var Bitfab = class {
|
|
|
9126
9043
|
return clearAutoTraceNodeConfiguration(invokeFn);
|
|
9127
9044
|
}
|
|
9128
9045
|
const spanName = nodeConfiguration?.name ?? definition.name;
|
|
9129
|
-
|
|
9046
|
+
const declaredNode = nodeConfiguration !== void 0;
|
|
9047
|
+
if (!recordsSpan(entry, spanName, declaredNode)) {
|
|
9130
9048
|
return invokeWithoutNode();
|
|
9131
9049
|
}
|
|
9132
9050
|
const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
|
|
@@ -9139,6 +9057,7 @@ var Bitfab = class {
|
|
|
9139
9057
|
functionId: definition.id,
|
|
9140
9058
|
captureContent: true,
|
|
9141
9059
|
autoTraceDefinition: definition,
|
|
9060
|
+
...declaredNode && { declaredNode },
|
|
9142
9061
|
...nodeConfiguration?.testRunId !== void 0 && {
|
|
9143
9062
|
testRunId: nodeConfiguration.testRunId
|
|
9144
9063
|
},
|
|
@@ -9168,6 +9087,7 @@ var Bitfab = class {
|
|
|
9168
9087
|
surface: "opt-out",
|
|
9169
9088
|
instrumentation: "trace",
|
|
9170
9089
|
captureContent: true,
|
|
9090
|
+
declaredNode: true,
|
|
9171
9091
|
...link !== void 0 && { nestedTrace: link }
|
|
9172
9092
|
};
|
|
9173
9093
|
return openChild(entry, childOptions, inputs, false, invokeFn);
|
|
@@ -9239,10 +9159,6 @@ var Bitfab = class {
|
|
|
9239
9159
|
return autoTraceRoot;
|
|
9240
9160
|
}
|
|
9241
9161
|
applySimulationPlan(payload, submit, drop) {
|
|
9242
|
-
if (isRefusedFrameworkSpan(payload)) {
|
|
9243
|
-
drop();
|
|
9244
|
-
return;
|
|
9245
|
-
}
|
|
9246
9162
|
this.simulationPlan.send(
|
|
9247
9163
|
payload,
|
|
9248
9164
|
rootTraceFunctionKeyOf(payload),
|
|
@@ -9917,9 +9833,6 @@ var Bitfab = class {
|
|
|
9917
9833
|
registeredTraceId = traceId;
|
|
9918
9834
|
}
|
|
9919
9835
|
self.httpClient.traceCompletion.start(traceId, spanId);
|
|
9920
|
-
if (isFrameworkInstrumentation(options.instrumentation)) {
|
|
9921
|
-
reserveFrameworkSpan(traceId, spanId, parentSpanId);
|
|
9922
|
-
}
|
|
9923
9836
|
startedSpan = { traceId, spanId };
|
|
9924
9837
|
const functionName = fn.name !== "" ? fn.name : void 0;
|
|
9925
9838
|
const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
|
|
@@ -9941,6 +9854,7 @@ var Bitfab = class {
|
|
|
9941
9854
|
functionId: options.functionId,
|
|
9942
9855
|
captureContent: options.captureContent ?? true,
|
|
9943
9856
|
autoTraceDefinition: options.autoTraceDefinition,
|
|
9857
|
+
declaredNode: options.declaredNode === true,
|
|
9944
9858
|
nestedTrace: options.nestedTrace,
|
|
9945
9859
|
enclosingTrace: options.enclosingTrace
|
|
9946
9860
|
};
|
|
@@ -10466,7 +10380,7 @@ var Bitfab = class {
|
|
|
10466
10380
|
* Queued on the client's span transport; delivery is the transport's job.
|
|
10467
10381
|
*/
|
|
10468
10382
|
sendWrapperSpan(params) {
|
|
10469
|
-
const contentOff = this.contentOffBySimulationPlan(params);
|
|
10383
|
+
const contentOff = params.declaredNode !== true && this.contentOffBySimulationPlan(params);
|
|
10470
10384
|
const buildsContent = params.captureContent && !contentOff;
|
|
10471
10385
|
const serializedInputs = buildsContent ? serializeValue(params.inputs) : void 0;
|
|
10472
10386
|
const serializedResult = buildsContent ? serializeValue(params.result) : void 0;
|
|
@@ -10540,6 +10454,7 @@ var Bitfab = class {
|
|
|
10540
10454
|
...params.rootTraceFunctionKey !== void 0 && {
|
|
10541
10455
|
[ROOT_TRACE_FUNCTION_KEY_FIELD]: params.rootTraceFunctionKey
|
|
10542
10456
|
},
|
|
10457
|
+
...params.declaredNode === true && { [DECLARED_NODE_FIELD]: true },
|
|
10543
10458
|
rawSpan: externalSpan,
|
|
10544
10459
|
...params.testRunId && { testRunId: params.testRunId },
|
|
10545
10460
|
...params.mocked && { mocked: true },
|