@bitfab/sdk 0.34.2 → 0.36.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-SBQQOFA5.js → chunk-4YTIVUYX.js} +251 -36
- package/dist/chunk-4YTIVUYX.js.map +1 -0
- package/dist/{chunk-KQB42J3S.js → chunk-JECWMVJG.js} +3 -3
- package/dist/index.cjs +272 -41
- 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 +2 -2
- package/dist/node.cjs +272 -41
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-BNAXIBGN.js → replay-CVMULH7T.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-SBQQOFA5.js.map +0 -1
- /package/dist/{chunk-KQB42J3S.js.map → chunk-JECWMVJG.js.map} +0 -0
- /package/dist/{replay-BNAXIBGN.js.map → replay-CVMULH7T.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -2336,7 +2336,7 @@ declare class BitfabFunction {
|
|
|
2336
2336
|
/**
|
|
2337
2337
|
* SDK version from package.json (injected at build time)
|
|
2338
2338
|
*/
|
|
2339
|
-
declare const __version__ = "0.
|
|
2339
|
+
declare const __version__ = "0.36.0";
|
|
2340
2340
|
|
|
2341
2341
|
/**
|
|
2342
2342
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -2336,7 +2336,7 @@ declare class BitfabFunction {
|
|
|
2336
2336
|
/**
|
|
2337
2337
|
* SDK version from package.json (injected at build time)
|
|
2338
2338
|
*/
|
|
2339
|
-
declare const __version__ = "0.
|
|
2339
|
+
declare const __version__ = "0.36.0";
|
|
2340
2340
|
|
|
2341
2341
|
/**
|
|
2342
2342
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getCurrentReplayBranch,
|
|
12
12
|
getCurrentSpan,
|
|
13
13
|
getCurrentTrace
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JECWMVJG.js";
|
|
15
15
|
import {
|
|
16
16
|
BITFAB_PROGRESS_PREFIX,
|
|
17
17
|
BitfabError,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
__version__,
|
|
21
21
|
flushTraces,
|
|
22
22
|
reportReplayProgress
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4YTIVUYX.js";
|
|
24
24
|
export {
|
|
25
25
|
BITFAB_PROGRESS_PREFIX,
|
|
26
26
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -88,7 +88,7 @@ var __version__;
|
|
|
88
88
|
var init_version_generated = __esm({
|
|
89
89
|
"src/version.generated.ts"() {
|
|
90
90
|
"use strict";
|
|
91
|
-
__version__ = "0.
|
|
91
|
+
__version__ = "0.36.0";
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
|
|
@@ -102,6 +102,87 @@ var init_constants = __esm({
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
// src/readEnv.ts
|
|
106
|
+
function readEnv(name) {
|
|
107
|
+
if (typeof process !== "undefined" && process.env) {
|
|
108
|
+
return process.env[name];
|
|
109
|
+
}
|
|
110
|
+
return void 0;
|
|
111
|
+
}
|
|
112
|
+
var init_readEnv = __esm({
|
|
113
|
+
"src/readEnv.ts"() {
|
|
114
|
+
"use strict";
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// src/compress.ts
|
|
119
|
+
function toArrayBuffer(view) {
|
|
120
|
+
return view.buffer.slice(
|
|
121
|
+
view.byteOffset,
|
|
122
|
+
view.byteOffset + view.byteLength
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
async function gzipViaStream(bytes) {
|
|
126
|
+
const stream = new Blob([bytes]).stream().pipeThrough(new CompressionStream("gzip"));
|
|
127
|
+
return await new Response(stream).arrayBuffer();
|
|
128
|
+
}
|
|
129
|
+
function encodeRequestBody(body) {
|
|
130
|
+
if (readEnv(DISABLE_COMPRESSION_ENV)) {
|
|
131
|
+
return { body };
|
|
132
|
+
}
|
|
133
|
+
const bytes = new TextEncoder().encode(body);
|
|
134
|
+
if (bytes.byteLength < MIN_COMPRESSED_BYTES) {
|
|
135
|
+
return { body };
|
|
136
|
+
}
|
|
137
|
+
if (gzipNode) {
|
|
138
|
+
return gzipNode(bytes).then(
|
|
139
|
+
(compressed) => ({
|
|
140
|
+
body: toArrayBuffer(compressed),
|
|
141
|
+
contentEncoding: "gzip"
|
|
142
|
+
}),
|
|
143
|
+
() => ({ body })
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (typeof CompressionStream === "undefined") {
|
|
147
|
+
return { body };
|
|
148
|
+
}
|
|
149
|
+
return gzipViaStream(bytes).then(
|
|
150
|
+
(compressed) => ({ body: compressed, contentEncoding: "gzip" }),
|
|
151
|
+
() => ({ body })
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
var DISABLE_COMPRESSION_ENV, MIN_COMPRESSED_BYTES, gzipNode, _nodeGzipReady;
|
|
155
|
+
var init_compress = __esm({
|
|
156
|
+
"src/compress.ts"() {
|
|
157
|
+
"use strict";
|
|
158
|
+
init_readEnv();
|
|
159
|
+
DISABLE_COMPRESSION_ENV = "BITFAB_DISABLE_COMPRESSION";
|
|
160
|
+
MIN_COMPRESSED_BYTES = 8192;
|
|
161
|
+
_nodeGzipReady = (typeof process !== "undefined" && process.versions?.node ? (
|
|
162
|
+
// The join trick hides "node:zlib" from static analysis so bundlers that
|
|
163
|
+
// ban Node.js built-ins don't fail at build time. webpackIgnore tells
|
|
164
|
+
// webpack/turbopack to emit a native import() so Node.js can resolve the
|
|
165
|
+
// module at runtime. Same pattern as `asyncStorage.ts`.
|
|
166
|
+
import(
|
|
167
|
+
/* webpackIgnore: true */
|
|
168
|
+
["node", "zlib"].join(":")
|
|
169
|
+
).then(({ gzip }) => {
|
|
170
|
+
gzipNode = (data) => new Promise((resolve, reject) => {
|
|
171
|
+
gzip(data, (error, result) => {
|
|
172
|
+
if (error) {
|
|
173
|
+
reject(error);
|
|
174
|
+
} else {
|
|
175
|
+
resolve(result);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}).catch(() => {
|
|
180
|
+
})
|
|
181
|
+
) : Promise.resolve()).then(() => {
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
105
186
|
// src/errors.ts
|
|
106
187
|
var BitfabError;
|
|
107
188
|
var init_errors = __esm({
|
|
@@ -151,6 +232,131 @@ var init_replayContext = __esm({
|
|
|
151
232
|
}
|
|
152
233
|
});
|
|
153
234
|
|
|
235
|
+
// src/payloadBudget.ts
|
|
236
|
+
function byteLength(value) {
|
|
237
|
+
return textEncoder ? textEncoder.encode(value).length : value.length;
|
|
238
|
+
}
|
|
239
|
+
function carrierByteLength(body) {
|
|
240
|
+
return carrierBytesOf(textEncoder ? textEncoder.encode(body) : null, body);
|
|
241
|
+
}
|
|
242
|
+
function carrierBytesOf(encoded, body) {
|
|
243
|
+
if (!encoded) {
|
|
244
|
+
return body.length + 2;
|
|
245
|
+
}
|
|
246
|
+
let extra = 2;
|
|
247
|
+
for (let i = 0; i < encoded.length; i++) {
|
|
248
|
+
const byte = encoded[i];
|
|
249
|
+
if (byte === 34 || byte === 92) {
|
|
250
|
+
extra += 1;
|
|
251
|
+
} else if (byte < 32) {
|
|
252
|
+
extra += byte === 8 || byte === 9 || byte === 10 || byte === 12 || byte === 13 ? 1 : 5;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return encoded.length + extra;
|
|
256
|
+
}
|
|
257
|
+
function fitsCarrierBudget(body) {
|
|
258
|
+
const units = body.length;
|
|
259
|
+
if (units * MAX_BYTES_PER_UNIT + 2 <= MAX_SPAN_CARRIER_BYTES) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
if (units + 2 > MAX_SPAN_CARRIER_BYTES) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
return carrierByteLength(body) <= MAX_SPAN_CARRIER_BYTES;
|
|
266
|
+
}
|
|
267
|
+
function asRecord(value) {
|
|
268
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
269
|
+
}
|
|
270
|
+
function cloneTrimmable(payload) {
|
|
271
|
+
const copy = { ...payload };
|
|
272
|
+
const containers = [];
|
|
273
|
+
const spanData = asRecord(copy.span_data);
|
|
274
|
+
if (spanData) {
|
|
275
|
+
const clone = { ...spanData };
|
|
276
|
+
copy.span_data = clone;
|
|
277
|
+
containers.push(clone);
|
|
278
|
+
}
|
|
279
|
+
const rawSpan = asRecord(copy.rawSpan);
|
|
280
|
+
const rawSpanData = rawSpan && asRecord(rawSpan.span_data);
|
|
281
|
+
if (rawSpan && rawSpanData) {
|
|
282
|
+
const clone = { ...rawSpanData };
|
|
283
|
+
copy.rawSpan = { ...rawSpan, span_data: clone };
|
|
284
|
+
containers.push(clone);
|
|
285
|
+
}
|
|
286
|
+
if (containers.length === 0) {
|
|
287
|
+
containers.push(copy);
|
|
288
|
+
}
|
|
289
|
+
return { copy, containers };
|
|
290
|
+
}
|
|
291
|
+
function collectCandidates(containers) {
|
|
292
|
+
const candidates = [];
|
|
293
|
+
for (const container of containers) {
|
|
294
|
+
for (const [key, value] of Object.entries(container)) {
|
|
295
|
+
if (STRUCTURAL_SPAN_KEYS.has(key) || value == null) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
let size;
|
|
299
|
+
try {
|
|
300
|
+
size = byteLength(JSON.stringify(value) ?? "");
|
|
301
|
+
} catch {
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
candidates.push({ container, key, size });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return candidates.sort((a, b) => b.size - a.size);
|
|
308
|
+
}
|
|
309
|
+
function trimPayloadToBudget(payload, encode) {
|
|
310
|
+
const { copy, containers } = cloneTrimmable(payload);
|
|
311
|
+
const candidates = collectCandidates(containers);
|
|
312
|
+
if (candidates.length === 0) {
|
|
313
|
+
return void 0;
|
|
314
|
+
}
|
|
315
|
+
const trimmed = [];
|
|
316
|
+
for (const candidate of candidates) {
|
|
317
|
+
candidate.container[candidate.key] = `<unserializable: too_large_${candidate.size}_bytes>`;
|
|
318
|
+
trimmed.push(candidate.key);
|
|
319
|
+
let body;
|
|
320
|
+
try {
|
|
321
|
+
body = encode(copy);
|
|
322
|
+
} catch {
|
|
323
|
+
return void 0;
|
|
324
|
+
}
|
|
325
|
+
if (fitsCarrierBudget(body)) {
|
|
326
|
+
return { value: copy, trimmed };
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return void 0;
|
|
330
|
+
}
|
|
331
|
+
function markPayloadTrimmed(value, trimmed) {
|
|
332
|
+
const existing = Array.isArray(value.errors) ? value.errors : [];
|
|
333
|
+
value.errors = [
|
|
334
|
+
...existing,
|
|
335
|
+
{
|
|
336
|
+
source: "sdk",
|
|
337
|
+
step: "payload_budget",
|
|
338
|
+
error: `trimmed oversized field(s) to fit the ${MAX_SPAN_CARRIER_BYTES}-byte span carrier budget: ${[
|
|
339
|
+
...new Set(trimmed)
|
|
340
|
+
].join(", ")}`
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
}
|
|
344
|
+
var MAX_SPAN_CARRIER_BYTES, textEncoder, MAX_BYTES_PER_UNIT, STRUCTURAL_SPAN_KEYS;
|
|
345
|
+
var init_payloadBudget = __esm({
|
|
346
|
+
"src/payloadBudget.ts"() {
|
|
347
|
+
"use strict";
|
|
348
|
+
MAX_SPAN_CARRIER_BYTES = 28e5;
|
|
349
|
+
textEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder() : null;
|
|
350
|
+
MAX_BYTES_PER_UNIT = 3;
|
|
351
|
+
STRUCTURAL_SPAN_KEYS = /* @__PURE__ */ new Set([
|
|
352
|
+
"name",
|
|
353
|
+
"type",
|
|
354
|
+
"function_name",
|
|
355
|
+
"error_source"
|
|
356
|
+
]);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
|
|
154
360
|
// src/warnOnce.ts
|
|
155
361
|
function warnOnce(key, message) {
|
|
156
362
|
if (warned.has(key)) {
|
|
@@ -172,8 +378,37 @@ var init_warnOnce = __esm({
|
|
|
172
378
|
|
|
173
379
|
// src/serializePayload.ts
|
|
174
380
|
function serializePayloadBody(payload) {
|
|
381
|
+
const encoded = encodePayloadBody(payload);
|
|
382
|
+
if (fitsCarrierBudget(encoded.body)) {
|
|
383
|
+
return { body: encoded.body, dropped: encoded.dropped };
|
|
384
|
+
}
|
|
385
|
+
return applyPayloadBudget(encoded);
|
|
386
|
+
}
|
|
387
|
+
function applyPayloadBudget(encoded) {
|
|
388
|
+
const result = encoded.value ? trimPayloadToBudget(
|
|
389
|
+
encoded.value,
|
|
390
|
+
(value) => encodePayloadBody(value).body
|
|
391
|
+
) : void 0;
|
|
392
|
+
if (!result) {
|
|
393
|
+
return { body: encoded.body, dropped: encoded.dropped };
|
|
394
|
+
}
|
|
395
|
+
warnOnce(
|
|
396
|
+
"payload:over-budget",
|
|
397
|
+
`a span payload exceeded the ${MAX_SPAN_CARRIER_BYTES}-byte carrier budget; its largest field(s) (${[
|
|
398
|
+
...new Set(result.trimmed)
|
|
399
|
+
].join(
|
|
400
|
+
", "
|
|
401
|
+
)}) were replaced with placeholders so the span still ships. The span is incomplete and may not be replayable.`
|
|
402
|
+
);
|
|
403
|
+
markPayloadTrimmed(result.value, result.trimmed);
|
|
404
|
+
return {
|
|
405
|
+
body: encodePayloadBody(result.value).body,
|
|
406
|
+
dropped: encoded.dropped
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function encodePayloadBody(payload) {
|
|
175
410
|
try {
|
|
176
|
-
return { body: JSON.stringify(payload), dropped: [] };
|
|
411
|
+
return { body: JSON.stringify(payload), dropped: [], value: payload };
|
|
177
412
|
} catch {
|
|
178
413
|
const dropped = [];
|
|
179
414
|
const sanitize = (value, seen) => {
|
|
@@ -238,12 +473,11 @@ function serializePayloadBody(payload) {
|
|
|
238
473
|
sanitized = sanitize(payload, /* @__PURE__ */ new WeakSet());
|
|
239
474
|
} catch (error) {
|
|
240
475
|
const message = error instanceof Error ? error.message : String(error);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
dropped
|
|
244
|
-
};
|
|
476
|
+
const marker = { error: `payload_serialize_failed: ${message}` };
|
|
477
|
+
return { body: JSON.stringify(marker), dropped, value: marker };
|
|
245
478
|
}
|
|
246
|
-
|
|
479
|
+
const isRecord = typeof sanitized === "object" && sanitized !== null && !Array.isArray(sanitized);
|
|
480
|
+
if (dropped.length > 0 && isRecord) {
|
|
247
481
|
const obj = sanitized;
|
|
248
482
|
const existing = Array.isArray(obj.errors) ? obj.errors : [];
|
|
249
483
|
obj.errors = [
|
|
@@ -257,29 +491,21 @@ function serializePayloadBody(payload) {
|
|
|
257
491
|
}
|
|
258
492
|
];
|
|
259
493
|
}
|
|
260
|
-
return {
|
|
494
|
+
return {
|
|
495
|
+
body: JSON.stringify(sanitized),
|
|
496
|
+
dropped,
|
|
497
|
+
value: isRecord ? sanitized : void 0
|
|
498
|
+
};
|
|
261
499
|
}
|
|
262
500
|
}
|
|
263
501
|
var init_serializePayload = __esm({
|
|
264
502
|
"src/serializePayload.ts"() {
|
|
265
503
|
"use strict";
|
|
504
|
+
init_payloadBudget();
|
|
266
505
|
init_warnOnce();
|
|
267
506
|
}
|
|
268
507
|
});
|
|
269
508
|
|
|
270
|
-
// src/readEnv.ts
|
|
271
|
-
function readEnv(name) {
|
|
272
|
-
if (typeof process !== "undefined" && process.env) {
|
|
273
|
-
return process.env[name];
|
|
274
|
-
}
|
|
275
|
-
return void 0;
|
|
276
|
-
}
|
|
277
|
-
var init_readEnv = __esm({
|
|
278
|
-
"src/readEnv.ts"() {
|
|
279
|
-
"use strict";
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
|
|
283
509
|
// src/unrefTimer.ts
|
|
284
510
|
function unrefTimer(timer) {
|
|
285
511
|
const handle = timer;
|
|
@@ -325,7 +551,7 @@ function recordTraceSubmission(operation, payload) {
|
|
|
325
551
|
return;
|
|
326
552
|
}
|
|
327
553
|
if (operation === "external_span") {
|
|
328
|
-
const rawSpan =
|
|
554
|
+
const rawSpan = asRecord2(payload.rawSpan);
|
|
329
555
|
if (typeof rawSpan?.id !== "string") {
|
|
330
556
|
submissionCounter += 1;
|
|
331
557
|
}
|
|
@@ -362,14 +588,14 @@ function takeReplaySpanCounts(traceIds) {
|
|
|
362
588
|
}
|
|
363
589
|
return counts;
|
|
364
590
|
}
|
|
365
|
-
function
|
|
591
|
+
function asRecord2(value) {
|
|
366
592
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
367
593
|
}
|
|
368
594
|
function resolveSourceTraceId(payload) {
|
|
369
595
|
if (typeof payload.sourceTraceId === "string") {
|
|
370
596
|
return payload.sourceTraceId;
|
|
371
597
|
}
|
|
372
|
-
const rawTrace =
|
|
598
|
+
const rawTrace = asRecord2(payload.externalTrace) ?? asRecord2(payload.rawTrace);
|
|
373
599
|
return typeof rawTrace?.id === "string" ? rawTrace.id : void 0;
|
|
374
600
|
}
|
|
375
601
|
function otlpValue(value) {
|
|
@@ -427,9 +653,6 @@ function spanToOtlp(span) {
|
|
|
427
653
|
}
|
|
428
654
|
return result;
|
|
429
655
|
}
|
|
430
|
-
function byteLength(value) {
|
|
431
|
-
return textEncoder ? textEncoder.encode(value).length : value.length;
|
|
432
|
-
}
|
|
433
656
|
function encodeSpan(span) {
|
|
434
657
|
const json = JSON.stringify(spanToOtlp(span));
|
|
435
658
|
return { json, size: byteLength(json) };
|
|
@@ -505,7 +728,7 @@ function endSpan(span, endTime) {
|
|
|
505
728
|
}
|
|
506
729
|
function spanName(operation, payload) {
|
|
507
730
|
if (operation === "external_span") {
|
|
508
|
-
const spanData =
|
|
731
|
+
const spanData = asRecord2(asRecord2(payload.rawSpan)?.span_data);
|
|
509
732
|
if (typeof spanData?.name === "string") {
|
|
510
733
|
return spanData.name;
|
|
511
734
|
}
|
|
@@ -516,8 +739,8 @@ function spanName(operation, payload) {
|
|
|
516
739
|
return `bitfab.${operation}`;
|
|
517
740
|
}
|
|
518
741
|
function payloadTimestamp(payload, field) {
|
|
519
|
-
const rawSpan =
|
|
520
|
-
const rawTrace =
|
|
742
|
+
const rawSpan = asRecord2(payload.rawSpan);
|
|
743
|
+
const rawTrace = asRecord2(payload.externalTrace) ?? asRecord2(payload.rawTrace);
|
|
521
744
|
const raw = rawSpan?.[field] ?? rawTrace?.[field];
|
|
522
745
|
if (typeof raw !== "string") {
|
|
523
746
|
return void 0;
|
|
@@ -526,7 +749,7 @@ function payloadTimestamp(payload, field) {
|
|
|
526
749
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
527
750
|
}
|
|
528
751
|
function hasError(payload) {
|
|
529
|
-
const spanData =
|
|
752
|
+
const spanData = asRecord2(asRecord2(payload.rawSpan)?.span_data);
|
|
530
753
|
if (spanData?.error != null) {
|
|
531
754
|
return true;
|
|
532
755
|
}
|
|
@@ -570,7 +793,7 @@ function shutdownOtelTransports(timeoutMs = DEFAULT_LIFECYCLE_TIMEOUT_MS) {
|
|
|
570
793
|
(transport, remaining) => transport.shutdown(remaining)
|
|
571
794
|
);
|
|
572
795
|
}
|
|
573
|
-
var import_api, import_core, import_resources, import_sdk_trace_base, OPERATION_ATTRIBUTE, PAYLOAD_ATTRIBUTE, OTLP_TRACES_ENDPOINT, MAX_EXPORT_REQUEST_BYTES, MAX_REQUEST_BYTES_ENV, EXPORT_CONCURRENCY_ENV, MAX_QUEUE_SIZE, DIRECT_MAX_EXPORT_BATCH_SIZE, DIRECT_MAX_REQUEST_BATCH_SIZE, DEFAULT_EXPORT_CONCURRENCY, MAX_EXPORT_CONCURRENCY, SCHEDULE_DELAY_MILLIS, EXPORT_TIMEOUT_MILLIS, RETRY_DELAY_MILLIS, MAX_SEND_ATTEMPTS, DEFAULT_LIFECYCLE_TIMEOUT_MS, RETRYABLE_STATUSES, liveTransports, traceSubmissionSpanIds, replayTraceSubmissions, submissionCounter,
|
|
796
|
+
var import_api, import_core, import_resources, import_sdk_trace_base, OPERATION_ATTRIBUTE, PAYLOAD_ATTRIBUTE, OTLP_TRACES_ENDPOINT, MAX_EXPORT_REQUEST_BYTES, MAX_REQUEST_BYTES_ENV, EXPORT_CONCURRENCY_ENV, MAX_QUEUE_SIZE, DIRECT_MAX_EXPORT_BATCH_SIZE, DIRECT_MAX_REQUEST_BATCH_SIZE, DEFAULT_EXPORT_CONCURRENCY, MAX_EXPORT_CONCURRENCY, SCHEDULE_DELAY_MILLIS, EXPORT_TIMEOUT_MILLIS, RETRY_DELAY_MILLIS, MAX_SEND_ATTEMPTS, DEFAULT_LIFECYCLE_TIMEOUT_MS, RETRYABLE_STATUSES, liveTransports, traceSubmissionSpanIds, replayTraceSubmissions, submissionCounter, SPAN_SEPARATOR_BYTES, OtlpPayloadTooLargeError, OtlpPartialSuccessError, BitfabSpanExporter, DeliveryTrackingExporter, OtelBatchTransport;
|
|
574
797
|
var init_otel = __esm({
|
|
575
798
|
"src/otel.ts"() {
|
|
576
799
|
"use strict";
|
|
@@ -580,6 +803,7 @@ var init_otel = __esm({
|
|
|
580
803
|
import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
581
804
|
init_constants();
|
|
582
805
|
init_errors();
|
|
806
|
+
init_payloadBudget();
|
|
583
807
|
init_readEnv();
|
|
584
808
|
init_serializePayload();
|
|
585
809
|
init_unrefTimer();
|
|
@@ -605,7 +829,6 @@ var init_otel = __esm({
|
|
|
605
829
|
traceSubmissionSpanIds = /* @__PURE__ */ new Map();
|
|
606
830
|
replayTraceSubmissions = /* @__PURE__ */ new Set();
|
|
607
831
|
submissionCounter = 0;
|
|
608
|
-
textEncoder = typeof TextEncoder === "undefined" ? void 0 : new TextEncoder();
|
|
609
832
|
SPAN_SEPARATOR_BYTES = 1;
|
|
610
833
|
OtlpPayloadTooLargeError = class extends Error {
|
|
611
834
|
};
|
|
@@ -715,7 +938,7 @@ var init_otel = __esm({
|
|
|
715
938
|
body,
|
|
716
939
|
EXPORT_TIMEOUT_MILLIS
|
|
717
940
|
);
|
|
718
|
-
const partialSuccess =
|
|
941
|
+
const partialSuccess = asRecord2(response?.partialSuccess);
|
|
719
942
|
const rejected = partialSuccess?.rejectedSpans;
|
|
720
943
|
if (rejected !== void 0 && rejected !== "0" && rejected !== 0) {
|
|
721
944
|
logError(
|
|
@@ -953,6 +1176,7 @@ var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCL
|
|
|
953
1176
|
var init_http = __esm({
|
|
954
1177
|
"src/http.ts"() {
|
|
955
1178
|
"use strict";
|
|
1179
|
+
init_compress();
|
|
956
1180
|
init_constants();
|
|
957
1181
|
init_errors();
|
|
958
1182
|
init_replayContext();
|
|
@@ -1109,14 +1333,20 @@ var init_http = __esm({
|
|
|
1109
1333
|
const method = options?.method ?? "POST";
|
|
1110
1334
|
const controller = new AbortController();
|
|
1111
1335
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1336
|
+
const prepared = encodeRequestBody(body);
|
|
1337
|
+
const encoded = prepared instanceof Promise ? await prepared : prepared;
|
|
1338
|
+
const headers = {
|
|
1339
|
+
"Content-Type": "application/json",
|
|
1340
|
+
Authorization: `Bearer ${this.resolveApiKey() ?? ""}`
|
|
1341
|
+
};
|
|
1342
|
+
if (encoded.contentEncoding) {
|
|
1343
|
+
headers["Content-Encoding"] = encoded.contentEncoding;
|
|
1344
|
+
}
|
|
1112
1345
|
try {
|
|
1113
1346
|
const response = await fetch(url, {
|
|
1114
1347
|
method,
|
|
1115
|
-
headers
|
|
1116
|
-
|
|
1117
|
-
Authorization: `Bearer ${this.resolveApiKey() ?? ""}`
|
|
1118
|
-
},
|
|
1119
|
-
body,
|
|
1348
|
+
headers,
|
|
1349
|
+
body: encoded.body,
|
|
1120
1350
|
signal: controller.signal
|
|
1121
1351
|
});
|
|
1122
1352
|
if (!response.ok) {
|
|
@@ -1565,9 +1795,10 @@ var init_serialize = __esm({
|
|
|
1565
1795
|
"src/serialize.ts"() {
|
|
1566
1796
|
"use strict";
|
|
1567
1797
|
import_superjson = __toESM(require("superjson"), 1);
|
|
1798
|
+
init_payloadBudget();
|
|
1568
1799
|
init_warnOnce();
|
|
1569
|
-
MAX_SERIALIZED_BYTES =
|
|
1570
|
-
MAX_FRAMEWORK_SERIALIZED_BYTES =
|
|
1800
|
+
MAX_SERIALIZED_BYTES = MAX_SPAN_CARRIER_BYTES;
|
|
1801
|
+
MAX_FRAMEWORK_SERIALIZED_BYTES = MAX_SPAN_CARRIER_BYTES;
|
|
1571
1802
|
MAX_SAFE_DEPTH = 6;
|
|
1572
1803
|
}
|
|
1573
1804
|
});
|