brass-runtime 1.16.0 → 1.17.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 +17 -0
- package/README.md +287 -23
- package/dist/agent/cli/main.cjs +38 -38
- package/dist/agent/cli/main.js +6 -6
- package/dist/agent/cli/main.mjs +6 -6
- package/dist/agent/index.cjs +7 -7
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +6 -6
- package/dist/agent/index.mjs +6 -6
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-7XOPAB5Q.js → chunk-4P2HHGAX.mjs} +83 -5
- package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
- package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
- package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
- package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-6RY2FFN4.mjs +2024 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
- package/dist/chunk-7X3K5RMS.js +2024 -0
- package/dist/chunk-7ZPEZ57L.cjs +2024 -0
- package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/{chunk-F5EUMJL7.mjs → chunk-BKK77SBA.js} +83 -5
- package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
- package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
- package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
- package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/chunk-F6XWZQY4.cjs +777 -0
- package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
- package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
- package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
- package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
- package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
- package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
- package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
- package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
- package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
- package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
- package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
- package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
- package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/chunk-SK7UZRNI.mjs +777 -0
- package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VWIPB6I5.js +777 -0
- package/dist/{chunk-JNFRRJYH.cjs → chunk-WBGRHGBP.cjs} +270 -192
- package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
- package/dist/core/index.cjs +135 -9
- package/dist/core/index.d.ts +238 -33
- package/dist/core/index.js +155 -29
- package/dist/core/index.mjs +155 -29
- package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
- package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
- package/dist/http/index.cjs +324 -2986
- package/dist/http/index.d.ts +54 -68
- package/dist/http/index.js +238 -2900
- package/dist/http/index.mjs +238 -2900
- package/dist/http/testing.cjs +14 -12
- package/dist/http/testing.d.ts +5 -4
- package/dist/http/testing.js +10 -8
- package/dist/http/testing.mjs +10 -8
- package/dist/index.cjs +423 -255
- package/dist/index.d.ts +87 -69
- package/dist/index.js +301 -133
- package/dist/index.mjs +301 -133
- package/dist/observability/index.cjs +18 -531
- package/dist/observability/index.d.ts +81 -8
- package/dist/observability/index.js +25 -538
- package/dist/observability/index.mjs +25 -538
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +6 -2
- package/dist/schema/index.d.ts +3 -1
- package/dist/schema/index.js +5 -1
- package/dist/schema/index.mjs +5 -1
- package/dist/{server-C8hDXA74.d.ts → server-D6JZ15_e.d.ts} +16 -4
- package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
- package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +65 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +339 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/framework-integrations.md +38 -0
- package/docs/frameworks/angular.md +153 -0
- package/docs/frameworks/express.md +125 -0
- package/docs/frameworks/fastify.md +124 -0
- package/docs/frameworks/nestjs.md +282 -0
- package/docs/frameworks/nextjs.md +147 -0
- package/docs/frameworks/react.md +139 -0
- package/docs/frameworks/vanilla.md +224 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/nestjs.md +6 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +110 -0
- package/docs/observability.md +649 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +22 -2
- package/dist/chunk-45F7OKGT.cjs +0 -104
- package/dist/chunk-7V4KY4RL.mjs +0 -104
- package/dist/chunk-DJQ7OMMB.cjs +0 -144
- package/dist/chunk-GOV47PPB.mjs +0 -552
- package/dist/chunk-JF4XXPZ5.cjs +0 -552
- package/dist/chunk-KCPT2D6G.js +0 -552
- package/dist/chunk-NOYZIMUJ.mjs +0 -144
- package/dist/chunk-PNVFW245.js +0 -144
- package/dist/chunk-ROJC3NBJ.js +0 -104
- package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
- package/dist/schedule-Fque9Abz.d.ts +0 -70
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk52PPNNI4cjs = require('./chunk-52PPNNI4.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkGLE2WY7Zcjs = require('./chunk-GLE2WY7Z.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkCZIVE6NTcjs = require('./chunk-CZIVE6NT.cjs');
|
|
24
24
|
|
|
25
25
|
// src/observability/health.ts
|
|
26
26
|
function snapshotRuntimeHealth(options = {}) {
|
|
27
|
-
const checkedAtMs = _nullishCoalesce(_optionalChain([options, 'access',
|
|
27
|
+
const checkedAtMs = _nullishCoalesce(_optionalChain([options, 'access', _2 => _2.clock, 'optionalCall', _3 => _3()]), () => ( Date.now()));
|
|
28
28
|
const checks = runChecks(options.checks);
|
|
29
29
|
const circuitBreakers = collectCircuitBreakers(options.circuitBreakers);
|
|
30
30
|
const adaptiveLimiters = collectAdaptiveLimiters(options.adaptiveLimiters);
|
|
@@ -40,7 +40,7 @@ function snapshotRuntimeHealth(options = {}) {
|
|
|
40
40
|
]);
|
|
41
41
|
return {
|
|
42
42
|
status,
|
|
43
|
-
ready: status === "ok" || status === "degraded" && _optionalChain([options, 'access',
|
|
43
|
+
ready: status === "ok" || status === "degraded" && _optionalChain([options, 'access', _4 => _4.readiness, 'optionalAccess', _5 => _5.failOnDegraded]) !== true,
|
|
44
44
|
checkedAt: new Date(checkedAtMs).toISOString(),
|
|
45
45
|
...fibers ? { fibers } : {},
|
|
46
46
|
...scopes ? { scopes } : {},
|
|
@@ -52,11 +52,11 @@ function snapshotRuntimeHealth(options = {}) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
function makeRuntimeHealth(options = {}) {
|
|
55
|
-
return
|
|
55
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => snapshotRuntimeHealth(options));
|
|
56
56
|
}
|
|
57
57
|
var runtimeHealth = makeRuntimeHealth;
|
|
58
58
|
function readiness(options = {}) {
|
|
59
|
-
return
|
|
59
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => snapshotRuntimeHealth(options).ready);
|
|
60
60
|
}
|
|
61
61
|
function healthToHttpResponse(report) {
|
|
62
62
|
return {
|
|
@@ -125,7 +125,7 @@ function scopeSummary(registry) {
|
|
|
125
125
|
}
|
|
126
126
|
function metricsSummary(metrics) {
|
|
127
127
|
const snapshot = metrics.snapshot();
|
|
128
|
-
const gaugeValue = (name) => _optionalChain([snapshot, 'access',
|
|
128
|
+
const gaugeValue = (name) => _optionalChain([snapshot, 'access', _6 => _6.gauges, 'access', _7 => _7.find, 'call', _8 => _8((gauge) => gauge.name === name), 'optionalAccess', _9 => _9.value]);
|
|
129
129
|
return {
|
|
130
130
|
counters: snapshot.counters.length,
|
|
131
131
|
gauges: snapshot.gauges.length,
|
|
@@ -136,17 +136,17 @@ function metricsSummary(metrics) {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
function runtimeSummary(runtime) {
|
|
139
|
-
const stats = _optionalChain([runtime, 'access',
|
|
140
|
-
const scheduler = _optionalChain([runtime, 'access',
|
|
139
|
+
const stats = _optionalChain([runtime, 'access', _10 => _10.stats, 'optionalCall', _11 => _11()]);
|
|
140
|
+
const scheduler = _optionalChain([runtime, 'access', _12 => _12.scheduler, 'optionalAccess', _13 => _13.stats, 'optionalCall', _14 => _14()]);
|
|
141
141
|
return {
|
|
142
|
-
engine: _optionalChain([stats, 'optionalAccess',
|
|
143
|
-
fiberStats: _optionalChain([stats, 'optionalAccess',
|
|
142
|
+
engine: _optionalChain([stats, 'optionalAccess', _15 => _15.engine]),
|
|
143
|
+
fiberStats: _optionalChain([stats, 'optionalAccess', _16 => _16.data]),
|
|
144
144
|
scheduler
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function runtimeSchedulerDropped(runtime) {
|
|
148
|
-
const data = _optionalChain([runtime, 'optionalAccess',
|
|
149
|
-
return typeof _optionalChain([data, 'optionalAccess',
|
|
148
|
+
const data = _optionalChain([runtime, 'optionalAccess', _17 => _17.scheduler, 'optionalAccess', _18 => _18.data]);
|
|
149
|
+
return typeof _optionalChain([data, 'optionalAccess', _19 => _19.droppedTasks]) === "number" ? data.droppedTasks : 0;
|
|
150
150
|
}
|
|
151
151
|
function aggregateStatus(statuses) {
|
|
152
152
|
if (statuses.includes("down")) return "down";
|
|
@@ -374,7 +374,7 @@ function readHeader(headers, name) {
|
|
|
374
374
|
return void 0;
|
|
375
375
|
}
|
|
376
376
|
function isIterableHeaders(value) {
|
|
377
|
-
return typeof _optionalChain([value, 'optionalAccess',
|
|
377
|
+
return typeof _optionalChain([value, 'optionalAccess', _20 => _20[Symbol.iterator]]) === "function";
|
|
378
378
|
}
|
|
379
379
|
function hasHeader(headers, name) {
|
|
380
380
|
const lower = name.toLowerCase();
|
|
@@ -440,14 +440,14 @@ function makePrometheusMetricsExporter(registry, options = {}) {
|
|
|
440
440
|
function formatPrometheusMetrics(snapshot, options = {}) {
|
|
441
441
|
const lines = [];
|
|
442
442
|
const emittedHeaders = /* @__PURE__ */ new Set();
|
|
443
|
-
const now = Math.trunc(_nullishCoalesce(_optionalChain([options, 'access',
|
|
443
|
+
const now = Math.trunc(_nullishCoalesce(_optionalChain([options, 'access', _21 => _21.now, 'optionalCall', _22 => _22()]), () => ( Date.now())));
|
|
444
444
|
const metricName = (name) => sanitizeMetricName(`${_nullishCoalesce(options.prefix, () => ( ""))}${name}`);
|
|
445
445
|
const emitHeader = (name, type) => {
|
|
446
446
|
const safeName = metricName(name);
|
|
447
447
|
const key = `${safeName}:${type}`;
|
|
448
448
|
if (emittedHeaders.has(key)) return;
|
|
449
449
|
emittedHeaders.add(key);
|
|
450
|
-
if (_optionalChain([options, 'access',
|
|
450
|
+
if (_optionalChain([options, 'access', _23 => _23.help, 'optionalAccess', _24 => _24[name]])) lines.push(`# HELP ${safeName} ${escapeHelp(options.help[name])}`);
|
|
451
451
|
lines.push(`# TYPE ${safeName} ${type}`);
|
|
452
452
|
};
|
|
453
453
|
const emitSample = (name, labels, value, exemplar) => {
|
|
@@ -469,10 +469,10 @@ function formatPrometheusMetrics(snapshot, options = {}) {
|
|
|
469
469
|
let cumulative = 0;
|
|
470
470
|
for (let i = 0; i < buckets.boundaries.length; i++) {
|
|
471
471
|
cumulative += _nullishCoalesce(buckets.counts[i], () => ( 0));
|
|
472
|
-
emitSample(`${histogram.name}_bucket`, { ...histogram.labels, le: String(buckets.boundaries[i]) }, cumulative, _optionalChain([buckets, 'access',
|
|
472
|
+
emitSample(`${histogram.name}_bucket`, { ...histogram.labels, le: String(buckets.boundaries[i]) }, cumulative, _optionalChain([buckets, 'access', _25 => _25.exemplars, 'optionalAccess', _26 => _26[i]]));
|
|
473
473
|
}
|
|
474
474
|
cumulative += _nullishCoalesce(buckets.counts[buckets.boundaries.length], () => ( 0));
|
|
475
|
-
emitSample(`${histogram.name}_bucket`, { ...histogram.labels, le: "+Inf" }, cumulative, _optionalChain([buckets, 'access',
|
|
475
|
+
emitSample(`${histogram.name}_bucket`, { ...histogram.labels, le: "+Inf" }, cumulative, _optionalChain([buckets, 'access', _27 => _27.exemplars, 'optionalAccess', _28 => _28[buckets.boundaries.length]]));
|
|
476
476
|
emitSample(`${histogram.name}_sum`, histogram.labels, buckets.sum);
|
|
477
477
|
emitSample(`${histogram.name}_count`, histogram.labels, buckets.count);
|
|
478
478
|
}
|
|
@@ -480,7 +480,7 @@ function formatPrometheusMetrics(snapshot, options = {}) {
|
|
|
480
480
|
`;
|
|
481
481
|
}
|
|
482
482
|
function metricsSnapshotToOtlp(snapshot, options = {}) {
|
|
483
|
-
const timeUnixNano = unixNanoFromMs(_nullishCoalesce(_optionalChain([options, 'access',
|
|
483
|
+
const timeUnixNano = unixNanoFromMs(_nullishCoalesce(_optionalChain([options, 'access', _29 => _29.now, 'optionalCall', _30 => _30()]), () => ( Date.now())));
|
|
484
484
|
const scope = { name: _nullishCoalesce(options.scopeName, () => ( "brass-runtime")) };
|
|
485
485
|
if (options.scopeVersion) scope.version = options.scopeVersion;
|
|
486
486
|
const metrics = [];
|
|
@@ -627,7 +627,7 @@ function recordRuntimeMetricEvent(ev, ctx, now, durationBuckets, state) {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
function exemplarFromTraceContext(trace, value, timestamp = Date.now(), labels) {
|
|
630
|
-
if (!_optionalChain([trace, 'optionalAccess',
|
|
630
|
+
if (!_optionalChain([trace, 'optionalAccess', _31 => _31.traceId]) || !_optionalChain([trace, 'optionalAccess', _32 => _32.spanId])) return void 0;
|
|
631
631
|
return {
|
|
632
632
|
value,
|
|
633
633
|
timestamp,
|
|
@@ -682,7 +682,7 @@ async function postOtlpJson(options, body) {
|
|
|
682
682
|
},
|
|
683
683
|
body
|
|
684
684
|
});
|
|
685
|
-
if (_optionalChain([response, 'optionalAccess',
|
|
685
|
+
if (_optionalChain([response, 'optionalAccess', _33 => _33.ok]) === false) {
|
|
686
686
|
let detail = "";
|
|
687
687
|
try {
|
|
688
688
|
detail = response.text ? `: ${await response.text()}` : "";
|
|
@@ -795,42 +795,42 @@ function makeOtlpHttpLogExporter(source, options) {
|
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
797
|
function logEffect(level, message, fields = {}) {
|
|
798
|
-
return
|
|
799
|
-
const fiber =
|
|
800
|
-
const runtime = _optionalChain([fiber, 'optionalAccess',
|
|
798
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
799
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
800
|
+
const runtime = _optionalChain([fiber, 'optionalAccess', _34 => _34.runtime]);
|
|
801
801
|
if (!runtime) return;
|
|
802
|
-
const inherited = _optionalChain([fiber, 'access',
|
|
802
|
+
const inherited = _optionalChain([fiber, 'access', _35 => _35.fiberContext, 'optionalAccess', _36 => _36.log]) ? _chunkGLE2WY7Zcjs.ctxToObject.call(void 0, fiber.fiberContext.log) : {};
|
|
803
803
|
runtime.log(level, message, { ...inherited, ...fields });
|
|
804
804
|
});
|
|
805
805
|
}
|
|
806
806
|
function withLogContext(patch, effect) {
|
|
807
|
-
return
|
|
807
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
808
808
|
startLogContext(patch),
|
|
809
|
-
(state) =>
|
|
809
|
+
(state) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
810
810
|
effect,
|
|
811
|
-
(error) =>
|
|
812
|
-
(value) =>
|
|
811
|
+
(error) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, endLogContext(state), () => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error)),
|
|
812
|
+
(value) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, endLogContext(state), () => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, value))
|
|
813
813
|
)
|
|
814
814
|
);
|
|
815
815
|
}
|
|
816
816
|
function startLogContext(patch) {
|
|
817
|
-
return
|
|
818
|
-
const fiber =
|
|
819
|
-
if (!_optionalChain([fiber, 'optionalAccess',
|
|
820
|
-
const previous = _nullishCoalesce(fiber.fiberContext.log, () => (
|
|
817
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
818
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
819
|
+
if (!_optionalChain([fiber, 'optionalAccess', _37 => _37.fiberContext])) return void 0;
|
|
820
|
+
const previous = _nullishCoalesce(fiber.fiberContext.log, () => ( _chunkGLE2WY7Zcjs.emptyContext));
|
|
821
821
|
const state = { fiber, previous, ended: false };
|
|
822
|
-
fiber.fiberContext = { ...fiber.fiberContext, log:
|
|
823
|
-
_optionalChain([fiber, 'access',
|
|
822
|
+
fiber.fiberContext = { ...fiber.fiberContext, log: _chunkGLE2WY7Zcjs.ctxExtend.call(void 0, previous, patch) };
|
|
823
|
+
_optionalChain([fiber, 'access', _38 => _38.addFinalizer, 'optionalCall', _39 => _39(() => restoreLogContext(state))]);
|
|
824
824
|
return state;
|
|
825
825
|
});
|
|
826
826
|
}
|
|
827
827
|
function endLogContext(state) {
|
|
828
|
-
return
|
|
828
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => restoreLogContext(state));
|
|
829
829
|
}
|
|
830
830
|
function restoreLogContext(state) {
|
|
831
831
|
if (!state || state.ended) return;
|
|
832
832
|
state.ended = true;
|
|
833
|
-
if (_optionalChain([state, 'access',
|
|
833
|
+
if (_optionalChain([state, 'access', _40 => _40.fiber, 'optionalAccess', _41 => _41.fiberContext])) {
|
|
834
834
|
state.fiber.fiberContext = { ...state.fiber.fiberContext, log: state.previous };
|
|
835
835
|
}
|
|
836
836
|
}
|
|
@@ -921,8 +921,8 @@ function resolveTraceSampling(config) {
|
|
|
921
921
|
}
|
|
922
922
|
return {
|
|
923
923
|
sampler: makeTraceSampler(_nullishCoalesce(config, () => ( {}))),
|
|
924
|
-
respectRemoteSampled: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
925
|
-
forceSampleOnError: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
924
|
+
respectRemoteSampled: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _42 => _42.respectRemoteSampled]), () => ( true)),
|
|
925
|
+
forceSampleOnError: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _43 => _43.forceSampleOnError]), () => ( false))
|
|
926
926
|
};
|
|
927
927
|
}
|
|
928
928
|
function shouldSampleWith(sampler, input) {
|
|
@@ -932,7 +932,7 @@ function shouldSampleWith(sampler, input) {
|
|
|
932
932
|
}
|
|
933
933
|
function samplingRuleMatches(rule, input) {
|
|
934
934
|
if (rule.name && !matchText(rule.name, input.spanName)) return false;
|
|
935
|
-
if (rule.route && !matchText(rule.route, _optionalChain([input, 'access',
|
|
935
|
+
if (rule.route && !matchText(rule.route, _optionalChain([input, 'access', _44 => _44.attributes, 'optionalAccess', _45 => _45["http.route"]]))) return false;
|
|
936
936
|
return true;
|
|
937
937
|
}
|
|
938
938
|
function matchText(pattern, value) {
|
|
@@ -957,12 +957,12 @@ function clampRatio(value) {
|
|
|
957
957
|
// src/observability/traces.ts
|
|
958
958
|
function withSpan(name, effect, attributesOrOptions) {
|
|
959
959
|
const options = resolveSpanOptions(attributesOrOptions);
|
|
960
|
-
return
|
|
960
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
961
961
|
startSpan(name, options),
|
|
962
|
-
(state) =>
|
|
962
|
+
(state) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
963
963
|
effect,
|
|
964
|
-
(error) =>
|
|
965
|
-
(value) =>
|
|
964
|
+
(error) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, endSpan(state, "failure", error), () => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error)),
|
|
965
|
+
(value) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, endSpan(state, "success"), () => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, value))
|
|
966
966
|
)
|
|
967
967
|
);
|
|
968
968
|
}
|
|
@@ -975,30 +975,30 @@ function spanLink(trace, attributes) {
|
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
977
|
function currentSpanLink(attributes) {
|
|
978
|
-
const fiber =
|
|
979
|
-
const trace = _optionalChain([fiber, 'optionalAccess',
|
|
980
|
-
return _optionalChain([trace, 'optionalAccess',
|
|
978
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
979
|
+
const trace = _optionalChain([fiber, 'optionalAccess', _46 => _46.fiberContext, 'optionalAccess', _47 => _47.trace]);
|
|
980
|
+
return _optionalChain([trace, 'optionalAccess', _48 => _48.traceId]) && _optionalChain([trace, 'optionalAccess', _49 => _49.spanId]) ? spanLink(trace, attributes) : void 0;
|
|
981
981
|
}
|
|
982
982
|
function withBaggage(baggage, effect) {
|
|
983
|
-
return
|
|
983
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
984
984
|
startBaggage(baggage),
|
|
985
|
-
(state) =>
|
|
985
|
+
(state) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
986
986
|
effect,
|
|
987
|
-
(error) =>
|
|
988
|
-
(value) =>
|
|
987
|
+
(error) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, endBaggage(state), () => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error)),
|
|
988
|
+
(value) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, endBaggage(state), () => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, value))
|
|
989
989
|
)
|
|
990
990
|
);
|
|
991
991
|
}
|
|
992
992
|
function currentBaggage() {
|
|
993
|
-
const fiber =
|
|
994
|
-
const baggage = _optionalChain([fiber, 'optionalAccess',
|
|
993
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
994
|
+
const baggage = _optionalChain([fiber, 'optionalAccess', _50 => _50.fiberContext, 'optionalAccess', _51 => _51.trace, 'optionalAccess', _52 => _52.baggage]);
|
|
995
995
|
return baggage ? { ...baggage } : void 0;
|
|
996
996
|
}
|
|
997
997
|
function spanEvent(name, attributes = {}) {
|
|
998
|
-
return
|
|
999
|
-
const fiber =
|
|
1000
|
-
const trace = _optionalChain([fiber, 'optionalAccess',
|
|
1001
|
-
if (!_optionalChain([fiber, 'optionalAccess',
|
|
998
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
999
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
1000
|
+
const trace = _optionalChain([fiber, 'optionalAccess', _53 => _53.fiberContext, 'optionalAccess', _54 => _54.trace]);
|
|
1001
|
+
if (!_optionalChain([fiber, 'optionalAccess', _55 => _55.runtime]) || !trace || trace.sampled === false) return;
|
|
1002
1002
|
fiber.runtime.hooks.emit(
|
|
1003
1003
|
{ type: "span.event", name, attributes },
|
|
1004
1004
|
spanContext(fiber, trace)
|
|
@@ -1029,26 +1029,26 @@ function makeOtlpHttpSpanExporter(source, options) {
|
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
1031
|
function startSpan(name, options) {
|
|
1032
|
-
return
|
|
1033
|
-
const fiber =
|
|
1034
|
-
const runtime = _optionalChain([fiber, 'optionalAccess',
|
|
1035
|
-
if (!_optionalChain([fiber, 'optionalAccess',
|
|
1032
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1033
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
1034
|
+
const runtime = _optionalChain([fiber, 'optionalAccess', _56 => _56.runtime]);
|
|
1035
|
+
if (!_optionalChain([fiber, 'optionalAccess', _57 => _57.fiberContext]) || !runtime) return void 0;
|
|
1036
1036
|
const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
|
|
1037
1037
|
const tracer = resolveTracer(runtime);
|
|
1038
|
-
const traceId = _nullishCoalesce(_optionalChain([previousTrace, 'optionalAccess',
|
|
1038
|
+
const traceId = _nullishCoalesce(_optionalChain([previousTrace, 'optionalAccess', _58 => _58.traceId]), () => ( tracer.newTraceId()));
|
|
1039
1039
|
const sampled = decideSampling(runtime, {
|
|
1040
1040
|
traceId,
|
|
1041
1041
|
spanName: name,
|
|
1042
|
-
parentSampled: _optionalChain([previousTrace, 'optionalAccess',
|
|
1042
|
+
parentSampled: _optionalChain([previousTrace, 'optionalAccess', _59 => _59.sampled]),
|
|
1043
1043
|
attributes: options.attributes
|
|
1044
1044
|
});
|
|
1045
1045
|
const trace = {
|
|
1046
1046
|
traceId,
|
|
1047
1047
|
spanId: tracer.newSpanId(),
|
|
1048
|
-
parentSpanId: _optionalChain([previousTrace, 'optionalAccess',
|
|
1048
|
+
parentSpanId: _optionalChain([previousTrace, 'optionalAccess', _60 => _60.spanId]),
|
|
1049
1049
|
sampled,
|
|
1050
|
-
traceState: _optionalChain([previousTrace, 'optionalAccess',
|
|
1051
|
-
..._optionalChain([previousTrace, 'optionalAccess',
|
|
1050
|
+
traceState: _optionalChain([previousTrace, 'optionalAccess', _61 => _61.traceState]),
|
|
1051
|
+
..._optionalChain([previousTrace, 'optionalAccess', _62 => _62.baggage]) ? { baggage: previousTrace.baggage } : {}
|
|
1052
1052
|
};
|
|
1053
1053
|
const state = {
|
|
1054
1054
|
fiber,
|
|
@@ -1057,14 +1057,14 @@ function startSpan(name, options) {
|
|
|
1057
1057
|
trace,
|
|
1058
1058
|
name,
|
|
1059
1059
|
options,
|
|
1060
|
-
forceSampleOnError: _optionalChain([runtime, 'optionalAccess',
|
|
1060
|
+
forceSampleOnError: _optionalChain([runtime, 'optionalAccess', _63 => _63.env, 'optionalAccess', _64 => _64.brass, 'optionalAccess', _65 => _65.forceSampleOnError]) === true,
|
|
1061
1061
|
startEmitted: sampled !== false,
|
|
1062
1062
|
ended: false
|
|
1063
1063
|
};
|
|
1064
1064
|
fiber.fiberContext = { ...fiber.fiberContext, trace };
|
|
1065
|
-
_optionalChain([fiber, 'access',
|
|
1066
|
-
const status = _optionalChain([exit, 'optionalAccess',
|
|
1067
|
-
finishSpan(state, status, _optionalChain([exit, 'optionalAccess',
|
|
1065
|
+
_optionalChain([fiber, 'access', _66 => _66.addFinalizer, 'optionalCall', _67 => _67((exit) => {
|
|
1066
|
+
const status = _optionalChain([exit, 'optionalAccess', _68 => _68._tag]) === "Success" ? "success" : _optionalChain([exit, 'optionalAccess', _69 => _69.cause, 'optionalAccess', _70 => _70._tag]) === "Interrupt" ? "interrupted" : "failure";
|
|
1067
|
+
finishSpan(state, status, _optionalChain([exit, 'optionalAccess', _71 => _71._tag]) === "Failure" ? exit.cause : void 0);
|
|
1068
1068
|
})]);
|
|
1069
1069
|
if (state.startEmitted) {
|
|
1070
1070
|
runtime.hooks.emit(
|
|
@@ -1076,7 +1076,7 @@ function startSpan(name, options) {
|
|
|
1076
1076
|
});
|
|
1077
1077
|
}
|
|
1078
1078
|
function endSpan(state, status, error) {
|
|
1079
|
-
return
|
|
1079
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => finishSpan(state, status, error));
|
|
1080
1080
|
}
|
|
1081
1081
|
function finishSpan(state, status, error) {
|
|
1082
1082
|
if (!state || state.ended) return;
|
|
@@ -1095,14 +1095,14 @@ function finishSpan(state, status, error) {
|
|
|
1095
1095
|
spanContext(state.fiber, state.trace)
|
|
1096
1096
|
);
|
|
1097
1097
|
}
|
|
1098
|
-
if (_optionalChain([state, 'access',
|
|
1098
|
+
if (_optionalChain([state, 'access', _72 => _72.fiber, 'optionalAccess', _73 => _73.fiberContext])) {
|
|
1099
1099
|
state.fiber.fiberContext = { ...state.fiber.fiberContext, trace: state.previousTrace };
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
function spanContext(fiber, trace) {
|
|
1103
1103
|
return {
|
|
1104
|
-
fiberId: _optionalChain([fiber, 'optionalAccess',
|
|
1105
|
-
scopeId: _optionalChain([fiber, 'optionalAccess',
|
|
1104
|
+
fiberId: _optionalChain([fiber, 'optionalAccess', _74 => _74.id]),
|
|
1105
|
+
scopeId: _optionalChain([fiber, 'optionalAccess', _75 => _75.scopeId]),
|
|
1106
1106
|
traceId: trace.traceId,
|
|
1107
1107
|
spanId: trace.spanId,
|
|
1108
1108
|
parentSpanId: trace.parentSpanId,
|
|
@@ -1112,9 +1112,9 @@ function spanContext(fiber, trace) {
|
|
|
1112
1112
|
};
|
|
1113
1113
|
}
|
|
1114
1114
|
function startBaggage(baggage) {
|
|
1115
|
-
return
|
|
1116
|
-
const fiber =
|
|
1117
|
-
if (!_optionalChain([fiber, 'optionalAccess',
|
|
1115
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1116
|
+
const fiber = _chunkGLE2WY7Zcjs.getCurrentFiber.call(void 0, );
|
|
1117
|
+
if (!_optionalChain([fiber, 'optionalAccess', _76 => _76.fiberContext])) return void 0;
|
|
1118
1118
|
const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
|
|
1119
1119
|
if (!previousTrace) return void 0;
|
|
1120
1120
|
const state = { fiber, previousTrace, ended: false };
|
|
@@ -1128,28 +1128,28 @@ function startBaggage(baggage) {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
1130
|
};
|
|
1131
|
-
_optionalChain([fiber, 'access',
|
|
1131
|
+
_optionalChain([fiber, 'access', _77 => _77.addFinalizer, 'optionalCall', _78 => _78(() => restoreBaggage(state))]);
|
|
1132
1132
|
return state;
|
|
1133
1133
|
});
|
|
1134
1134
|
}
|
|
1135
1135
|
function endBaggage(state) {
|
|
1136
|
-
return
|
|
1136
|
+
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => restoreBaggage(state));
|
|
1137
1137
|
}
|
|
1138
1138
|
function restoreBaggage(state) {
|
|
1139
1139
|
if (!state || state.ended) return;
|
|
1140
1140
|
state.ended = true;
|
|
1141
|
-
if (_optionalChain([state, 'access',
|
|
1141
|
+
if (_optionalChain([state, 'access', _79 => _79.fiber, 'optionalAccess', _80 => _80.fiberContext])) {
|
|
1142
1142
|
state.fiber.fiberContext = { ...state.fiber.fiberContext, trace: state.previousTrace };
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
function decideSampling(runtime, input) {
|
|
1146
|
-
const brass = _optionalChain([runtime, 'optionalAccess',
|
|
1147
|
-
if (input.parentSampled === false && _optionalChain([brass, 'optionalAccess',
|
|
1148
|
-
return shouldSampleWith(_optionalChain([brass, 'optionalAccess',
|
|
1146
|
+
const brass = _optionalChain([runtime, 'optionalAccess', _81 => _81.env, 'optionalAccess', _82 => _82.brass]);
|
|
1147
|
+
if (input.parentSampled === false && _optionalChain([brass, 'optionalAccess', _83 => _83.respectRemoteSampled]) !== false) return false;
|
|
1148
|
+
return shouldSampleWith(_optionalChain([brass, 'optionalAccess', _84 => _84.sampler]), input);
|
|
1149
1149
|
}
|
|
1150
1150
|
function resolveTracer(runtime) {
|
|
1151
|
-
const tracer = _optionalChain([runtime, 'optionalAccess',
|
|
1152
|
-
if (_optionalChain([tracer, 'optionalAccess',
|
|
1151
|
+
const tracer = _optionalChain([runtime, 'optionalAccess', _85 => _85.env, 'optionalAccess', _86 => _86.brass, 'optionalAccess', _87 => _87.tracer]);
|
|
1152
|
+
if (_optionalChain([tracer, 'optionalAccess', _88 => _88.newTraceId]) && _optionalChain([tracer, 'optionalAccess', _89 => _89.newSpanId])) return tracer;
|
|
1153
1153
|
return {
|
|
1154
1154
|
newTraceId: () => randomRuntimeId("trace"),
|
|
1155
1155
|
newSpanId: () => randomRuntimeId("span")
|
|
@@ -1211,7 +1211,7 @@ function normalizeSpanLink(link) {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
function inferOtlpStatus(span) {
|
|
1213
1213
|
const end = [...span.events].reverse().find((event) => event.name === "span.end" || event.name === "fiber.end");
|
|
1214
|
-
const status = typeof _optionalChain([end, 'optionalAccess',
|
|
1214
|
+
const status = typeof _optionalChain([end, 'optionalAccess', _90 => _90.attrs]) === "object" && end.attrs != null ? end.attrs.status : void 0;
|
|
1215
1215
|
if (status === "failure" || status === "interrupted") {
|
|
1216
1216
|
return { code: 2, message: status };
|
|
1217
1217
|
}
|
|
@@ -1232,7 +1232,7 @@ function normalizeAttributes(attrs) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
function randomRuntimeId(prefix) {
|
|
1234
1234
|
const cryptoLike = globalThis.crypto;
|
|
1235
|
-
if (typeof _optionalChain([cryptoLike, 'optionalAccess',
|
|
1235
|
+
if (typeof _optionalChain([cryptoLike, 'optionalAccess', _91 => _91.randomUUID]) === "function") return cryptoLike.randomUUID();
|
|
1236
1236
|
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
@@ -1248,15 +1248,15 @@ function makeExportPipeline(options) {
|
|
|
1248
1248
|
const maxQueueSize = Math.max(0, Math.floor(_nullishCoalesce(options.maxQueueSize, () => ( DEFAULT_MAX_QUEUE_SIZE))));
|
|
1249
1249
|
const timeoutMs = Math.max(0, Math.floor(_nullishCoalesce(options.timeoutMs, () => ( DEFAULT_TIMEOUT_MS))));
|
|
1250
1250
|
const dropPolicy = _nullishCoalesce(options.dropPolicy, () => ( "drop-oldest"));
|
|
1251
|
-
const queueGauge = _optionalChain([options, 'access',
|
|
1251
|
+
const queueGauge = _optionalChain([options, 'access', _92 => _92.metrics, 'optionalAccess', _93 => _93.gauge, 'call', _94 => _94("brass_export_queue_size", { signal })]);
|
|
1252
1252
|
let queue = [];
|
|
1253
1253
|
let droppedTotal = 0;
|
|
1254
|
-
const setQueueSize = () => _optionalChain([queueGauge, 'optionalAccess',
|
|
1254
|
+
const setQueueSize = () => _optionalChain([queueGauge, 'optionalAccess', _95 => _95.set, 'call', _96 => _96(queue.length)]);
|
|
1255
1255
|
const dropItems = (items) => {
|
|
1256
1256
|
if (items.length === 0) return;
|
|
1257
1257
|
droppedTotal += items.length;
|
|
1258
|
-
_optionalChain([options, 'access',
|
|
1259
|
-
_optionalChain([options, 'access',
|
|
1258
|
+
_optionalChain([options, 'access', _97 => _97.metrics, 'optionalAccess', _98 => _98.counter, 'call', _99 => _99("brass_export_dropped_total", { signal }), 'access', _100 => _100.increment, 'call', _101 => _101(items.length)]);
|
|
1259
|
+
_optionalChain([options, 'access', _102 => _102.onDrop, 'optionalCall', _103 => _103(items)]);
|
|
1260
1260
|
};
|
|
1261
1261
|
const enqueue = (items) => {
|
|
1262
1262
|
if (items.length === 0 || maxQueueSize === 0) {
|
|
@@ -1268,7 +1268,7 @@ function makeExportPipeline(options) {
|
|
|
1268
1268
|
const available = maxQueueSize - queue.length;
|
|
1269
1269
|
if (incoming.length <= available) {
|
|
1270
1270
|
queue.push(...incoming);
|
|
1271
|
-
_optionalChain([options, 'access',
|
|
1271
|
+
_optionalChain([options, 'access', _104 => _104.metrics, 'optionalAccess', _105 => _105.counter, 'call', _106 => _106("brass_export_enqueued_total", { signal }), 'access', _107 => _107.increment, 'call', _108 => _108(incoming.length)]);
|
|
1272
1272
|
setQueueSize();
|
|
1273
1273
|
return incoming.length;
|
|
1274
1274
|
}
|
|
@@ -1276,7 +1276,7 @@ function makeExportPipeline(options) {
|
|
|
1276
1276
|
const accepted = incoming.slice(0, Math.max(0, available));
|
|
1277
1277
|
const dropped2 = incoming.slice(accepted.length);
|
|
1278
1278
|
queue.push(...accepted);
|
|
1279
|
-
_optionalChain([options, 'access',
|
|
1279
|
+
_optionalChain([options, 'access', _109 => _109.metrics, 'optionalAccess', _110 => _110.counter, 'call', _111 => _111("brass_export_enqueued_total", { signal }), 'access', _112 => _112.increment, 'call', _113 => _113(accepted.length)]);
|
|
1280
1280
|
dropItems(dropped2);
|
|
1281
1281
|
setQueueSize();
|
|
1282
1282
|
return accepted.length;
|
|
@@ -1287,7 +1287,7 @@ function makeExportPipeline(options) {
|
|
|
1287
1287
|
const remainingDrop = dropCount - dropped.length;
|
|
1288
1288
|
if (remainingDrop > 0) dropped.push(...incoming.splice(0, remainingDrop));
|
|
1289
1289
|
queue.push(...incoming);
|
|
1290
|
-
_optionalChain([options, 'access',
|
|
1290
|
+
_optionalChain([options, 'access', _114 => _114.metrics, 'optionalAccess', _115 => _115.counter, 'call', _116 => _116("brass_export_enqueued_total", { signal }), 'access', _117 => _117.increment, 'call', _118 => _118(incoming.length)]);
|
|
1291
1291
|
dropItems(dropped);
|
|
1292
1292
|
setQueueSize();
|
|
1293
1293
|
return incoming.length;
|
|
@@ -1320,22 +1320,22 @@ function makeExportPipeline(options) {
|
|
|
1320
1320
|
attempts += result.attempts;
|
|
1321
1321
|
lastStatus = result.value.status;
|
|
1322
1322
|
lastBody = result.value.body;
|
|
1323
|
-
_optionalChain([options, 'access',
|
|
1324
|
-
_optionalChain([options, 'access',
|
|
1325
|
-
_optionalChain([options, 'access',
|
|
1323
|
+
_optionalChain([options, 'access', _119 => _119.metrics, 'optionalAccess', _120 => _120.counter, 'call', _121 => _121("brass_export_batches_total", { signal, status: "success" }), 'access', _122 => _122.increment, 'call', _123 => _123()]);
|
|
1324
|
+
_optionalChain([options, 'access', _124 => _124.metrics, 'optionalAccess', _125 => _125.counter, 'call', _126 => _126("brass_export_items_total", { signal, status: "success" }), 'access', _127 => _127.increment, 'call', _128 => _128(batch.length)]);
|
|
1325
|
+
_optionalChain([options, 'access', _129 => _129.metrics, 'optionalAccess', _130 => _130.histogram, 'call', _131 => _131("brass_export_batch_duration_ms", void 0, { signal, status: "success" }), 'access', _132 => _132.observe, 'call', _133 => _133(clock() - batchStartedAt)]);
|
|
1326
1326
|
} catch (error) {
|
|
1327
1327
|
failed += batch.length;
|
|
1328
1328
|
errors.push(error);
|
|
1329
1329
|
queue = [...batch, ...queue];
|
|
1330
|
-
_optionalChain([options, 'access',
|
|
1331
|
-
_optionalChain([options, 'access',
|
|
1332
|
-
_optionalChain([options, 'access',
|
|
1330
|
+
_optionalChain([options, 'access', _134 => _134.metrics, 'optionalAccess', _135 => _135.counter, 'call', _136 => _136("brass_export_batches_total", { signal, status: "failure" }), 'access', _137 => _137.increment, 'call', _138 => _138()]);
|
|
1331
|
+
_optionalChain([options, 'access', _139 => _139.metrics, 'optionalAccess', _140 => _140.counter, 'call', _141 => _141("brass_export_items_total", { signal, status: "failure" }), 'access', _142 => _142.increment, 'call', _143 => _143(batch.length)]);
|
|
1332
|
+
_optionalChain([options, 'access', _144 => _144.metrics, 'optionalAccess', _145 => _145.histogram, 'call', _146 => _146("brass_export_batch_duration_ms", void 0, { signal, status: "failure" }), 'access', _147 => _147.observe, 'call', _148 => _148(clock() - batchStartedAt)]);
|
|
1333
1333
|
break;
|
|
1334
1334
|
} finally {
|
|
1335
1335
|
setQueueSize();
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
|
-
_optionalChain([options, 'access',
|
|
1338
|
+
_optionalChain([options, 'access', _149 => _149.metrics, 'optionalAccess', _150 => _150.histogram, 'call', _151 => _151("brass_export_flush_duration_ms", void 0, { signal }), 'access', _152 => _152.observe, 'call', _153 => _153(clock() - startedAt)]);
|
|
1339
1339
|
return {
|
|
1340
1340
|
exported,
|
|
1341
1341
|
dropped: droppedTotal,
|
|
@@ -1356,11 +1356,11 @@ function makeExportPipeline(options) {
|
|
|
1356
1356
|
};
|
|
1357
1357
|
}
|
|
1358
1358
|
async function exportWithRetry(operation, options) {
|
|
1359
|
-
const attempts = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([options, 'access',
|
|
1360
|
-
const initialDelayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'access',
|
|
1361
|
-
const maxDelayMs = Math.max(initialDelayMs, _nullishCoalesce(_optionalChain([options, 'access',
|
|
1362
|
-
const jitterRatio = Math.max(0, Math.min(1, _nullishCoalesce(_optionalChain([options, 'access',
|
|
1363
|
-
const sleep = _nullishCoalesce(_optionalChain([options, 'access',
|
|
1359
|
+
const attempts = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([options, 'access', _154 => _154.retry, 'optionalAccess', _155 => _155.attempts]), () => ( 1))));
|
|
1360
|
+
const initialDelayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'access', _156 => _156.retry, 'optionalAccess', _157 => _157.initialDelayMs]), () => ( 100)));
|
|
1361
|
+
const maxDelayMs = Math.max(initialDelayMs, _nullishCoalesce(_optionalChain([options, 'access', _158 => _158.retry, 'optionalAccess', _159 => _159.maxDelayMs]), () => ( 2e3)));
|
|
1362
|
+
const jitterRatio = Math.max(0, Math.min(1, _nullishCoalesce(_optionalChain([options, 'access', _160 => _160.retry, 'optionalAccess', _161 => _161.jitterRatio]), () => ( 0.2))));
|
|
1363
|
+
const sleep = _nullishCoalesce(_optionalChain([options, 'access', _162 => _162.retry, 'optionalAccess', _163 => _163.sleep]), () => ( defaultSleep));
|
|
1364
1364
|
let lastError;
|
|
1365
1365
|
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
1366
1366
|
try {
|
|
@@ -1368,7 +1368,7 @@ async function exportWithRetry(operation, options) {
|
|
|
1368
1368
|
} catch (error) {
|
|
1369
1369
|
lastError = error;
|
|
1370
1370
|
if (attempt >= attempts) break;
|
|
1371
|
-
_optionalChain([options, 'access',
|
|
1371
|
+
_optionalChain([options, 'access', _164 => _164.metrics, 'optionalAccess', _165 => _165.counter, 'call', _166 => _166("brass_export_retries_total", { signal: options.signal }), 'access', _167 => _167.increment, 'call', _168 => _168()]);
|
|
1372
1372
|
await sleep(jitteredDelay(initialDelayMs, maxDelayMs, jitterRatio, attempt));
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
@@ -1382,7 +1382,7 @@ async function withTimeout(operation, timeoutMs) {
|
|
|
1382
1382
|
operation(),
|
|
1383
1383
|
new Promise((_resolve, reject) => {
|
|
1384
1384
|
handle = setTimeout(() => reject(new Error(`Observability export timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
1385
|
-
_optionalChain([handle, 'access',
|
|
1385
|
+
_optionalChain([handle, 'access', _169 => _169.unref, 'optionalCall', _170 => _170()]);
|
|
1386
1386
|
})
|
|
1387
1387
|
]);
|
|
1388
1388
|
} finally {
|
|
@@ -1398,7 +1398,7 @@ function jitteredDelay(initialDelayMs, maxDelayMs, jitterRatio, attempt) {
|
|
|
1398
1398
|
function defaultSleep(ms) {
|
|
1399
1399
|
return new Promise((resolve) => {
|
|
1400
1400
|
const handle = setTimeout(resolve, ms);
|
|
1401
|
-
_optionalChain([handle, 'access',
|
|
1401
|
+
_optionalChain([handle, 'access', _171 => _171.unref, 'optionalCall', _172 => _172()]);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
@@ -1455,53 +1455,54 @@ function sanitizeHttpTarget(url) {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
|
|
1457
1457
|
// src/observability/configValidation.ts
|
|
1458
|
-
var fn =
|
|
1459
|
-
var object =
|
|
1458
|
+
var fn = _chunkCZIVE6NTcjs.Schema.custom((value) => typeof value === "function", "function");
|
|
1459
|
+
var object = _chunkCZIVE6NTcjs.Schema.custom(
|
|
1460
1460
|
(value) => typeof value === "object" && value !== null && !Array.isArray(value),
|
|
1461
1461
|
"object"
|
|
1462
1462
|
);
|
|
1463
|
-
var falseOrObject =
|
|
1464
|
-
var ratio =
|
|
1465
|
-
var
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1463
|
+
var falseOrObject = _chunkCZIVE6NTcjs.Schema.union([_chunkCZIVE6NTcjs.Schema.literal(false), object]);
|
|
1464
|
+
var ratio = _chunkCZIVE6NTcjs.Schema.number({ min: 0, max: 1 });
|
|
1465
|
+
var logLevel = _chunkCZIVE6NTcjs.Schema.enum(["debug", "info", "warn", "error"]);
|
|
1466
|
+
var retryOptions = _chunkCZIVE6NTcjs.Schema.object({
|
|
1467
|
+
attempts: _chunkCZIVE6NTcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1468
|
+
initialDelayMs: _chunkCZIVE6NTcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1469
|
+
maxDelayMs: _chunkCZIVE6NTcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1470
|
+
jitterRatio: _chunkCZIVE6NTcjs.Schema.number({ min: 0, max: 1 }).optional(),
|
|
1470
1471
|
sleep: fn.optional()
|
|
1471
1472
|
}, { unknownKeys: "passthrough" });
|
|
1472
|
-
var pipelineOptions =
|
|
1473
|
-
maxQueueSize:
|
|
1474
|
-
batchSize:
|
|
1475
|
-
timeoutMs:
|
|
1473
|
+
var pipelineOptions = _chunkCZIVE6NTcjs.Schema.object({
|
|
1474
|
+
maxQueueSize: _chunkCZIVE6NTcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1475
|
+
batchSize: _chunkCZIVE6NTcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1476
|
+
timeoutMs: _chunkCZIVE6NTcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
1476
1477
|
retry: retryOptions.optional(),
|
|
1477
|
-
dropPolicy:
|
|
1478
|
-
shutdownTimeoutMs:
|
|
1478
|
+
dropPolicy: _chunkCZIVE6NTcjs.Schema.enum(["drop-oldest", "drop-newest"]).optional(),
|
|
1479
|
+
shutdownTimeoutMs: _chunkCZIVE6NTcjs.Schema.number({ min: 0, int: true }).optional()
|
|
1479
1480
|
}, { unknownKeys: "passthrough" });
|
|
1480
|
-
var otlpOptions =
|
|
1481
|
-
metricsUrl:
|
|
1482
|
-
tracesUrl:
|
|
1483
|
-
logsUrl:
|
|
1484
|
-
headers:
|
|
1481
|
+
var otlpOptions = _chunkCZIVE6NTcjs.Schema.object({
|
|
1482
|
+
metricsUrl: _chunkCZIVE6NTcjs.Schema.string().optional(),
|
|
1483
|
+
tracesUrl: _chunkCZIVE6NTcjs.Schema.string().optional(),
|
|
1484
|
+
logsUrl: _chunkCZIVE6NTcjs.Schema.string().optional(),
|
|
1485
|
+
headers: _chunkCZIVE6NTcjs.Schema.record(_chunkCZIVE6NTcjs.Schema.string()).optional(),
|
|
1485
1486
|
fetch: fn.optional(),
|
|
1486
|
-
timeoutMs:
|
|
1487
|
+
timeoutMs: _chunkCZIVE6NTcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1487
1488
|
retry: retryOptions.optional(),
|
|
1488
1489
|
pipeline: pipelineOptions.optional()
|
|
1489
1490
|
}, { unknownKeys: "passthrough" });
|
|
1490
|
-
var samplingOptions =
|
|
1491
|
-
|
|
1491
|
+
var samplingOptions = _chunkCZIVE6NTcjs.Schema.union([
|
|
1492
|
+
_chunkCZIVE6NTcjs.Schema.literal(false),
|
|
1492
1493
|
ratio,
|
|
1493
1494
|
fn,
|
|
1494
|
-
|
|
1495
|
+
_chunkCZIVE6NTcjs.Schema.object({
|
|
1495
1496
|
ratio: ratio.optional(),
|
|
1496
|
-
rules:
|
|
1497
|
-
sampler:
|
|
1498
|
-
respectRemoteSampled:
|
|
1499
|
-
forceSampleOnError:
|
|
1497
|
+
rules: _chunkCZIVE6NTcjs.Schema.array(object).optional(),
|
|
1498
|
+
sampler: _chunkCZIVE6NTcjs.Schema.union([fn, object]).optional(),
|
|
1499
|
+
respectRemoteSampled: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
1500
|
+
forceSampleOnError: _chunkCZIVE6NTcjs.Schema.boolean().optional()
|
|
1500
1501
|
}, { unknownKeys: "passthrough" })
|
|
1501
1502
|
]);
|
|
1502
|
-
var observabilityOptions =
|
|
1503
|
-
serviceName:
|
|
1504
|
-
serviceVersion:
|
|
1503
|
+
var observabilityOptions = _chunkCZIVE6NTcjs.Schema.object({
|
|
1504
|
+
serviceName: _chunkCZIVE6NTcjs.Schema.string({ minLength: 1 }).optional(),
|
|
1505
|
+
serviceVersion: _chunkCZIVE6NTcjs.Schema.string({ minLength: 1 }).optional(),
|
|
1505
1506
|
resource: object.optional(),
|
|
1506
1507
|
eventBus: object.optional(),
|
|
1507
1508
|
metrics: falseOrObject.optional(),
|
|
@@ -1509,34 +1510,101 @@ var observabilityOptions = _chunkSPUEME2Bcjs.Schema.object({
|
|
|
1509
1510
|
traces: falseOrObject.optional(),
|
|
1510
1511
|
sampling: samplingOptions.optional(),
|
|
1511
1512
|
redaction: falseOrObject.optional(),
|
|
1512
|
-
cardinality:
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
maxValuesPerLabel:
|
|
1516
|
-
overflowValue:
|
|
1513
|
+
cardinality: _chunkCZIVE6NTcjs.Schema.union([
|
|
1514
|
+
_chunkCZIVE6NTcjs.Schema.literal(false),
|
|
1515
|
+
_chunkCZIVE6NTcjs.Schema.object({
|
|
1516
|
+
maxValuesPerLabel: _chunkCZIVE6NTcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1517
|
+
overflowValue: _chunkCZIVE6NTcjs.Schema.string({ minLength: 1 }).optional()
|
|
1517
1518
|
}, { unknownKeys: "passthrough" })
|
|
1518
1519
|
]).optional(),
|
|
1519
1520
|
otlp: otlpOptions.optional(),
|
|
1520
|
-
flushIntervalMs:
|
|
1521
|
-
autoStart:
|
|
1521
|
+
flushIntervalMs: _chunkCZIVE6NTcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
1522
|
+
autoStart: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
1522
1523
|
traceSeed: object.optional(),
|
|
1523
1524
|
childName: fn.optional(),
|
|
1524
1525
|
onFlushError: fn.optional()
|
|
1525
1526
|
}, { unknownKeys: "passthrough" });
|
|
1527
|
+
var httpObservabilityOptions = _chunkCZIVE6NTcjs.Schema.object({
|
|
1528
|
+
metrics: falseOrObject.optional(),
|
|
1529
|
+
logs: _chunkCZIVE6NTcjs.Schema.union([
|
|
1530
|
+
_chunkCZIVE6NTcjs.Schema.literal(false),
|
|
1531
|
+
_chunkCZIVE6NTcjs.Schema.object({
|
|
1532
|
+
requestLevel: _chunkCZIVE6NTcjs.Schema.union([logLevel, _chunkCZIVE6NTcjs.Schema.literal(false)]).optional(),
|
|
1533
|
+
responseLevel: _chunkCZIVE6NTcjs.Schema.union([logLevel, _chunkCZIVE6NTcjs.Schema.literal(false)]).optional(),
|
|
1534
|
+
errorLevel: _chunkCZIVE6NTcjs.Schema.union([logLevel, _chunkCZIVE6NTcjs.Schema.literal(false)]).optional()
|
|
1535
|
+
}, { unknownKeys: "passthrough" })
|
|
1536
|
+
]).optional(),
|
|
1537
|
+
spans: _chunkCZIVE6NTcjs.Schema.union([
|
|
1538
|
+
_chunkCZIVE6NTcjs.Schema.literal(false),
|
|
1539
|
+
_chunkCZIVE6NTcjs.Schema.object({
|
|
1540
|
+
name: _chunkCZIVE6NTcjs.Schema.union([_chunkCZIVE6NTcjs.Schema.string({ minLength: 1 }), fn]).optional(),
|
|
1541
|
+
attributes: _chunkCZIVE6NTcjs.Schema.union([object, fn]).optional()
|
|
1542
|
+
}, { unknownKeys: "passthrough" })
|
|
1543
|
+
]).optional(),
|
|
1544
|
+
adaptiveLimiter: _chunkCZIVE6NTcjs.Schema.union([
|
|
1545
|
+
_chunkCZIVE6NTcjs.Schema.boolean(),
|
|
1546
|
+
_chunkCZIVE6NTcjs.Schema.object({
|
|
1547
|
+
enabled: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
1548
|
+
includeKeyLabel: _chunkCZIVE6NTcjs.Schema.boolean().optional()
|
|
1549
|
+
}, { unknownKeys: "passthrough" })
|
|
1550
|
+
]).optional(),
|
|
1551
|
+
policy: _chunkCZIVE6NTcjs.Schema.union([
|
|
1552
|
+
_chunkCZIVE6NTcjs.Schema.boolean(),
|
|
1553
|
+
_chunkCZIVE6NTcjs.Schema.object({
|
|
1554
|
+
enabled: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
1555
|
+
labelKeys: _chunkCZIVE6NTcjs.Schema.array(_chunkCZIVE6NTcjs.Schema.enum(["preset", "lane", "poolKey", "dedupKey", "priority", "retry"])).optional()
|
|
1556
|
+
}, { unknownKeys: "passthrough" })
|
|
1557
|
+
]).optional(),
|
|
1558
|
+
injectTraceHeaders: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
1559
|
+
includeHostLabel: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
1560
|
+
route: _chunkCZIVE6NTcjs.Schema.union([_chunkCZIVE6NTcjs.Schema.string({ minLength: 1 }), fn]).optional(),
|
|
1561
|
+
clock: fn.optional(),
|
|
1562
|
+
durationBuckets: _chunkCZIVE6NTcjs.Schema.array(_chunkCZIVE6NTcjs.Schema.number({ min: 0 }).refine((n) => n > 0, "duration bucket must be > 0")).optional()
|
|
1563
|
+
}, { unknownKeys: "passthrough" });
|
|
1526
1564
|
function validateObservabilityOptions(options) {
|
|
1527
|
-
|
|
1565
|
+
_chunkCZIVE6NTcjs.parseConfig.call(void 0, "ObservabilityOptions", observabilityOptions, options);
|
|
1566
|
+
}
|
|
1567
|
+
function validateHttpObservabilityOptions(options) {
|
|
1568
|
+
_chunkCZIVE6NTcjs.parseConfig.call(void 0, "HttpObservabilityOptions", httpObservabilityOptions, options);
|
|
1528
1569
|
}
|
|
1529
1570
|
|
|
1530
1571
|
// src/observability/setup.ts
|
|
1572
|
+
var DEFAULT_OTLP_SIGNALS = ["metrics", "traces", "logs"];
|
|
1573
|
+
function makeOtlpOptions(input) {
|
|
1574
|
+
const endpoint = normalizeOtlpEndpoint(input.endpoint);
|
|
1575
|
+
const signals = _nullishCoalesce(input.signals, () => ( DEFAULT_OTLP_SIGNALS));
|
|
1576
|
+
return {
|
|
1577
|
+
...signals.includes("metrics") ? { metricsUrl: `${endpoint}/v1/metrics` } : {},
|
|
1578
|
+
...signals.includes("traces") ? { tracesUrl: `${endpoint}/v1/traces` } : {},
|
|
1579
|
+
...signals.includes("logs") ? { logsUrl: `${endpoint}/v1/logs` } : {},
|
|
1580
|
+
...input.headers ? { headers: input.headers } : {},
|
|
1581
|
+
...input.fetch ? { fetch: input.fetch } : {},
|
|
1582
|
+
...input.timeoutMs !== void 0 ? { timeoutMs: input.timeoutMs } : {},
|
|
1583
|
+
...input.retry ? { retry: input.retry } : {},
|
|
1584
|
+
...input.pipeline ? { pipeline: input.pipeline } : {}
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
function normalizeOtlpEndpoint(endpoint) {
|
|
1588
|
+
const trimmed = endpoint.trim();
|
|
1589
|
+
let end = trimmed.length;
|
|
1590
|
+
while (end > 0 && trimmed.charCodeAt(end - 1) === 47) {
|
|
1591
|
+
end -= 1;
|
|
1592
|
+
}
|
|
1593
|
+
const normalized = trimmed.slice(0, end);
|
|
1594
|
+
if (!normalized) {
|
|
1595
|
+
throw new Error("makeOtlpOptions endpoint must not be empty");
|
|
1596
|
+
}
|
|
1597
|
+
return normalized;
|
|
1598
|
+
}
|
|
1531
1599
|
function makeObservability(options = {}) {
|
|
1532
1600
|
validateObservabilityOptions(options);
|
|
1533
1601
|
const serviceName = _nullishCoalesce(options.serviceName, () => ( "brass-runtime"));
|
|
1534
|
-
const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0,
|
|
1535
|
-
const rawMetrics =
|
|
1602
|
+
const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0, _chunk52PPNNI4cjs.EventBus)()));
|
|
1603
|
+
const rawMetrics = _chunk52PPNNI4cjs.makeMetrics.call(void 0, );
|
|
1536
1604
|
const metrics = options.cardinality === false ? rawMetrics : makeCardinalityLimitedMetrics(rawMetrics, _nullishCoalesce(options.cardinality, () => ( {})));
|
|
1537
1605
|
const redactor = makeObservabilityRedactor(options.redaction);
|
|
1538
1606
|
const traceOptions = options.traces && typeof options.traces === "object" ? options.traces : {};
|
|
1539
|
-
const tracer = new (0,
|
|
1607
|
+
const tracer = new (0, _chunk52PPNNI4cjs.InMemoryTracer)({
|
|
1540
1608
|
maxFinishedSpans: _nullishCoalesce(traceOptions.maxFinishedSpans, () => ( 1e4)),
|
|
1541
1609
|
maxSpanAgeMs: _nullishCoalesce(traceOptions.maxSpanAgeMs, () => ( 10 * 6e4)),
|
|
1542
1610
|
clock: traceOptions.clock,
|
|
@@ -1556,7 +1624,7 @@ function makeObservability(options = {}) {
|
|
|
1556
1624
|
childName: options.childName
|
|
1557
1625
|
}
|
|
1558
1626
|
});
|
|
1559
|
-
const env = makeEnv(options.traceSeed, _optionalChain([options, 'access',
|
|
1627
|
+
const env = makeEnv(options.traceSeed, _optionalChain([options, 'access', _173 => _173.traceSeed, 'optionalAccess', _174 => _174.baggage]));
|
|
1560
1628
|
const envForRequest = (input) => makeEnv(_nullishCoalesce(resolveRequestTraceSeed(input), () => ( options.traceSeed)), resolveRequestBaggage(input));
|
|
1561
1629
|
const resource = {
|
|
1562
1630
|
"service.name": serviceName,
|
|
@@ -1567,12 +1635,12 @@ function makeObservability(options = {}) {
|
|
|
1567
1635
|
const { prometheus: _prometheus, ...metricsOptions } = _nullishCoalesce(options.metrics, () => ( {}));
|
|
1568
1636
|
eventBus.subscribeHooks(makeRuntimeMetricsSink(metrics, metricsOptions));
|
|
1569
1637
|
}
|
|
1570
|
-
const logPipeline = options.logs !== false && _optionalChain([options, 'access',
|
|
1638
|
+
const logPipeline = options.logs !== false && _optionalChain([options, 'access', _175 => _175.otlp, 'optionalAccess', _176 => _176.logsUrl]) ? makeExportPipeline({
|
|
1571
1639
|
signal: "logs",
|
|
1572
1640
|
metrics,
|
|
1573
1641
|
..._nullishCoalesce(options.otlp.pipeline, () => ( {})),
|
|
1574
|
-
timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access',
|
|
1575
|
-
retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access',
|
|
1642
|
+
timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access', _177 => _177.otlp, 'access', _178 => _178.pipeline, 'optionalAccess', _179 => _179.timeoutMs]))),
|
|
1643
|
+
retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access', _180 => _180.otlp, 'access', _181 => _181.pipeline, 'optionalAccess', _182 => _182.retry]))),
|
|
1576
1644
|
exportBatch: async (records) => {
|
|
1577
1645
|
const body = JSON.stringify(structuredLogsToOtlp(records, {
|
|
1578
1646
|
resource,
|
|
@@ -1596,15 +1664,15 @@ function makeObservability(options = {}) {
|
|
|
1596
1664
|
write: (record) => {
|
|
1597
1665
|
if (configuredWrite) configuredWrite(record);
|
|
1598
1666
|
else defaultStructuredLogWriter(record);
|
|
1599
|
-
_optionalChain([logPipeline, 'optionalAccess',
|
|
1667
|
+
_optionalChain([logPipeline, 'optionalAccess', _183 => _183.enqueue, 'call', _184 => _184([record])]);
|
|
1600
1668
|
}
|
|
1601
1669
|
}));
|
|
1602
1670
|
}
|
|
1603
1671
|
if (options.traces !== false) {
|
|
1604
1672
|
eventBus.subscribeHooks(tracer);
|
|
1605
1673
|
}
|
|
1606
|
-
const prometheus = makePrometheusMetricsExporter(metrics, options.metrics !== false ? _optionalChain([options, 'access',
|
|
1607
|
-
const otlpMetrics = _optionalChain([options, 'access',
|
|
1674
|
+
const prometheus = makePrometheusMetricsExporter(metrics, options.metrics !== false ? _optionalChain([options, 'access', _185 => _185.metrics, 'optionalAccess', _186 => _186.prometheus]) : void 0);
|
|
1675
|
+
const otlpMetrics = _optionalChain([options, 'access', _187 => _187.otlp, 'optionalAccess', _188 => _188.metricsUrl]) ? makeOtlpHttpMetricsExporter(metrics, {
|
|
1608
1676
|
url: options.otlp.metricsUrl,
|
|
1609
1677
|
headers: options.otlp.headers,
|
|
1610
1678
|
fetch: options.otlp.fetch,
|
|
@@ -1615,11 +1683,11 @@ function makeObservability(options = {}) {
|
|
|
1615
1683
|
const otlpMetricsExporter = otlpMetrics ? {
|
|
1616
1684
|
export: async () => {
|
|
1617
1685
|
const result = await exportWithRetry(
|
|
1618
|
-
() => withTimeout(() => otlpMetrics.export(), _nullishCoalesce(_optionalChain([options, 'access',
|
|
1686
|
+
() => withTimeout(() => otlpMetrics.export(), _nullishCoalesce(_optionalChain([options, 'access', _189 => _189.otlp, 'optionalAccess', _190 => _190.timeoutMs]), () => ( 1e4))),
|
|
1619
1687
|
{
|
|
1620
1688
|
signal: "metrics",
|
|
1621
1689
|
metrics,
|
|
1622
|
-
retry: _optionalChain([options, 'access',
|
|
1690
|
+
retry: _optionalChain([options, 'access', _191 => _191.otlp, 'optionalAccess', _192 => _192.retry])
|
|
1623
1691
|
}
|
|
1624
1692
|
);
|
|
1625
1693
|
return result.value;
|
|
@@ -1628,12 +1696,12 @@ function makeObservability(options = {}) {
|
|
|
1628
1696
|
const exportedSpanIds = /* @__PURE__ */ new Set();
|
|
1629
1697
|
const queuedSpanIds = /* @__PURE__ */ new Set();
|
|
1630
1698
|
const pendingSpans = () => tracer.exportFinished().filter((span) => !exportedSpanIds.has(span.spanId) && !queuedSpanIds.has(span.spanId));
|
|
1631
|
-
const tracePipeline = _optionalChain([options, 'access',
|
|
1699
|
+
const tracePipeline = _optionalChain([options, 'access', _193 => _193.otlp, 'optionalAccess', _194 => _194.tracesUrl]) ? makeExportPipeline({
|
|
1632
1700
|
signal: "traces",
|
|
1633
1701
|
metrics,
|
|
1634
1702
|
..._nullishCoalesce(options.otlp.pipeline, () => ( {})),
|
|
1635
|
-
timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access',
|
|
1636
|
-
retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access',
|
|
1703
|
+
timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access', _195 => _195.otlp, 'access', _196 => _196.pipeline, 'optionalAccess', _197 => _197.timeoutMs]))),
|
|
1704
|
+
retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access', _198 => _198.otlp, 'access', _199 => _199.pipeline, 'optionalAccess', _200 => _200.retry]))),
|
|
1637
1705
|
exportBatch: async (spans) => {
|
|
1638
1706
|
const body = JSON.stringify(spansToOtlp(spans, {
|
|
1639
1707
|
resource,
|
|
@@ -1664,7 +1732,7 @@ function makeObservability(options = {}) {
|
|
|
1664
1732
|
for (const spanId of spanIds) exportedSpanIds.delete(spanId);
|
|
1665
1733
|
}
|
|
1666
1734
|
}) : void 0;
|
|
1667
|
-
const otlpTraces = _optionalChain([options, 'access',
|
|
1735
|
+
const otlpTraces = _optionalChain([options, 'access', _201 => _201.otlp, 'optionalAccess', _202 => _202.tracesUrl]) ? {
|
|
1668
1736
|
pipeline: tracePipeline,
|
|
1669
1737
|
export: async () => {
|
|
1670
1738
|
const spans = pendingSpans();
|
|
@@ -1709,7 +1777,7 @@ function makeObservability(options = {}) {
|
|
|
1709
1777
|
metricsResult = await otlpMetricsExporter.export();
|
|
1710
1778
|
} catch (error) {
|
|
1711
1779
|
errors.push({ signal: "metrics", error });
|
|
1712
|
-
_optionalChain([options, 'access',
|
|
1780
|
+
_optionalChain([options, 'access', _203 => _203.onFlushError, 'optionalCall', _204 => _204(error, "metrics")]);
|
|
1713
1781
|
}
|
|
1714
1782
|
}
|
|
1715
1783
|
if (otlpTraces) {
|
|
@@ -1717,7 +1785,7 @@ function makeObservability(options = {}) {
|
|
|
1717
1785
|
tracesResult = await otlpTraces.export();
|
|
1718
1786
|
} catch (error) {
|
|
1719
1787
|
errors.push({ signal: "traces", error });
|
|
1720
|
-
_optionalChain([options, 'access',
|
|
1788
|
+
_optionalChain([options, 'access', _205 => _205.onFlushError, 'optionalCall', _206 => _206(error, "traces")]);
|
|
1721
1789
|
}
|
|
1722
1790
|
}
|
|
1723
1791
|
if (otlpLogs) {
|
|
@@ -1725,7 +1793,7 @@ function makeObservability(options = {}) {
|
|
|
1725
1793
|
logsResult = await otlpLogs.export();
|
|
1726
1794
|
} catch (error) {
|
|
1727
1795
|
errors.push({ signal: "logs", error });
|
|
1728
|
-
_optionalChain([options, 'access',
|
|
1796
|
+
_optionalChain([options, 'access', _207 => _207.onFlushError, 'optionalCall', _208 => _208(error, "logs")]);
|
|
1729
1797
|
}
|
|
1730
1798
|
}
|
|
1731
1799
|
return { metrics: metricsResult, traces: tracesResult, logs: logsResult, errors };
|
|
@@ -1746,7 +1814,7 @@ function makeObservability(options = {}) {
|
|
|
1746
1814
|
interval = setInterval(() => {
|
|
1747
1815
|
void flush();
|
|
1748
1816
|
}, options.flushIntervalMs);
|
|
1749
|
-
_optionalChain([interval, 'access',
|
|
1817
|
+
_optionalChain([interval, 'access', _209 => _209.unref, 'optionalCall', _210 => _210()]);
|
|
1750
1818
|
};
|
|
1751
1819
|
const stop = () => {
|
|
1752
1820
|
if (!interval) return;
|
|
@@ -1760,10 +1828,10 @@ function makeObservability(options = {}) {
|
|
|
1760
1828
|
let traces = result.traces;
|
|
1761
1829
|
let logs = result.logs;
|
|
1762
1830
|
if (tracePipeline && tracePipeline.stats().queueSize > 0) {
|
|
1763
|
-
const drain = await tracePipeline.shutdown(_optionalChain([options, 'access',
|
|
1831
|
+
const drain = await tracePipeline.shutdown(_optionalChain([options, 'access', _211 => _211.otlp, 'optionalAccess', _212 => _212.pipeline, 'optionalAccess', _213 => _213.shutdownTimeoutMs]));
|
|
1764
1832
|
for (const error of drain.errors) {
|
|
1765
1833
|
drainErrors.push({ signal: "traces", error });
|
|
1766
|
-
_optionalChain([options, 'access',
|
|
1834
|
+
_optionalChain([options, 'access', _214 => _214.onFlushError, 'optionalCall', _215 => _215(error, "traces")]);
|
|
1767
1835
|
}
|
|
1768
1836
|
traces = _nullishCoalesce(traces, () => ( {
|
|
1769
1837
|
status: drain.status,
|
|
@@ -1772,10 +1840,10 @@ function makeObservability(options = {}) {
|
|
|
1772
1840
|
}));
|
|
1773
1841
|
}
|
|
1774
1842
|
if (logPipeline && logPipeline.stats().queueSize > 0) {
|
|
1775
|
-
const drain = await logPipeline.shutdown(_optionalChain([options, 'access',
|
|
1843
|
+
const drain = await logPipeline.shutdown(_optionalChain([options, 'access', _216 => _216.otlp, 'optionalAccess', _217 => _217.pipeline, 'optionalAccess', _218 => _218.shutdownTimeoutMs]));
|
|
1776
1844
|
for (const error of drain.errors) {
|
|
1777
1845
|
drainErrors.push({ signal: "logs", error });
|
|
1778
|
-
_optionalChain([options, 'access',
|
|
1846
|
+
_optionalChain([options, 'access', _219 => _219.onFlushError, 'optionalCall', _220 => _220(error, "logs")]);
|
|
1779
1847
|
}
|
|
1780
1848
|
logs = _nullishCoalesce(logs, () => ( {
|
|
1781
1849
|
status: drain.status,
|
|
@@ -1848,7 +1916,7 @@ function resolveRequestBaggage(input) {
|
|
|
1848
1916
|
const maybeRequest = input;
|
|
1849
1917
|
if (typeof maybeRequest.baggage === "string") return parseBaggage(maybeRequest.baggage);
|
|
1850
1918
|
if (maybeRequest.baggage) return maybeRequest.baggage;
|
|
1851
|
-
if (_optionalChain([maybeRequest, 'access',
|
|
1919
|
+
if (_optionalChain([maybeRequest, 'access', _221 => _221.trace, 'optionalAccess', _222 => _222.baggage])) return maybeRequest.trace.baggage;
|
|
1852
1920
|
if (maybeRequest.headers) return extractBaggage(maybeRequest.headers);
|
|
1853
1921
|
return extractBaggage(input);
|
|
1854
1922
|
}
|
|
@@ -1861,14 +1929,15 @@ function makeRuntimeTraceIdGenerator() {
|
|
|
1861
1929
|
newSpanId: () => randomHexId(16)
|
|
1862
1930
|
};
|
|
1863
1931
|
}
|
|
1932
|
+
var HEX_BYTE = Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0"));
|
|
1864
1933
|
function randomHexId(length) {
|
|
1865
1934
|
const cryptoLike = globalThis.crypto;
|
|
1866
|
-
if (typeof _optionalChain([cryptoLike, 'optionalAccess',
|
|
1935
|
+
if (typeof _optionalChain([cryptoLike, 'optionalAccess', _223 => _223.getRandomValues]) === "function") {
|
|
1867
1936
|
const bytes = new Uint8Array(Math.ceil(length / 2));
|
|
1868
1937
|
cryptoLike.getRandomValues(bytes);
|
|
1869
|
-
return
|
|
1938
|
+
return bytesToHex(bytes, length);
|
|
1870
1939
|
}
|
|
1871
|
-
if (typeof _optionalChain([cryptoLike, 'optionalAccess',
|
|
1940
|
+
if (typeof _optionalChain([cryptoLike, 'optionalAccess', _224 => _224.randomUUID]) === "function") {
|
|
1872
1941
|
const hex = cryptoLike.randomUUID().replace(/-/g, "");
|
|
1873
1942
|
if (hex.length >= length) return hex.slice(0, length);
|
|
1874
1943
|
}
|
|
@@ -1878,6 +1947,13 @@ function randomHexId(length) {
|
|
|
1878
1947
|
}
|
|
1879
1948
|
return out.slice(0, length);
|
|
1880
1949
|
}
|
|
1950
|
+
function bytesToHex(bytes, length) {
|
|
1951
|
+
let out = "";
|
|
1952
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
1953
|
+
out += HEX_BYTE[bytes[i]];
|
|
1954
|
+
}
|
|
1955
|
+
return out.length === length ? out : out.slice(0, length);
|
|
1956
|
+
}
|
|
1881
1957
|
|
|
1882
1958
|
// src/observability/request.ts
|
|
1883
1959
|
function makeRequestObservabilityContext(observability, input = {}) {
|
|
@@ -1885,7 +1961,7 @@ function makeRequestObservabilityContext(observability, input = {}) {
|
|
|
1885
1961
|
const env = observability.envForRequest(input);
|
|
1886
1962
|
const attributes = requestSpanAttributes(input);
|
|
1887
1963
|
const defaultSpanName = _nullishCoalesce(input.spanName, () => ( (input.method && input.route ? `${input.method} ${input.route}` : _nullishCoalesce(input.route, () => ( "request")))));
|
|
1888
|
-
const makeRuntime = (extraEnv, options = {}) => new (0,
|
|
1964
|
+
const makeRuntime = (extraEnv, options = {}) => new (0, _chunkGLE2WY7Zcjs.Runtime)({
|
|
1889
1965
|
...options,
|
|
1890
1966
|
env: mergeEnv(extraEnv, env),
|
|
1891
1967
|
hooks: observability.hooks
|
|
@@ -1943,23 +2019,23 @@ async function runObservedHttpServerEffect(observability, input, effect, options
|
|
|
1943
2019
|
);
|
|
1944
2020
|
}
|
|
1945
2021
|
function withServerSpanEvents(effect, options) {
|
|
1946
|
-
return
|
|
2022
|
+
return _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
1947
2023
|
effect,
|
|
1948
|
-
(error) =>
|
|
2024
|
+
(error) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
1949
2025
|
spanEvent("http.server.error", {
|
|
1950
2026
|
"http.response.status_code": 500,
|
|
1951
2027
|
"error.type": error instanceof Error ? error.name : typeof error
|
|
1952
2028
|
}),
|
|
1953
|
-
() =>
|
|
2029
|
+
() => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error)
|
|
1954
2030
|
),
|
|
1955
2031
|
(value) => {
|
|
1956
|
-
const statusCode = _nullishCoalesce(_optionalChain([options, 'access',
|
|
1957
|
-
return
|
|
2032
|
+
const statusCode = _nullishCoalesce(_optionalChain([options, 'access', _225 => _225.statusCode, 'optionalCall', _226 => _226(value)]), () => ( 200));
|
|
2033
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
1958
2034
|
spanEvent("http.server.response", {
|
|
1959
2035
|
"http.response.status_code": statusCode,
|
|
1960
2036
|
"http.outcome": statusCode >= 500 ? "error" : "success"
|
|
1961
2037
|
}),
|
|
1962
|
-
() =>
|
|
2038
|
+
() => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, value)
|
|
1963
2039
|
);
|
|
1964
2040
|
}
|
|
1965
2041
|
);
|
|
@@ -1969,8 +2045,8 @@ async function observeHttpServerRequest(observability, input, handler, options =
|
|
|
1969
2045
|
const ctx = makeRequestObservabilityContext(observability, input);
|
|
1970
2046
|
const startedAt = resolved.clock();
|
|
1971
2047
|
const baseLabels = requestBaseLabels(input, resolved);
|
|
1972
|
-
const inFlight = _optionalChain([resolved, 'access',
|
|
1973
|
-
_optionalChain([inFlight, 'optionalAccess',
|
|
2048
|
+
const inFlight = _optionalChain([resolved, 'access', _227 => _227.metrics, 'optionalAccess', _228 => _228.gauge, 'call', _229 => _229("brass_http_server_in_flight", baseLabels)]);
|
|
2049
|
+
_optionalChain([inFlight, 'optionalAccess', _230 => _230.increment, 'call', _231 => _231()]);
|
|
1974
2050
|
try {
|
|
1975
2051
|
await ctx.run(logHttpServerRequest(input, resolved));
|
|
1976
2052
|
const value = await handler(ctx);
|
|
@@ -2004,8 +2080,8 @@ function finishServerObservation(startedAt, input, trace, statusCode, outcome, o
|
|
|
2004
2080
|
outcome: statusCode >= 500 ? "error" : outcome,
|
|
2005
2081
|
status: String(statusCode)
|
|
2006
2082
|
};
|
|
2007
|
-
_optionalChain([options, 'access',
|
|
2008
|
-
_optionalChain([options, 'access',
|
|
2083
|
+
_optionalChain([options, 'access', _232 => _232.metrics, 'optionalAccess', _233 => _233.counter, 'call', _234 => _234("brass_http_server_requests_total", labels), 'access', _235 => _235.increment, 'call', _236 => _236()]);
|
|
2084
|
+
_optionalChain([options, 'access', _237 => _237.metrics, 'optionalAccess', _238 => _238.histogram, 'call', _239 => _239("brass_http_server_duration_ms", [..._nullishCoalesce(options.durationBuckets, () => ( DEFAULT_DURATION_BUCKETS2))], labels), 'access', _240 => _240.observe, 'call', _241 => _241(
|
|
2009
2085
|
durationMs,
|
|
2010
2086
|
exemplarFromTraceContext(trace, durationMs, startedAt + durationMs)
|
|
2011
2087
|
)]);
|
|
@@ -2039,7 +2115,7 @@ function logHttpServerError(input, error, durationMs, options) {
|
|
|
2039
2115
|
});
|
|
2040
2116
|
}
|
|
2041
2117
|
function logNoop() {
|
|
2042
|
-
return
|
|
2118
|
+
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
|
|
2043
2119
|
}
|
|
2044
2120
|
function serverSpanName(input, options) {
|
|
2045
2121
|
if (options.spans && options.spans.name) {
|
|
@@ -2048,7 +2124,7 @@ function serverSpanName(input, options) {
|
|
|
2048
2124
|
return input.method && input.route ? `${input.method} ${input.route}` : _nullishCoalesce(input.route, () => ( "request"));
|
|
2049
2125
|
}
|
|
2050
2126
|
function serverSpanAttributes(input, options) {
|
|
2051
|
-
const spanOptions = options.spans === false ? {} : _optionalChain([options, 'access',
|
|
2127
|
+
const spanOptions = options.spans === false ? {} : _optionalChain([options, 'access', _242 => _242.spans, 'optionalAccess', _243 => _243.attributes]);
|
|
2052
2128
|
const custom = typeof spanOptions === "function" ? spanOptions(input) : _nullishCoalesce(spanOptions, () => ( {}));
|
|
2053
2129
|
return {
|
|
2054
2130
|
"span.kind": "server",
|
|
@@ -2140,4 +2216,6 @@ function compactLabels(labels) {
|
|
|
2140
2216
|
|
|
2141
2217
|
|
|
2142
2218
|
|
|
2143
|
-
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
exports.snapshotRuntimeHealth = snapshotRuntimeHealth; exports.makeRuntimeHealth = makeRuntimeHealth; exports.runtimeHealth = runtimeHealth; exports.readiness = readiness; exports.healthToHttpResponse = healthToHttpResponse; exports.makeObservabilityRedactor = makeObservabilityRedactor; exports.parseTraceparent = parseTraceparent; exports.formatTraceparent = formatTraceparent; exports.extractTraceContext = extractTraceContext; exports.injectTraceContext = injectTraceContext; exports.parseBaggage = parseBaggage; exports.formatBaggage = formatBaggage; exports.extractBaggage = extractBaggage; exports.injectBaggage = injectBaggage; exports.normalizeTraceId = normalizeTraceId; exports.normalizeSpanId = normalizeSpanId; exports.PROMETHEUS_CONTENT_TYPE = PROMETHEUS_CONTENT_TYPE; exports.OTLP_JSON_CONTENT_TYPE = OTLP_JSON_CONTENT_TYPE; exports.makePrometheusMetricsExporter = makePrometheusMetricsExporter; exports.formatPrometheusMetrics = formatPrometheusMetrics; exports.metricsSnapshotToOtlp = metricsSnapshotToOtlp; exports.makeOtlpHttpMetricsExporter = makeOtlpHttpMetricsExporter; exports.makeRuntimeMetricsSink = makeRuntimeMetricsSink; exports.exemplarFromTraceContext = exemplarFromTraceContext; exports.toOtlpAttributes = toOtlpAttributes; exports.otlpAnyValue = otlpAnyValue; exports.postOtlpJson = postOtlpJson; exports.unixNanoFromMs = unixNanoFromMs; exports.makeStructuredLogSink = makeStructuredLogSink; exports.formatStructuredLog = formatStructuredLog; exports.structuredLogsToOtlp = structuredLogsToOtlp; exports.makeOtlpHttpLogExporter = makeOtlpHttpLogExporter; exports.logEffect = logEffect; exports.withLogContext = withLogContext; exports.defaultStructuredLogWriter = defaultStructuredLogWriter; exports.alwaysOnSampler = alwaysOnSampler; exports.alwaysOffSampler = alwaysOffSampler; exports.ratioSampler = ratioSampler; exports.makeTraceSampler = makeTraceSampler; exports.resolveTraceSampling = resolveTraceSampling; exports.shouldSampleWith = shouldSampleWith; exports.withSpan = withSpan; exports.spanLink = spanLink; exports.currentSpanLink = currentSpanLink; exports.withBaggage = withBaggage; exports.currentBaggage = currentBaggage; exports.spanEvent = spanEvent; exports.spansToOtlp = spansToOtlp; exports.makeOtlpHttpSpanExporter = makeOtlpHttpSpanExporter; exports.makeExportPipeline = makeExportPipeline; exports.exportWithRetry = exportWithRetry; exports.withTimeout = withTimeout; exports.makeCardinalityLimitedMetrics = makeCardinalityLimitedMetrics; exports.normalizeHttpRoute = normalizeHttpRoute; exports.sanitizeHttpTarget = sanitizeHttpTarget; exports.validateHttpObservabilityOptions = validateHttpObservabilityOptions; exports.makeOtlpOptions = makeOtlpOptions; exports.makeObservability = makeObservability; exports.resolveRequestTraceSeed = resolveRequestTraceSeed; exports.resolveRequestBaggage = resolveRequestBaggage; exports.makeRequestObservabilityContext = makeRequestObservabilityContext; exports.runObservedHttpServerEffect = runObservedHttpServerEffect; exports.observeHttpServerRequest = observeHttpServerRequest;
|