bitfab 0.54.3 → 0.54.5
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-DL4KHJON.js → chunk-3O5MS4XJ.js} +2 -2
- package/dist/{chunk-ZO4NEEUA.js → chunk-GVK7AES5.js} +113 -6
- package/dist/chunk-GVK7AES5.js.map +1 -0
- package/dist/{chunk-PELZFWPC.js → chunk-NATC7L2W.js} +124 -54
- package/dist/chunk-NATC7L2W.js.map +1 -0
- package/dist/{chunk-NI6B2BP4.js → chunk-RA3J6A6K.js} +113 -6
- package/dist/chunk-RA3J6A6K.js.map +1 -0
- package/dist/{chunk-4H7E2S27.js → chunk-VAHFHCBT.js} +3 -3
- package/dist/{http-6WMGO7GB.js → http-K2H4547F.js} +2 -2
- package/dist/{http-A5BXPX5R.js → http-RW2JO6TU.js} +2 -2
- package/dist/index.cjs +236 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +114 -73
- package/dist/index.d.ts +114 -73
- package/dist/index.js +3 -3
- package/dist/node.cjs +236 -52
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-FOVT4PNE.js → replay-MHYULXCH.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-NI6B2BP4.js.map +0 -1
- package/dist/chunk-PELZFWPC.js.map +0 -1
- package/dist/chunk-ZO4NEEUA.js.map +0 -1
- /package/dist/{chunk-DL4KHJON.js.map → chunk-3O5MS4XJ.js.map} +0 -0
- /package/dist/{chunk-4H7E2S27.js.map → chunk-VAHFHCBT.js.map} +0 -0
- /package/dist/{http-6WMGO7GB.js.map → http-K2H4547F.js.map} +0 -0
- /package/dist/{http-A5BXPX5R.js.map → http-RW2JO6TU.js.map} +0 -0
- /package/dist/{replay-FOVT4PNE.js.map → replay-MHYULXCH.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
replayContextReady,
|
|
7
7
|
runWithReplayContext,
|
|
8
8
|
warnOnce
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GVK7AES5.js";
|
|
10
10
|
import {
|
|
11
11
|
runWithCaptureSuppressed
|
|
12
12
|
} from "./chunk-VCRFFCLY.js";
|
|
@@ -1212,4 +1212,4 @@ export {
|
|
|
1212
1212
|
sleepForReplayPersistence,
|
|
1213
1213
|
replay
|
|
1214
1214
|
};
|
|
1215
|
-
//# sourceMappingURL=chunk-
|
|
1215
|
+
//# sourceMappingURL=chunk-3O5MS4XJ.js.map
|
|
@@ -4,6 +4,93 @@ import {
|
|
|
4
4
|
runWithCaptureSuppressed
|
|
5
5
|
} from "./chunk-VCRFFCLY.js";
|
|
6
6
|
|
|
7
|
+
// src/traceCompletion.ts
|
|
8
|
+
var TraceCompletion = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.traces = /* @__PURE__ */ new Map();
|
|
11
|
+
this.closed = /* @__PURE__ */ new Map();
|
|
12
|
+
}
|
|
13
|
+
state(traceId) {
|
|
14
|
+
let state = this.traces.get(traceId);
|
|
15
|
+
if (state === void 0) {
|
|
16
|
+
state = { spanIds: /* @__PURE__ */ new Set(), active: /* @__PURE__ */ new Set() };
|
|
17
|
+
this.traces.set(traceId, state);
|
|
18
|
+
}
|
|
19
|
+
return state;
|
|
20
|
+
}
|
|
21
|
+
start(traceId, spanId) {
|
|
22
|
+
if (this.closed.has(traceId)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const state = this.state(traceId);
|
|
26
|
+
state.spanIds.add(spanId);
|
|
27
|
+
state.active.add(spanId);
|
|
28
|
+
}
|
|
29
|
+
open(traceId) {
|
|
30
|
+
if (!this.closed.has(traceId)) {
|
|
31
|
+
this.state(traceId);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
hold(traceId, key) {
|
|
35
|
+
this.state(traceId).active.add(key);
|
|
36
|
+
}
|
|
37
|
+
record(traceId, spanId) {
|
|
38
|
+
if (!this.closed.has(traceId)) {
|
|
39
|
+
this.state(traceId).spanIds.add(spanId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
end(traceId, spanId) {
|
|
43
|
+
const state = this.traces.get(traceId);
|
|
44
|
+
if (state !== void 0) {
|
|
45
|
+
state.active.delete(spanId);
|
|
46
|
+
this.drain(traceId, state);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
abort(traceId, spanId) {
|
|
50
|
+
const state = this.traces.get(traceId);
|
|
51
|
+
if (state === void 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
state.active.delete(spanId);
|
|
55
|
+
state.spanIds.delete(spanId);
|
|
56
|
+
if (state.active.size === 0 && state.spanIds.size === 0 && state.complete === void 0) {
|
|
57
|
+
this.traces.delete(traceId);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.drain(traceId, state);
|
|
61
|
+
}
|
|
62
|
+
close(traceId, complete, dropped = false) {
|
|
63
|
+
const count = this.closed.get(traceId);
|
|
64
|
+
if (count !== void 0) {
|
|
65
|
+
complete(count);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const state = this.traces.get(traceId);
|
|
69
|
+
if (state === void 0) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
state.complete = complete;
|
|
73
|
+
if (dropped) {
|
|
74
|
+
state.active.clear();
|
|
75
|
+
}
|
|
76
|
+
this.drain(traceId, state);
|
|
77
|
+
}
|
|
78
|
+
drain(traceId, state) {
|
|
79
|
+
if (state.active.size !== 0 || state.complete === void 0) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.traces.delete(traceId);
|
|
83
|
+
this.closed.set(traceId, state.spanIds.size);
|
|
84
|
+
if (this.closed.size > 1024) {
|
|
85
|
+
const oldest = this.closed.keys().next().value;
|
|
86
|
+
if (oldest !== void 0) {
|
|
87
|
+
this.closed.delete(oldest);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
state.complete(state.spanIds.size);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
7
94
|
// src/readEnv.ts
|
|
8
95
|
function readEnv(name) {
|
|
9
96
|
if (typeof process !== "undefined" && process.env) {
|
|
@@ -100,7 +187,7 @@ function encodeRequestBody(body) {
|
|
|
100
187
|
}
|
|
101
188
|
|
|
102
189
|
// src/version.generated.ts
|
|
103
|
-
var __version__ = "0.54.
|
|
190
|
+
var __version__ = "0.54.5";
|
|
104
191
|
var __packageName__ = "bitfab";
|
|
105
192
|
|
|
106
193
|
// src/constants.ts
|
|
@@ -1959,6 +2046,7 @@ var HttpClient = class {
|
|
|
1959
2046
|
// must not wait on another client's slow finalize: a false `close()` failure
|
|
1960
2047
|
// caused by unrelated work is worse than no signal at all.
|
|
1961
2048
|
this.deferredWork = /* @__PURE__ */ new Set();
|
|
2049
|
+
this.traceCompletion = new TraceCompletion();
|
|
1962
2050
|
this.closed = false;
|
|
1963
2051
|
this.apiKey = config.apiKey;
|
|
1964
2052
|
this.serviceUrl = config.serviceUrl;
|
|
@@ -2392,6 +2480,10 @@ var HttpClient = class {
|
|
|
2392
2480
|
);
|
|
2393
2481
|
}
|
|
2394
2482
|
sendExternalSpan(payload) {
|
|
2483
|
+
const ref = carrierRef(payload);
|
|
2484
|
+
if (ref?.spanId !== void 0) {
|
|
2485
|
+
this.traceCompletion.record(ref.traceId, ref.spanId);
|
|
2486
|
+
}
|
|
2395
2487
|
const gate = this.externalSpanTransform;
|
|
2396
2488
|
if (gate === void 0) {
|
|
2397
2489
|
this.submitExternalSpan(payload);
|
|
@@ -2423,13 +2515,28 @@ var HttpClient = class {
|
|
|
2423
2515
|
*/
|
|
2424
2516
|
sendExternalTrace(rawPayload) {
|
|
2425
2517
|
const payload = mergeCallerMetadataIntoTracePayload(rawPayload);
|
|
2426
|
-
const
|
|
2427
|
-
if (
|
|
2428
|
-
this.
|
|
2518
|
+
const traceId = sourceTraceIdOf(payload);
|
|
2519
|
+
if (payload.completed === true && traceId !== void 0) {
|
|
2520
|
+
this.traceCompletion.close(
|
|
2521
|
+
traceId,
|
|
2522
|
+
(expectedSpanCount) => this.sendCountedExternalTrace({ ...payload, expectedSpanCount }),
|
|
2523
|
+
payload.dropped === true
|
|
2524
|
+
);
|
|
2429
2525
|
return;
|
|
2430
2526
|
}
|
|
2527
|
+
if (traceId !== void 0) {
|
|
2528
|
+
this.traceCompletion.open(traceId);
|
|
2529
|
+
}
|
|
2530
|
+
this.sendCountedExternalTrace(payload);
|
|
2531
|
+
}
|
|
2532
|
+
sendCountedExternalTrace(payload) {
|
|
2431
2533
|
try {
|
|
2432
|
-
gate
|
|
2534
|
+
const gate = this.externalTraceTransform;
|
|
2535
|
+
if (gate === void 0) {
|
|
2536
|
+
this.submitExternalTrace(payload);
|
|
2537
|
+
} else {
|
|
2538
|
+
gate(payload, (ready) => this.submitExternalTrace(ready));
|
|
2539
|
+
}
|
|
2433
2540
|
} catch (error) {
|
|
2434
2541
|
warnDroppedExternalTrace(error);
|
|
2435
2542
|
}
|
|
@@ -2700,4 +2807,4 @@ export {
|
|
|
2700
2807
|
parseRetryAfterMs,
|
|
2701
2808
|
HttpClient
|
|
2702
2809
|
};
|
|
2703
|
-
//# sourceMappingURL=chunk-
|
|
2810
|
+
//# sourceMappingURL=chunk-GVK7AES5.js.map
|