brass-runtime 1.18.1 → 1.19.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/CHANGELOG.md +65 -0
- package/dist/agent/cli/main.cjs +31 -31
- package/dist/agent/cli/main.js +3 -3
- package/dist/agent/cli/main.mjs +3 -3
- package/dist/agent/index.cjs +4 -4
- package/dist/agent/index.js +3 -3
- package/dist/agent/index.mjs +3 -3
- package/dist/{chunk-22HZQG5F.js → chunk-2R3RVNS2.js} +6 -6
- package/dist/{chunk-YWLLH27R.mjs → chunk-3NKXUX4T.mjs} +2 -2
- package/dist/{chunk-IPSMXUWA.js → chunk-4PKBNG2H.js} +38 -18
- package/dist/{chunk-Z3ZZMQUZ.mjs → chunk-5RVHSBJ6.mjs} +182 -34
- package/dist/{chunk-B5FKOLTB.mjs → chunk-5UBJT4RW.mjs} +4 -4
- package/dist/{chunk-5RZ7YITF.cjs → chunk-6STX4PS3.cjs} +13 -13
- package/dist/{chunk-XPIMJQYS.cjs → chunk-7FZUTJM3.cjs} +400 -252
- package/dist/{chunk-YZ5LQ32F.js → chunk-A6EG5WRL.js} +3 -3
- package/dist/{chunk-TTSPIU3U.js → chunk-APQBU7TM.js} +53 -32
- package/dist/{chunk-BC6Q6BCO.mjs → chunk-AQQQFNYD.mjs} +38 -18
- package/dist/{chunk-OW5VHAOE.js → chunk-B2VXVNIS.js} +1 -1
- package/dist/{chunk-WCBNXPN6.mjs → chunk-BLXBZ6RE.mjs} +1 -1
- package/dist/{chunk-7VQLEN37.js → chunk-C3CWI42G.js} +1 -1
- package/dist/{chunk-WI7GZF3B.cjs → chunk-DV644N7P.cjs} +85 -85
- package/dist/{chunk-RBHNOKH4.mjs → chunk-EKLEDIVJ.mjs} +2 -2
- package/dist/{chunk-S4HXADU4.js → chunk-EXBGIC66.js} +1 -1
- package/dist/{chunk-LSYQ3C2M.js → chunk-FC5N5QHJ.js} +2 -2
- package/dist/{chunk-6MLAZPBL.mjs → chunk-FNWOH2T2.js} +18 -6
- package/dist/{chunk-WGE2FEZE.cjs → chunk-FYWWU3Z7.cjs} +2 -2
- package/dist/{chunk-2OW6IFY2.cjs → chunk-GOEO763K.cjs} +21 -21
- package/dist/{chunk-UAKAF32U.js → chunk-GXOIUBKE.js} +2 -2
- package/dist/{chunk-7DU7IQHK.js → chunk-H4ZRUQZL.js} +4 -4
- package/dist/{chunk-JWIEMBE6.mjs → chunk-HW2CLRJ3.mjs} +6 -6
- package/dist/{chunk-YGR2IN4R.js → chunk-JWFOWPMB.js} +163 -155
- package/dist/{chunk-6V2AWT4R.mjs → chunk-KAPZHDO4.mjs} +1 -1
- package/dist/{chunk-EEN5OTCR.mjs → chunk-KDXNWGPB.mjs} +1 -1
- package/dist/{chunk-UUMKZJRJ.cjs → chunk-KPOL2YEO.cjs} +18 -6
- package/dist/{chunk-J6DUHITE.cjs → chunk-MA74OYCI.cjs} +6 -6
- package/dist/{chunk-H626ZTDZ.mjs → chunk-MUMBUXU6.mjs} +53 -32
- package/dist/{chunk-5LC7V2OZ.cjs → chunk-NQW3YUFN.cjs} +18 -18
- package/dist/{chunk-EICAJDNX.cjs → chunk-OO7BGCC3.cjs} +54 -34
- package/dist/{chunk-7GBJYOX7.mjs → chunk-OX6MF7SZ.mjs} +163 -155
- package/dist/{chunk-WVSZOPGQ.cjs → chunk-QBVS3UYN.cjs} +245 -237
- package/dist/{chunk-WUDHOZIH.js → chunk-RZGB3DXR.js} +182 -34
- package/dist/{chunk-COOW7BJX.mjs → chunk-URVS2OE2.mjs} +3 -3
- package/dist/{chunk-HCJ4S3YB.js → chunk-UZQ3BB6W.mjs} +18 -6
- package/dist/{chunk-KNTJ7FQB.cjs → chunk-YQWZ7FZX.cjs} +5 -5
- package/dist/{chunk-ELIECDYN.cjs → chunk-Z2YIDHRI.cjs} +5 -5
- package/dist/{chunk-2JHJ4YHS.cjs → chunk-ZDZNV6NA.cjs} +59 -38
- package/dist/core/index.cjs +8 -8
- package/dist/core/index.js +7 -7
- package/dist/core/index.mjs +7 -7
- package/dist/http/index.cjs +54 -54
- package/dist/http/index.js +7 -7
- package/dist/http/index.mjs +7 -7
- package/dist/http/testing.cjs +9 -9
- package/dist/http/testing.js +5 -5
- package/dist/http/testing.mjs +5 -5
- package/dist/index.cjs +86 -86
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/dist/observability/index.cjs +10 -10
- package/dist/observability/index.js +9 -9
- package/dist/observability/index.mjs +9 -9
- package/dist/perf/cli.cjs +26 -26
- package/dist/perf/cli.js +11 -11
- package/dist/perf/cli.mjs +11 -11
- package/dist/perf/index.cjs +13 -13
- package/dist/perf/index.js +11 -11
- package/dist/perf/index.mjs +11 -11
- package/dist/schema/index.cjs +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
EventBus,
|
|
3
3
|
InMemoryTracer,
|
|
4
4
|
makeMetrics
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-B2VXVNIS.js";
|
|
6
6
|
import {
|
|
7
7
|
Runtime,
|
|
8
8
|
ctxExtend,
|
|
9
9
|
ctxToObject,
|
|
10
10
|
emptyContext,
|
|
11
11
|
getCurrentFiber
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-APQBU7TM.js";
|
|
13
13
|
import {
|
|
14
14
|
asyncFail,
|
|
15
15
|
asyncFlatMap,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
Schema,
|
|
22
22
|
parseConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FNWOH2T2.js";
|
|
24
24
|
|
|
25
25
|
// src/observability/health.ts
|
|
26
26
|
function snapshotRuntimeHealth(options = {}) {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
Schema,
|
|
12
12
|
parseConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FNWOH2T2.js";
|
|
14
14
|
|
|
15
15
|
// src/core/runtime/ringBuffer.ts
|
|
16
16
|
var PushStatus = /* @__PURE__ */ ((PushStatus3) => {
|
|
@@ -3029,32 +3029,43 @@ var NativeTopLevelRunner = class {
|
|
|
3029
3029
|
constructor(runtime, effect, cb) {
|
|
3030
3030
|
this.runtime = runtime;
|
|
3031
3031
|
this.current = effect;
|
|
3032
|
-
this.
|
|
3033
|
-
this.frame = {
|
|
3034
|
-
id: 0,
|
|
3035
|
-
runtime,
|
|
3036
|
-
name: "native-fast-path",
|
|
3037
|
-
fiberContext: { trace: null },
|
|
3038
|
-
lane: runtime.lane,
|
|
3039
|
-
status: () => this.result ? "Done" : "Running",
|
|
3040
|
-
join: (joiner) => {
|
|
3041
|
-
if (this.result) joiner(this.result);
|
|
3042
|
-
else this.joiners.push(joiner);
|
|
3043
|
-
},
|
|
3044
|
-
interrupt: () => void 0,
|
|
3045
|
-
addFinalizer: (finalizer) => {
|
|
3046
|
-
this.finalizers.push(finalizer);
|
|
3047
|
-
}
|
|
3048
|
-
};
|
|
3032
|
+
this.firstJoiner = cb;
|
|
3049
3033
|
}
|
|
3050
3034
|
runtime;
|
|
3051
3035
|
current;
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3036
|
+
// Lazy-allocated — most requests don't need these
|
|
3037
|
+
stack;
|
|
3038
|
+
joiners;
|
|
3039
|
+
finalizers;
|
|
3055
3040
|
result;
|
|
3056
3041
|
yielded = false;
|
|
3057
|
-
|
|
3042
|
+
firstJoiner;
|
|
3043
|
+
// Frame is now the runner itself — avoids allocating a separate frame object
|
|
3044
|
+
// with 4 closures per request. We implement the Fiber-like interface inline.
|
|
3045
|
+
id = 0;
|
|
3046
|
+
name = "native-fast-path";
|
|
3047
|
+
fiberContext = { trace: null };
|
|
3048
|
+
get lane() {
|
|
3049
|
+
return this.runtime.lane;
|
|
3050
|
+
}
|
|
3051
|
+
// Fiber-like interface methods (used by frame consumers)
|
|
3052
|
+
status() {
|
|
3053
|
+
return this.result ? "Done" : "Running";
|
|
3054
|
+
}
|
|
3055
|
+
join(joiner) {
|
|
3056
|
+
if (this.result) {
|
|
3057
|
+
joiner(this.result);
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
if (!this.joiners) this.joiners = [];
|
|
3061
|
+
this.joiners.push(joiner);
|
|
3062
|
+
}
|
|
3063
|
+
interrupt() {
|
|
3064
|
+
}
|
|
3065
|
+
addFinalizer(finalizer) {
|
|
3066
|
+
if (!this.finalizers) this.finalizers = [];
|
|
3067
|
+
this.finalizers.push(finalizer);
|
|
3068
|
+
}
|
|
3058
3069
|
start() {
|
|
3059
3070
|
this.runLoop();
|
|
3060
3071
|
}
|
|
@@ -3079,10 +3090,12 @@ var NativeTopLevelRunner = class {
|
|
|
3079
3090
|
}
|
|
3080
3091
|
break;
|
|
3081
3092
|
case "FlatMap":
|
|
3093
|
+
if (!this.stack) this.stack = [];
|
|
3082
3094
|
this.stack.push({ _tag: "SuccessCont", k: current.andThen });
|
|
3083
3095
|
this.current = current.first;
|
|
3084
3096
|
break;
|
|
3085
3097
|
case "Fold":
|
|
3098
|
+
if (!this.stack) this.stack = [];
|
|
3086
3099
|
this.stack.push({
|
|
3087
3100
|
_tag: "FoldCont",
|
|
3088
3101
|
onFailure: current.onFailure,
|
|
@@ -3097,10 +3110,12 @@ var NativeTopLevelRunner = class {
|
|
|
3097
3110
|
this.onSuccess(this.runtime.fork(current.effect, current.scopeId));
|
|
3098
3111
|
break;
|
|
3099
3112
|
case "Interruptibility":
|
|
3113
|
+
if (!this.stack) this.stack = [];
|
|
3100
3114
|
this.stack.push({ _tag: "InterruptibilityCont" });
|
|
3101
3115
|
this.current = current.effect;
|
|
3102
3116
|
break;
|
|
3103
3117
|
case "InterruptibilityMask":
|
|
3118
|
+
if (!this.stack) this.stack = [];
|
|
3104
3119
|
this.stack.push({ _tag: "InterruptibilityCont" });
|
|
3105
3120
|
try {
|
|
3106
3121
|
this.current = current.body((effect) => ({
|
|
@@ -3113,6 +3128,7 @@ var NativeTopLevelRunner = class {
|
|
|
3113
3128
|
}
|
|
3114
3129
|
break;
|
|
3115
3130
|
case "InterruptibilityRestore":
|
|
3131
|
+
if (!this.stack) this.stack = [];
|
|
3116
3132
|
this.stack.push({ _tag: "InterruptibilityCont" });
|
|
3117
3133
|
this.current = current.effect;
|
|
3118
3134
|
break;
|
|
@@ -3121,6 +3137,7 @@ var NativeTopLevelRunner = class {
|
|
|
3121
3137
|
const hadValue = refs.has(current.refId);
|
|
3122
3138
|
const previousValue = refs.get(current.refId);
|
|
3123
3139
|
refs.set(current.refId, current.value);
|
|
3140
|
+
if (!this.stack) this.stack = [];
|
|
3124
3141
|
this.stack.push({
|
|
3125
3142
|
_tag: "FiberRefCont",
|
|
3126
3143
|
refId: current.refId,
|
|
@@ -3179,7 +3196,7 @@ var NativeTopLevelRunner = class {
|
|
|
3179
3196
|
onSuccess(value) {
|
|
3180
3197
|
let currentValue = value;
|
|
3181
3198
|
while (true) {
|
|
3182
|
-
const frame = this.stack.pop();
|
|
3199
|
+
const frame = this.stack ? this.stack.pop() : void 0;
|
|
3183
3200
|
if (!frame) {
|
|
3184
3201
|
this.notify(Exit.succeed(currentValue));
|
|
3185
3202
|
return;
|
|
@@ -3207,7 +3224,7 @@ var NativeTopLevelRunner = class {
|
|
|
3207
3224
|
}
|
|
3208
3225
|
onCause(cause) {
|
|
3209
3226
|
let currentCause = cause;
|
|
3210
|
-
while (this.stack.length > 0) {
|
|
3227
|
+
while (this.stack && this.stack.length > 0) {
|
|
3211
3228
|
const frame = this.stack.pop();
|
|
3212
3229
|
if (frame._tag === "InterruptibilityCont") continue;
|
|
3213
3230
|
if (frame._tag === "FiberRefCont") {
|
|
@@ -3232,13 +3249,17 @@ var NativeTopLevelRunner = class {
|
|
|
3232
3249
|
notify(exit) {
|
|
3233
3250
|
if (this.result) return;
|
|
3234
3251
|
this.result = exit;
|
|
3235
|
-
this.runFinalizers(exit);
|
|
3236
|
-
|
|
3237
|
-
this.joiners
|
|
3252
|
+
if (this.finalizers) this.runFinalizers(exit);
|
|
3253
|
+
this.firstJoiner(exit);
|
|
3254
|
+
if (this.joiners) {
|
|
3255
|
+
for (const joiner of this.joiners) joiner(exit);
|
|
3256
|
+
this.joiners.length = 0;
|
|
3257
|
+
}
|
|
3238
3258
|
}
|
|
3239
3259
|
runFinalizers(exit) {
|
|
3240
|
-
|
|
3241
|
-
|
|
3260
|
+
const finalizers = this.finalizers;
|
|
3261
|
+
while (finalizers.length > 0) {
|
|
3262
|
+
const finalizer = finalizers.pop();
|
|
3242
3263
|
try {
|
|
3243
3264
|
const result = finalizer(exit);
|
|
3244
3265
|
if (result && typeof result === "object" && "_tag" in result) {
|
|
@@ -3249,8 +3270,8 @@ var NativeTopLevelRunner = class {
|
|
|
3249
3270
|
}
|
|
3250
3271
|
}
|
|
3251
3272
|
fiberRefs() {
|
|
3252
|
-
this.
|
|
3253
|
-
return this.
|
|
3273
|
+
this.fiberContext.fiberRefs ??= /* @__PURE__ */ new Map();
|
|
3274
|
+
return this.fiberContext.fiberRefs;
|
|
3254
3275
|
}
|
|
3255
3276
|
restoreFiberRef(frame) {
|
|
3256
3277
|
const refs = this.fiberRefs();
|
|
@@ -3258,7 +3279,7 @@ var NativeTopLevelRunner = class {
|
|
|
3258
3279
|
else refs.delete(frame.refId);
|
|
3259
3280
|
}
|
|
3260
3281
|
withFrame(body) {
|
|
3261
|
-
return withCurrentFiber(this
|
|
3282
|
+
return withCurrentFiber(this, body);
|
|
3262
3283
|
}
|
|
3263
3284
|
};
|
|
3264
3285
|
function fork(effect, env) {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getCurrentFiber,
|
|
7
7
|
unsafeGetCurrentRuntime,
|
|
8
8
|
unsafeRunFoldWithEnv
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MUMBUXU6.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Cause,
|
|
12
12
|
Exit,
|
|
@@ -412,31 +412,49 @@ function drainStreamSyncFull(stream) {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
+
var ABORTED_ERROR = (() => {
|
|
416
|
+
if (typeof DOMException === "function") {
|
|
417
|
+
try {
|
|
418
|
+
return new DOMException("aborted", "AbortError");
|
|
419
|
+
} catch {
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const e = new Error("aborted");
|
|
423
|
+
e.name = "AbortError";
|
|
424
|
+
return e;
|
|
425
|
+
})();
|
|
415
426
|
function readerStream(reader, normalizeError, signal) {
|
|
427
|
+
const noopSignal = globalThis.__brassNoopSignal;
|
|
428
|
+
const needsSignalListener = signal !== void 0 && signal !== noopSignal;
|
|
416
429
|
const pull = asyncEffect((_, cb) => {
|
|
417
430
|
let done = false;
|
|
418
|
-
|
|
431
|
+
let abortFn;
|
|
419
432
|
const finish = (exit) => {
|
|
420
433
|
if (done) return;
|
|
421
434
|
done = true;
|
|
422
|
-
|
|
435
|
+
if (needsSignalListener && abortFn) signal.removeEventListener("abort", abortFn);
|
|
423
436
|
cb(exit);
|
|
424
437
|
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
438
|
+
if (needsSignalListener) {
|
|
439
|
+
if (signal.aborted) {
|
|
440
|
+
try {
|
|
441
|
+
reader.cancel();
|
|
442
|
+
} catch {
|
|
443
|
+
}
|
|
444
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: some(normalizeError(ABORTED_ERROR)) } });
|
|
445
|
+
return;
|
|
429
446
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
447
|
+
abortFn = () => {
|
|
448
|
+
try {
|
|
449
|
+
reader.cancel();
|
|
450
|
+
} catch {
|
|
451
|
+
}
|
|
452
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: some(normalizeError(ABORTED_ERROR)) } });
|
|
453
|
+
};
|
|
454
|
+
signal.addEventListener("abort", abortFn, { once: true });
|
|
436
455
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (done2) {
|
|
456
|
+
reader.read().then(({ done: readDone, value }) => {
|
|
457
|
+
if (readDone) {
|
|
440
458
|
finish({ _tag: "Failure", cause: { _tag: "Fail", error: none } });
|
|
441
459
|
return;
|
|
442
460
|
}
|
|
@@ -444,11 +462,13 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
444
462
|
_tag: "Success",
|
|
445
463
|
value: [value, fromPull(pull)]
|
|
446
464
|
});
|
|
447
|
-
}
|
|
465
|
+
}, (e) => {
|
|
448
466
|
finish({ _tag: "Failure", cause: { _tag: "Fail", error: some(normalizeError(e)) } });
|
|
449
467
|
});
|
|
450
468
|
return () => {
|
|
451
|
-
|
|
469
|
+
if (done) return;
|
|
470
|
+
done = true;
|
|
471
|
+
if (needsSignalListener && abortFn) signal.removeEventListener("abort", abortFn);
|
|
452
472
|
try {
|
|
453
473
|
reader.cancel();
|
|
454
474
|
} catch {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkFYWWU3Z7cjs = require('./chunk-FYWWU3Z7.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkZDZNV6NAcjs = require('./chunk-ZDZNV6NA.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkKPOL2YEOcjs = require('./chunk-KPOL2YEO.cjs');
|
|
24
24
|
|
|
25
25
|
// src/observability/health.ts
|
|
26
26
|
function snapshotRuntimeHealth(options = {}) {
|
|
@@ -796,10 +796,10 @@ function makeOtlpHttpLogExporter(source, options) {
|
|
|
796
796
|
}
|
|
797
797
|
function logEffect(level, message, fields = {}) {
|
|
798
798
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
799
|
-
const fiber =
|
|
799
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
800
800
|
const runtime = _optionalChain([fiber, 'optionalAccess', _34 => _34.runtime]);
|
|
801
801
|
if (!runtime) return;
|
|
802
|
-
const inherited = _optionalChain([fiber, 'access', _35 => _35.fiberContext, 'optionalAccess', _36 => _36.log]) ?
|
|
802
|
+
const inherited = _optionalChain([fiber, 'access', _35 => _35.fiberContext, 'optionalAccess', _36 => _36.log]) ? _chunkZDZNV6NAcjs.ctxToObject.call(void 0, fiber.fiberContext.log) : {};
|
|
803
803
|
runtime.log(level, message, { ...inherited, ...fields });
|
|
804
804
|
});
|
|
805
805
|
}
|
|
@@ -815,11 +815,11 @@ function withLogContext(patch, effect) {
|
|
|
815
815
|
}
|
|
816
816
|
function startLogContext(patch) {
|
|
817
817
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
818
|
-
const fiber =
|
|
818
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
819
819
|
if (!_optionalChain([fiber, 'optionalAccess', _37 => _37.fiberContext])) return void 0;
|
|
820
|
-
const previous = _nullishCoalesce(fiber.fiberContext.log, () => (
|
|
820
|
+
const previous = _nullishCoalesce(fiber.fiberContext.log, () => ( _chunkZDZNV6NAcjs.emptyContext));
|
|
821
821
|
const state = { fiber, previous, ended: false };
|
|
822
|
-
fiber.fiberContext = { ...fiber.fiberContext, log:
|
|
822
|
+
fiber.fiberContext = { ...fiber.fiberContext, log: _chunkZDZNV6NAcjs.ctxExtend.call(void 0, previous, patch) };
|
|
823
823
|
_optionalChain([fiber, 'access', _38 => _38.addFinalizer, 'optionalCall', _39 => _39(() => restoreLogContext(state))]);
|
|
824
824
|
return state;
|
|
825
825
|
});
|
|
@@ -994,7 +994,7 @@ function spanLink(trace, attributes) {
|
|
|
994
994
|
};
|
|
995
995
|
}
|
|
996
996
|
function currentSpanLink(attributes) {
|
|
997
|
-
const fiber =
|
|
997
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
998
998
|
const trace = _optionalChain([fiber, 'optionalAccess', _46 => _46.fiberContext, 'optionalAccess', _47 => _47.trace]);
|
|
999
999
|
return _optionalChain([trace, 'optionalAccess', _48 => _48.traceId]) && _optionalChain([trace, 'optionalAccess', _49 => _49.spanId]) ? spanLink(trace, attributes) : void 0;
|
|
1000
1000
|
}
|
|
@@ -1009,13 +1009,13 @@ function withBaggage(baggage, effect) {
|
|
|
1009
1009
|
);
|
|
1010
1010
|
}
|
|
1011
1011
|
function currentBaggage() {
|
|
1012
|
-
const fiber =
|
|
1012
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
1013
1013
|
const baggage = _optionalChain([fiber, 'optionalAccess', _50 => _50.fiberContext, 'optionalAccess', _51 => _51.trace, 'optionalAccess', _52 => _52.baggage]);
|
|
1014
1014
|
return baggage ? { ...baggage } : void 0;
|
|
1015
1015
|
}
|
|
1016
1016
|
function spanEvent(name, attributes = {}) {
|
|
1017
1017
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1018
|
-
const fiber =
|
|
1018
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
1019
1019
|
const trace = _optionalChain([fiber, 'optionalAccess', _53 => _53.fiberContext, 'optionalAccess', _54 => _54.trace]);
|
|
1020
1020
|
if (!_optionalChain([fiber, 'optionalAccess', _55 => _55.runtime]) || !trace || trace.sampled === false) return;
|
|
1021
1021
|
fiber.runtime.hooks.emit(
|
|
@@ -1049,7 +1049,7 @@ function makeOtlpHttpSpanExporter(source, options) {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
function startSpan(name, options) {
|
|
1051
1051
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1052
|
-
const fiber =
|
|
1052
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
1053
1053
|
const runtime = _optionalChain([fiber, 'optionalAccess', _56 => _56.runtime]);
|
|
1054
1054
|
if (!_optionalChain([fiber, 'optionalAccess', _57 => _57.fiberContext]) || !runtime) return void 0;
|
|
1055
1055
|
const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
|
|
@@ -1132,7 +1132,7 @@ function spanContext(fiber, trace) {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
function startBaggage(baggage) {
|
|
1134
1134
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1135
|
-
const fiber =
|
|
1135
|
+
const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
|
|
1136
1136
|
if (!_optionalChain([fiber, 'optionalAccess', _76 => _76.fiberContext])) return void 0;
|
|
1137
1137
|
const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
|
|
1138
1138
|
if (!previousTrace) return void 0;
|
|
@@ -1474,54 +1474,54 @@ function sanitizeHttpTarget(url) {
|
|
|
1474
1474
|
}
|
|
1475
1475
|
|
|
1476
1476
|
// src/observability/configValidation.ts
|
|
1477
|
-
var fn =
|
|
1478
|
-
var object =
|
|
1477
|
+
var fn = _chunkKPOL2YEOcjs.Schema.custom((value) => typeof value === "function", "function");
|
|
1478
|
+
var object = _chunkKPOL2YEOcjs.Schema.custom(
|
|
1479
1479
|
(value) => typeof value === "object" && value !== null && !Array.isArray(value),
|
|
1480
1480
|
"object"
|
|
1481
1481
|
);
|
|
1482
|
-
var falseOrObject =
|
|
1483
|
-
var ratio =
|
|
1484
|
-
var logLevel =
|
|
1485
|
-
var retryOptions =
|
|
1486
|
-
attempts:
|
|
1487
|
-
initialDelayMs:
|
|
1488
|
-
maxDelayMs:
|
|
1489
|
-
jitterRatio:
|
|
1482
|
+
var falseOrObject = _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.literal(false), object]);
|
|
1483
|
+
var ratio = _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 });
|
|
1484
|
+
var logLevel = _chunkKPOL2YEOcjs.Schema.enum(["debug", "info", "warn", "error"]);
|
|
1485
|
+
var retryOptions = _chunkKPOL2YEOcjs.Schema.object({
|
|
1486
|
+
attempts: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1487
|
+
initialDelayMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1488
|
+
maxDelayMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1489
|
+
jitterRatio: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).optional(),
|
|
1490
1490
|
sleep: fn.optional()
|
|
1491
1491
|
}, { unknownKeys: "passthrough" });
|
|
1492
|
-
var pipelineOptions =
|
|
1493
|
-
maxQueueSize:
|
|
1494
|
-
batchSize:
|
|
1495
|
-
timeoutMs:
|
|
1492
|
+
var pipelineOptions = _chunkKPOL2YEOcjs.Schema.object({
|
|
1493
|
+
maxQueueSize: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1494
|
+
batchSize: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1495
|
+
timeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1496
1496
|
retry: retryOptions.optional(),
|
|
1497
|
-
dropPolicy:
|
|
1498
|
-
shutdownTimeoutMs:
|
|
1497
|
+
dropPolicy: _chunkKPOL2YEOcjs.Schema.enum(["drop-oldest", "drop-newest"]).optional(),
|
|
1498
|
+
shutdownTimeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional()
|
|
1499
1499
|
}, { unknownKeys: "passthrough" });
|
|
1500
|
-
var otlpOptions =
|
|
1501
|
-
metricsUrl:
|
|
1502
|
-
tracesUrl:
|
|
1503
|
-
logsUrl:
|
|
1504
|
-
headers:
|
|
1500
|
+
var otlpOptions = _chunkKPOL2YEOcjs.Schema.object({
|
|
1501
|
+
metricsUrl: _chunkKPOL2YEOcjs.Schema.string().optional(),
|
|
1502
|
+
tracesUrl: _chunkKPOL2YEOcjs.Schema.string().optional(),
|
|
1503
|
+
logsUrl: _chunkKPOL2YEOcjs.Schema.string().optional(),
|
|
1504
|
+
headers: _chunkKPOL2YEOcjs.Schema.record(_chunkKPOL2YEOcjs.Schema.string()).optional(),
|
|
1505
1505
|
fetch: fn.optional(),
|
|
1506
|
-
timeoutMs:
|
|
1506
|
+
timeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1507
1507
|
retry: retryOptions.optional(),
|
|
1508
1508
|
pipeline: pipelineOptions.optional()
|
|
1509
1509
|
}, { unknownKeys: "passthrough" });
|
|
1510
|
-
var samplingOptions =
|
|
1511
|
-
|
|
1510
|
+
var samplingOptions = _chunkKPOL2YEOcjs.Schema.union([
|
|
1511
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
1512
1512
|
ratio,
|
|
1513
1513
|
fn,
|
|
1514
|
-
|
|
1514
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
1515
1515
|
ratio: ratio.optional(),
|
|
1516
|
-
rules:
|
|
1517
|
-
sampler:
|
|
1518
|
-
respectRemoteSampled:
|
|
1519
|
-
forceSampleOnError:
|
|
1516
|
+
rules: _chunkKPOL2YEOcjs.Schema.array(object).optional(),
|
|
1517
|
+
sampler: _chunkKPOL2YEOcjs.Schema.union([fn, object]).optional(),
|
|
1518
|
+
respectRemoteSampled: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1519
|
+
forceSampleOnError: _chunkKPOL2YEOcjs.Schema.boolean().optional()
|
|
1520
1520
|
}, { unknownKeys: "passthrough" })
|
|
1521
1521
|
]);
|
|
1522
|
-
var observabilityOptions =
|
|
1523
|
-
serviceName:
|
|
1524
|
-
serviceVersion:
|
|
1522
|
+
var observabilityOptions = _chunkKPOL2YEOcjs.Schema.object({
|
|
1523
|
+
serviceName: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional(),
|
|
1524
|
+
serviceVersion: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional(),
|
|
1525
1525
|
resource: object.optional(),
|
|
1526
1526
|
eventBus: object.optional(),
|
|
1527
1527
|
metrics: falseOrObject.optional(),
|
|
@@ -1529,64 +1529,64 @@ var observabilityOptions = _chunkUUMKZJRJcjs.Schema.object({
|
|
|
1529
1529
|
traces: falseOrObject.optional(),
|
|
1530
1530
|
sampling: samplingOptions.optional(),
|
|
1531
1531
|
redaction: falseOrObject.optional(),
|
|
1532
|
-
cardinality:
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
maxValuesPerLabel:
|
|
1536
|
-
overflowValue:
|
|
1532
|
+
cardinality: _chunkKPOL2YEOcjs.Schema.union([
|
|
1533
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
1534
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
1535
|
+
maxValuesPerLabel: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1536
|
+
overflowValue: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional()
|
|
1537
1537
|
}, { unknownKeys: "passthrough" })
|
|
1538
1538
|
]).optional(),
|
|
1539
1539
|
otlp: otlpOptions.optional(),
|
|
1540
|
-
flushIntervalMs:
|
|
1541
|
-
autoStart:
|
|
1540
|
+
flushIntervalMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1541
|
+
autoStart: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1542
1542
|
traceSeed: object.optional(),
|
|
1543
1543
|
childName: fn.optional(),
|
|
1544
1544
|
onFlushError: fn.optional()
|
|
1545
1545
|
}, { unknownKeys: "passthrough" });
|
|
1546
|
-
var httpObservabilityOptions =
|
|
1546
|
+
var httpObservabilityOptions = _chunkKPOL2YEOcjs.Schema.object({
|
|
1547
1547
|
metrics: falseOrObject.optional(),
|
|
1548
|
-
logs:
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
requestLevel:
|
|
1552
|
-
responseLevel:
|
|
1553
|
-
errorLevel:
|
|
1548
|
+
logs: _chunkKPOL2YEOcjs.Schema.union([
|
|
1549
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
1550
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
1551
|
+
requestLevel: _chunkKPOL2YEOcjs.Schema.union([logLevel, _chunkKPOL2YEOcjs.Schema.literal(false)]).optional(),
|
|
1552
|
+
responseLevel: _chunkKPOL2YEOcjs.Schema.union([logLevel, _chunkKPOL2YEOcjs.Schema.literal(false)]).optional(),
|
|
1553
|
+
errorLevel: _chunkKPOL2YEOcjs.Schema.union([logLevel, _chunkKPOL2YEOcjs.Schema.literal(false)]).optional()
|
|
1554
1554
|
}, { unknownKeys: "passthrough" })
|
|
1555
1555
|
]).optional(),
|
|
1556
|
-
spans:
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
name:
|
|
1560
|
-
attributes:
|
|
1561
|
-
events:
|
|
1556
|
+
spans: _chunkKPOL2YEOcjs.Schema.union([
|
|
1557
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
1558
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
1559
|
+
name: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }), fn]).optional(),
|
|
1560
|
+
attributes: _chunkKPOL2YEOcjs.Schema.union([object, fn]).optional(),
|
|
1561
|
+
events: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1562
1562
|
sampleRate: ratio.optional()
|
|
1563
1563
|
}, { unknownKeys: "passthrough" })
|
|
1564
1564
|
]).optional(),
|
|
1565
|
-
adaptiveLimiter:
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
enabled:
|
|
1569
|
-
includeKeyLabel:
|
|
1565
|
+
adaptiveLimiter: _chunkKPOL2YEOcjs.Schema.union([
|
|
1566
|
+
_chunkKPOL2YEOcjs.Schema.boolean(),
|
|
1567
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
1568
|
+
enabled: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1569
|
+
includeKeyLabel: _chunkKPOL2YEOcjs.Schema.boolean().optional()
|
|
1570
1570
|
}, { unknownKeys: "passthrough" })
|
|
1571
1571
|
]).optional(),
|
|
1572
|
-
policy:
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
enabled:
|
|
1576
|
-
labelKeys:
|
|
1572
|
+
policy: _chunkKPOL2YEOcjs.Schema.union([
|
|
1573
|
+
_chunkKPOL2YEOcjs.Schema.boolean(),
|
|
1574
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
1575
|
+
enabled: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1576
|
+
labelKeys: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.enum(["preset", "lane", "poolKey", "dedupKey", "priority", "retry"])).optional()
|
|
1577
1577
|
}, { unknownKeys: "passthrough" })
|
|
1578
1578
|
]).optional(),
|
|
1579
|
-
injectTraceHeaders:
|
|
1580
|
-
includeHostLabel:
|
|
1581
|
-
route:
|
|
1579
|
+
injectTraceHeaders: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1580
|
+
includeHostLabel: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
1581
|
+
route: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }), fn]).optional(),
|
|
1582
1582
|
clock: fn.optional(),
|
|
1583
|
-
durationBuckets:
|
|
1583
|
+
durationBuckets: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.number({ min: 0 }).refine((n) => n > 0, "duration bucket must be > 0")).optional()
|
|
1584
1584
|
}, { unknownKeys: "passthrough" });
|
|
1585
1585
|
function validateObservabilityOptions(options) {
|
|
1586
|
-
|
|
1586
|
+
_chunkKPOL2YEOcjs.parseConfig.call(void 0, "ObservabilityOptions", observabilityOptions, options);
|
|
1587
1587
|
}
|
|
1588
1588
|
function validateHttpObservabilityOptions(options) {
|
|
1589
|
-
|
|
1589
|
+
_chunkKPOL2YEOcjs.parseConfig.call(void 0, "HttpObservabilityOptions", httpObservabilityOptions, options);
|
|
1590
1590
|
}
|
|
1591
1591
|
|
|
1592
1592
|
// src/observability/setup.ts
|
|
@@ -1620,12 +1620,12 @@ function normalizeOtlpEndpoint(endpoint) {
|
|
|
1620
1620
|
function makeObservability(options = {}) {
|
|
1621
1621
|
validateObservabilityOptions(options);
|
|
1622
1622
|
const serviceName = _nullishCoalesce(options.serviceName, () => ( "brass-runtime"));
|
|
1623
|
-
const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0,
|
|
1624
|
-
const rawMetrics =
|
|
1623
|
+
const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0, _chunkFYWWU3Z7cjs.EventBus)()));
|
|
1624
|
+
const rawMetrics = _chunkFYWWU3Z7cjs.makeMetrics.call(void 0, );
|
|
1625
1625
|
const metrics = options.cardinality === false ? rawMetrics : makeCardinalityLimitedMetrics(rawMetrics, _nullishCoalesce(options.cardinality, () => ( {})));
|
|
1626
1626
|
const redactor = makeObservabilityRedactor(options.redaction);
|
|
1627
1627
|
const traceOptions = options.traces && typeof options.traces === "object" ? options.traces : {};
|
|
1628
|
-
const tracer = new (0,
|
|
1628
|
+
const tracer = new (0, _chunkFYWWU3Z7cjs.InMemoryTracer)({
|
|
1629
1629
|
maxFinishedSpans: _nullishCoalesce(traceOptions.maxFinishedSpans, () => ( 1e4)),
|
|
1630
1630
|
maxSpanAgeMs: _nullishCoalesce(traceOptions.maxSpanAgeMs, () => ( 10 * 6e4)),
|
|
1631
1631
|
clock: traceOptions.clock,
|
|
@@ -1982,7 +1982,7 @@ function makeRequestObservabilityContext(observability, input = {}) {
|
|
|
1982
1982
|
const env = observability.envForRequest(input);
|
|
1983
1983
|
const attributes = requestSpanAttributes(input);
|
|
1984
1984
|
const defaultSpanName = _nullishCoalesce(input.spanName, () => ( (input.method && input.route ? `${input.method} ${input.route}` : _nullishCoalesce(input.route, () => ( "request")))));
|
|
1985
|
-
const makeRuntime = (extraEnv, options = {}) => new (0,
|
|
1985
|
+
const makeRuntime = (extraEnv, options = {}) => new (0, _chunkZDZNV6NAcjs.Runtime)({
|
|
1986
1986
|
...options,
|
|
1987
1987
|
env: mergeEnv(extraEnv, env),
|
|
1988
1988
|
hooks: observability.hooks
|