brass-runtime 1.16.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +283 -18
  3. package/dist/agent/cli/main.cjs +38 -38
  4. package/dist/agent/cli/main.js +6 -6
  5. package/dist/agent/cli/main.mjs +6 -6
  6. package/dist/agent/index.cjs +7 -7
  7. package/dist/agent/index.d.ts +1 -1
  8. package/dist/agent/index.js +6 -6
  9. package/dist/agent/index.mjs +6 -6
  10. package/dist/chunk-2HQTDLHF.mjs +683 -0
  11. package/dist/chunk-36I3M4UC.mjs +370 -0
  12. package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
  13. package/dist/chunk-3LOYJFRR.cjs +300 -0
  14. package/dist/chunk-3Y2RIUMM.js +300 -0
  15. package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
  16. package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
  17. package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
  18. package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
  19. package/dist/chunk-5QC7LRZ3.js +229 -0
  20. package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
  21. package/dist/chunk-62AZW6UT.cjs +313 -0
  22. package/dist/chunk-6IXXWIUM.js +683 -0
  23. package/dist/chunk-74ZTY6CP.js +2871 -0
  24. package/dist/chunk-76YMRMH2.cjs +777 -0
  25. package/dist/chunk-7CMJS3QE.mjs +2871 -0
  26. package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
  27. package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
  28. package/dist/chunk-AGR5B2BC.cjs +683 -0
  29. package/dist/chunk-AVNQLJ5V.js +777 -0
  30. package/dist/chunk-B33ICAKP.js +313 -0
  31. package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
  32. package/dist/chunk-BABBZK4Y.js +2024 -0
  33. package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
  34. package/dist/{chunk-F5EUMJL7.mjs → chunk-CIZFIMK5.js} +55 -5
  35. package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
  36. package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
  37. package/dist/chunk-DNFO2EIZ.mjs +777 -0
  38. package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
  39. package/dist/{chunk-JNFRRJYH.cjs → chunk-ENKODRU3.cjs} +242 -192
  40. package/dist/chunk-EOC4UHBS.mjs +229 -0
  41. package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
  42. package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
  43. package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
  44. package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
  45. package/dist/chunk-HLWLMW2F.mjs +2024 -0
  46. package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
  47. package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
  48. package/dist/chunk-KN32XNTH.mjs +313 -0
  49. package/dist/chunk-KQLYONSE.cjs +2871 -0
  50. package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
  51. package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
  52. package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
  53. package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
  54. package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
  55. package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
  56. package/dist/{chunk-7XOPAB5Q.js → chunk-MT3OWDPC.mjs} +55 -5
  57. package/dist/chunk-MVGUEJ5Z.cjs +370 -0
  58. package/dist/chunk-PD4EJTQC.cjs +229 -0
  59. package/dist/chunk-PWC3RBQE.mjs +300 -0
  60. package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
  61. package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
  62. package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
  63. package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
  64. package/dist/chunk-UB4B6OFY.js +370 -0
  65. package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
  66. package/dist/chunk-VN44DYYT.cjs +2024 -0
  67. package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
  68. package/dist/core/index.cjs +135 -9
  69. package/dist/core/index.d.ts +238 -33
  70. package/dist/core/index.js +155 -29
  71. package/dist/core/index.mjs +155 -29
  72. package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
  73. package/dist/effectRunner-CFLC32IK.cjs +8 -0
  74. package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
  75. package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
  76. package/dist/http/index.cjs +324 -2986
  77. package/dist/http/index.d.ts +54 -68
  78. package/dist/http/index.js +238 -2900
  79. package/dist/http/index.mjs +238 -2900
  80. package/dist/http/testing.cjs +14 -12
  81. package/dist/http/testing.d.ts +5 -4
  82. package/dist/http/testing.js +10 -8
  83. package/dist/http/testing.mjs +10 -8
  84. package/dist/index.cjs +423 -255
  85. package/dist/index.d.ts +87 -69
  86. package/dist/index.js +301 -133
  87. package/dist/index.mjs +301 -133
  88. package/dist/observability/index.cjs +16 -531
  89. package/dist/observability/index.d.ts +81 -8
  90. package/dist/observability/index.js +23 -538
  91. package/dist/observability/index.mjs +23 -538
  92. package/dist/perf/cli.cjs +401 -0
  93. package/dist/perf/cli.d.ts +1 -0
  94. package/dist/perf/cli.js +401 -0
  95. package/dist/perf/cli.mjs +401 -0
  96. package/dist/perf/index.cjs +141 -0
  97. package/dist/perf/index.d.ts +483 -0
  98. package/dist/perf/index.js +141 -0
  99. package/dist/perf/index.mjs +141 -0
  100. package/dist/schedule-CK3Ml_7p.d.ts +259 -0
  101. package/dist/schema/index.cjs +6 -2
  102. package/dist/schema/index.d.ts +3 -1
  103. package/dist/schema/index.js +5 -1
  104. package/dist/schema/index.mjs +5 -1
  105. package/dist/{server-C8hDXA74.d.ts → server-GJPg8ZSG.d.ts} +4 -3
  106. package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
  107. package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
  108. package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
  109. package/docs/ARCHITECTURE.md +292 -0
  110. package/docs/README.md +63 -0
  111. package/docs/adr/0001-ai-context-pack.md +32 -0
  112. package/docs/agent-apply-mode.md +104 -0
  113. package/docs/agent-approvals.md +110 -0
  114. package/docs/agent-batch.md +185 -0
  115. package/docs/agent-boundaries.md +112 -0
  116. package/docs/agent-chat-sessions.md +160 -0
  117. package/docs/agent-ci.md +17 -0
  118. package/docs/agent-cli.md +405 -0
  119. package/docs/agent-config.md +480 -0
  120. package/docs/agent-context-discovery.md +159 -0
  121. package/docs/agent-copilot-like-dx.md +126 -0
  122. package/docs/agent-declarative-optimized-planning.md +138 -0
  123. package/docs/agent-dx.md +224 -0
  124. package/docs/agent-env-files.md +126 -0
  125. package/docs/agent-follow-up-context.md +43 -0
  126. package/docs/agent-global-usage.md +180 -0
  127. package/docs/agent-init.md +109 -0
  128. package/docs/agent-install-and-configure.md +516 -0
  129. package/docs/agent-language-workspace-ux.md +99 -0
  130. package/docs/agent-llm-adapters.md +123 -0
  131. package/docs/agent-local-install.md +190 -0
  132. package/docs/agent-local-tests.md +51 -0
  133. package/docs/agent-observability.md +155 -0
  134. package/docs/agent-patch-quality-loop.md +162 -0
  135. package/docs/agent-presets.md +22 -0
  136. package/docs/agent-project-commands.md +237 -0
  137. package/docs/agent-project-intelligence.md +156 -0
  138. package/docs/agent-redaction.md +18 -0
  139. package/docs/agent-release-readiness.md +76 -0
  140. package/docs/agent-rollback-safety.md +162 -0
  141. package/docs/agent-rollback.md +23 -0
  142. package/docs/agent-run-artifacts.md +16 -0
  143. package/docs/agent-vscode-auto-discovery.md +137 -0
  144. package/docs/agent-vscode-batch-runner.md +100 -0
  145. package/docs/agent-vscode-chat-layout.md +90 -0
  146. package/docs/agent-vscode-clean-install.md +147 -0
  147. package/docs/agent-vscode-code-actions.md +70 -0
  148. package/docs/agent-vscode-diff-preview.md +45 -0
  149. package/docs/agent-vscode-inline-assist.md +56 -0
  150. package/docs/agent-vscode-install.md +186 -0
  151. package/docs/agent-vscode-model-setup.md +97 -0
  152. package/docs/agent-vscode-patch-preview.md +92 -0
  153. package/docs/agent-vscode-problems.md +79 -0
  154. package/docs/agent-vscode-project-dashboard.md +106 -0
  155. package/docs/agent-vscode-run-history.md +92 -0
  156. package/docs/agent-vscode-ux.md +73 -0
  157. package/docs/ai/INVARIANTS.md +84 -0
  158. package/docs/ai/PROJECT_MAP.md +338 -0
  159. package/docs/ai/PUBLIC_API.md +336 -0
  160. package/docs/ai/VALIDATION_MATRIX.md +67 -0
  161. package/docs/api-polish.md +37 -0
  162. package/docs/cancellation.md +162 -0
  163. package/docs/coverage.md +46 -0
  164. package/docs/getting-started.md +159 -0
  165. package/docs/guides/README.md +40 -0
  166. package/docs/guides/circuit-breaker.md +89 -0
  167. package/docs/guides/error-handling.md +91 -0
  168. package/docs/guides/getting-started.md +107 -0
  169. package/docs/guides/layers.md +189 -0
  170. package/docs/guides/metrics.md +101 -0
  171. package/docs/guides/resource-management.md +141 -0
  172. package/docs/guides/retry.md +215 -0
  173. package/docs/guides/semaphore.md +66 -0
  174. package/docs/guides/streams.md +117 -0
  175. package/docs/guides/supervisors.md +98 -0
  176. package/docs/guides/testing.md +162 -0
  177. package/docs/guides/tracing.md +71 -0
  178. package/docs/http-recipes.md +399 -0
  179. package/docs/http.md +749 -0
  180. package/docs/modules.md +285 -0
  181. package/docs/observability-collector-smoke.md +31 -0
  182. package/docs/observability-framework-examples.md +98 -0
  183. package/docs/observability.md +542 -0
  184. package/docs/otel-collector-smoke.yaml +27 -0
  185. package/docs/performance-profiler.md +199 -0
  186. package/docs/production-readiness.md +73 -0
  187. package/docs/recipes/README.md +12 -0
  188. package/docs/recipes/http-server.md +45 -0
  189. package/docs/recipes/layers.md +44 -0
  190. package/docs/recipes/performance.md +47 -0
  191. package/docs/recipes/runtime.md +41 -0
  192. package/docs/recipes/testing.md +41 -0
  193. package/docs/release.md +53 -0
  194. package/docs/wasm-bounded-queues.md +44 -0
  195. package/docs/wasm-engine-observability-benchmarks.md +85 -0
  196. package/docs/wasm-fiber-engine.md +117 -0
  197. package/docs/wasm-scheduler-state-machine.md +122 -0
  198. package/docs/wasm-stream-chunks.md +54 -0
  199. package/package.json +22 -2
  200. package/dist/chunk-45F7OKGT.cjs +0 -104
  201. package/dist/chunk-7V4KY4RL.mjs +0 -104
  202. package/dist/chunk-DJQ7OMMB.cjs +0 -144
  203. package/dist/chunk-GOV47PPB.mjs +0 -552
  204. package/dist/chunk-JF4XXPZ5.cjs +0 -552
  205. package/dist/chunk-KCPT2D6G.js +0 -552
  206. package/dist/chunk-NOYZIMUJ.mjs +0 -144
  207. package/dist/chunk-PNVFW245.js +0 -144
  208. package/dist/chunk-ROJC3NBJ.js +0 -104
  209. package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
  210. package/dist/schedule-Fque9Abz.d.ts +0 -70
@@ -2,29 +2,29 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkJX3LZQJHcjs = require('./chunk-JX3LZQJH.cjs');
5
+ var _chunk52PPNNI4cjs = require('./chunk-52PPNNI4.cjs');
6
6
 
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunkWQ5QNU5Rcjs = require('./chunk-WQ5QNU5R.cjs');
12
+ var _chunkGLE2WY7Zcjs = require('./chunk-GLE2WY7Z.cjs');
13
13
 
14
14
 
15
15
 
16
16
 
17
17
 
18
18
 
19
- var _chunkDJQ7OMMBcjs = require('./chunk-DJQ7OMMB.cjs');
19
+ var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
20
20
 
21
21
 
22
22
 
23
- var _chunkSPUEME2Bcjs = require('./chunk-SPUEME2B.cjs');
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', _ => _.clock, 'optionalCall', _2 => _2()]), () => ( Date.now()));
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', _3 => _3.readiness, 'optionalAccess', _4 => _4.failOnDegraded]) !== true,
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => snapshotRuntimeHealth(options));
55
+ return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => snapshotRuntimeHealth(options));
56
56
  }
57
57
  var runtimeHealth = makeRuntimeHealth;
58
58
  function readiness(options = {}) {
59
- return _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => snapshotRuntimeHealth(options).ready);
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', _5 => _5.gauges, 'access', _6 => _6.find, 'call', _7 => _7((gauge) => gauge.name === name), 'optionalAccess', _8 => _8.value]);
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', _9 => _9.stats, 'optionalCall', _10 => _10()]);
140
- const scheduler = _optionalChain([runtime, 'access', _11 => _11.scheduler, 'optionalAccess', _12 => _12.stats, 'optionalCall', _13 => _13()]);
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', _14 => _14.engine]),
143
- fiberStats: _optionalChain([stats, 'optionalAccess', _15 => _15.data]),
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', _16 => _16.scheduler, 'optionalAccess', _17 => _17.data]);
149
- return typeof _optionalChain([data, 'optionalAccess', _18 => _18.droppedTasks]) === "number" ? data.droppedTasks : 0;
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', _19 => _19[Symbol.iterator]]) === "function";
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', _20 => _20.now, 'optionalCall', _21 => _21()]), () => ( Date.now())));
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', _22 => _22.help, 'optionalAccess', _23 => _23[name]])) lines.push(`# HELP ${safeName} ${escapeHelp(options.help[name])}`);
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', _24 => _24.exemplars, 'optionalAccess', _25 => _25[i]]));
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', _26 => _26.exemplars, 'optionalAccess', _27 => _27[buckets.boundaries.length]]));
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', _28 => _28.now, 'optionalCall', _29 => _29()]), () => ( Date.now())));
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', _30 => _30.traceId]) || !_optionalChain([trace, 'optionalAccess', _31 => _31.spanId])) return void 0;
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', _32 => _32.ok]) === false) {
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
799
- const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
800
- const runtime = _optionalChain([fiber, 'optionalAccess', _33 => _33.runtime]);
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', _34 => _34.fiberContext, 'optionalAccess', _35 => _35.log]) ? _chunkWQ5QNU5Rcjs.ctxToObject.call(void 0, fiber.fiberContext.log) : {};
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 _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
807
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
808
808
  startLogContext(patch),
809
- (state) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
809
+ (state) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
810
810
  effect,
811
- (error) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, endLogContext(state), () => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error)),
812
- (value) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, endLogContext(state), () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, 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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
818
- const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
819
- if (!_optionalChain([fiber, 'optionalAccess', _36 => _36.fiberContext])) return void 0;
820
- const previous = _nullishCoalesce(fiber.fiberContext.log, () => ( _chunkWQ5QNU5Rcjs.emptyContext));
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: _chunkWQ5QNU5Rcjs.ctxExtend.call(void 0, previous, patch) };
823
- _optionalChain([fiber, 'access', _37 => _37.addFinalizer, 'optionalCall', _38 => _38(() => restoreLogContext(state))]);
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => restoreLogContext(state));
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', _39 => _39.fiber, 'optionalAccess', _40 => _40.fiberContext])) {
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', _41 => _41.respectRemoteSampled]), () => ( true)),
925
- forceSampleOnError: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _42 => _42.forceSampleOnError]), () => ( false))
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', _43 => _43.attributes, 'optionalAccess', _44 => _44["http.route"]]))) return false;
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 _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
960
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
961
961
  startSpan(name, options),
962
- (state) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
962
+ (state) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
963
963
  effect,
964
- (error) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, endSpan(state, "failure", error), () => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error)),
965
- (value) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, endSpan(state, "success"), () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, 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 = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
979
- const trace = _optionalChain([fiber, 'optionalAccess', _45 => _45.fiberContext, 'optionalAccess', _46 => _46.trace]);
980
- return _optionalChain([trace, 'optionalAccess', _47 => _47.traceId]) && _optionalChain([trace, 'optionalAccess', _48 => _48.spanId]) ? spanLink(trace, attributes) : void 0;
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 _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
983
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
984
984
  startBaggage(baggage),
985
- (state) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
985
+ (state) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
986
986
  effect,
987
- (error) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, endBaggage(state), () => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error)),
988
- (value) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, endBaggage(state), () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, 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 = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
994
- const baggage = _optionalChain([fiber, 'optionalAccess', _49 => _49.fiberContext, 'optionalAccess', _50 => _50.trace, 'optionalAccess', _51 => _51.baggage]);
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
999
- const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
1000
- const trace = _optionalChain([fiber, 'optionalAccess', _52 => _52.fiberContext, 'optionalAccess', _53 => _53.trace]);
1001
- if (!_optionalChain([fiber, 'optionalAccess', _54 => _54.runtime]) || !trace || trace.sampled === false) return;
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
1033
- const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
1034
- const runtime = _optionalChain([fiber, 'optionalAccess', _55 => _55.runtime]);
1035
- if (!_optionalChain([fiber, 'optionalAccess', _56 => _56.fiberContext]) || !runtime) return void 0;
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', _57 => _57.traceId]), () => ( tracer.newTraceId()));
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', _58 => _58.sampled]),
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', _59 => _59.spanId]),
1048
+ parentSpanId: _optionalChain([previousTrace, 'optionalAccess', _60 => _60.spanId]),
1049
1049
  sampled,
1050
- traceState: _optionalChain([previousTrace, 'optionalAccess', _60 => _60.traceState]),
1051
- ..._optionalChain([previousTrace, 'optionalAccess', _61 => _61.baggage]) ? { baggage: previousTrace.baggage } : {}
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', _62 => _62.env, 'optionalAccess', _63 => _63.brass, 'optionalAccess', _64 => _64.forceSampleOnError]) === true,
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', _65 => _65.addFinalizer, 'optionalCall', _66 => _66((exit) => {
1066
- const status = _optionalChain([exit, 'optionalAccess', _67 => _67._tag]) === "Success" ? "success" : _optionalChain([exit, 'optionalAccess', _68 => _68.cause, 'optionalAccess', _69 => _69._tag]) === "Interrupt" ? "interrupted" : "failure";
1067
- finishSpan(state, status, _optionalChain([exit, 'optionalAccess', _70 => _70._tag]) === "Failure" ? exit.cause : void 0);
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => finishSpan(state, status, error));
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', _71 => _71.fiber, 'optionalAccess', _72 => _72.fiberContext])) {
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', _73 => _73.id]),
1105
- scopeId: _optionalChain([fiber, 'optionalAccess', _74 => _74.scopeId]),
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
1116
- const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
1117
- if (!_optionalChain([fiber, 'optionalAccess', _75 => _75.fiberContext])) return void 0;
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', _76 => _76.addFinalizer, 'optionalCall', _77 => _77(() => restoreBaggage(state))]);
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 _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => restoreBaggage(state));
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', _78 => _78.fiber, 'optionalAccess', _79 => _79.fiberContext])) {
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', _80 => _80.env, 'optionalAccess', _81 => _81.brass]);
1147
- if (input.parentSampled === false && _optionalChain([brass, 'optionalAccess', _82 => _82.respectRemoteSampled]) !== false) return false;
1148
- return shouldSampleWith(_optionalChain([brass, 'optionalAccess', _83 => _83.sampler]), input);
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', _84 => _84.env, 'optionalAccess', _85 => _85.brass, 'optionalAccess', _86 => _86.tracer]);
1152
- if (_optionalChain([tracer, 'optionalAccess', _87 => _87.newTraceId]) && _optionalChain([tracer, 'optionalAccess', _88 => _88.newSpanId])) return tracer;
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', _89 => _89.attrs]) === "object" && end.attrs != null ? end.attrs.status : void 0;
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', _90 => _90.randomUUID]) === "function") return cryptoLike.randomUUID();
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', _91 => _91.metrics, 'optionalAccess', _92 => _92.gauge, 'call', _93 => _93("brass_export_queue_size", { signal })]);
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', _94 => _94.set, 'call', _95 => _95(queue.length)]);
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', _96 => _96.metrics, 'optionalAccess', _97 => _97.counter, 'call', _98 => _98("brass_export_dropped_total", { signal }), 'access', _99 => _99.increment, 'call', _100 => _100(items.length)]);
1259
- _optionalChain([options, 'access', _101 => _101.onDrop, 'optionalCall', _102 => _102(items)]);
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', _103 => _103.metrics, 'optionalAccess', _104 => _104.counter, 'call', _105 => _105("brass_export_enqueued_total", { signal }), 'access', _106 => _106.increment, 'call', _107 => _107(incoming.length)]);
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', _108 => _108.metrics, 'optionalAccess', _109 => _109.counter, 'call', _110 => _110("brass_export_enqueued_total", { signal }), 'access', _111 => _111.increment, 'call', _112 => _112(accepted.length)]);
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', _113 => _113.metrics, 'optionalAccess', _114 => _114.counter, 'call', _115 => _115("brass_export_enqueued_total", { signal }), 'access', _116 => _116.increment, 'call', _117 => _117(incoming.length)]);
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', _118 => _118.metrics, 'optionalAccess', _119 => _119.counter, 'call', _120 => _120("brass_export_batches_total", { signal, status: "success" }), 'access', _121 => _121.increment, 'call', _122 => _122()]);
1324
- _optionalChain([options, 'access', _123 => _123.metrics, 'optionalAccess', _124 => _124.counter, 'call', _125 => _125("brass_export_items_total", { signal, status: "success" }), 'access', _126 => _126.increment, 'call', _127 => _127(batch.length)]);
1325
- _optionalChain([options, 'access', _128 => _128.metrics, 'optionalAccess', _129 => _129.histogram, 'call', _130 => _130("brass_export_batch_duration_ms", void 0, { signal, status: "success" }), 'access', _131 => _131.observe, 'call', _132 => _132(clock() - batchStartedAt)]);
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', _133 => _133.metrics, 'optionalAccess', _134 => _134.counter, 'call', _135 => _135("brass_export_batches_total", { signal, status: "failure" }), 'access', _136 => _136.increment, 'call', _137 => _137()]);
1331
- _optionalChain([options, 'access', _138 => _138.metrics, 'optionalAccess', _139 => _139.counter, 'call', _140 => _140("brass_export_items_total", { signal, status: "failure" }), 'access', _141 => _141.increment, 'call', _142 => _142(batch.length)]);
1332
- _optionalChain([options, 'access', _143 => _143.metrics, 'optionalAccess', _144 => _144.histogram, 'call', _145 => _145("brass_export_batch_duration_ms", void 0, { signal, status: "failure" }), 'access', _146 => _146.observe, 'call', _147 => _147(clock() - batchStartedAt)]);
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', _148 => _148.metrics, 'optionalAccess', _149 => _149.histogram, 'call', _150 => _150("brass_export_flush_duration_ms", void 0, { signal }), 'access', _151 => _151.observe, 'call', _152 => _152(clock() - startedAt)]);
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', _153 => _153.retry, 'optionalAccess', _154 => _154.attempts]), () => ( 1))));
1360
- const initialDelayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'access', _155 => _155.retry, 'optionalAccess', _156 => _156.initialDelayMs]), () => ( 100)));
1361
- const maxDelayMs = Math.max(initialDelayMs, _nullishCoalesce(_optionalChain([options, 'access', _157 => _157.retry, 'optionalAccess', _158 => _158.maxDelayMs]), () => ( 2e3)));
1362
- const jitterRatio = Math.max(0, Math.min(1, _nullishCoalesce(_optionalChain([options, 'access', _159 => _159.retry, 'optionalAccess', _160 => _160.jitterRatio]), () => ( 0.2))));
1363
- const sleep = _nullishCoalesce(_optionalChain([options, 'access', _161 => _161.retry, 'optionalAccess', _162 => _162.sleep]), () => ( defaultSleep));
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', _163 => _163.metrics, 'optionalAccess', _164 => _164.counter, 'call', _165 => _165("brass_export_retries_total", { signal: options.signal }), 'access', _166 => _166.increment, 'call', _167 => _167()]);
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', _168 => _168.unref, 'optionalCall', _169 => _169()]);
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', _170 => _170.unref, 'optionalCall', _171 => _171()]);
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 = _chunkSPUEME2Bcjs.Schema.custom((value) => typeof value === "function", "function");
1459
- var object = _chunkSPUEME2Bcjs.Schema.custom(
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 = _chunkSPUEME2Bcjs.Schema.union([_chunkSPUEME2Bcjs.Schema.literal(false), object]);
1464
- var ratio = _chunkSPUEME2Bcjs.Schema.number({ min: 0, max: 1 });
1465
- var retryOptions = _chunkSPUEME2Bcjs.Schema.object({
1466
- attempts: _chunkSPUEME2Bcjs.Schema.number({ min: 0, int: true }).optional(),
1467
- initialDelayMs: _chunkSPUEME2Bcjs.Schema.number({ min: 0, int: true }).optional(),
1468
- maxDelayMs: _chunkSPUEME2Bcjs.Schema.number({ min: 0, int: true }).optional(),
1469
- jitterRatio: _chunkSPUEME2Bcjs.Schema.number({ min: 0, max: 1 }).optional(),
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 = _chunkSPUEME2Bcjs.Schema.object({
1473
- maxQueueSize: _chunkSPUEME2Bcjs.Schema.number({ min: 0, int: true }).optional(),
1474
- batchSize: _chunkSPUEME2Bcjs.Schema.number({ min: 1, int: true }).optional(),
1475
- timeoutMs: _chunkSPUEME2Bcjs.Schema.number({ min: 0, int: true }).optional(),
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: _chunkSPUEME2Bcjs.Schema.enum(["drop-oldest", "drop-newest"]).optional(),
1478
- shutdownTimeoutMs: _chunkSPUEME2Bcjs.Schema.number({ min: 0, int: true }).optional()
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 = _chunkSPUEME2Bcjs.Schema.object({
1481
- metricsUrl: _chunkSPUEME2Bcjs.Schema.string().optional(),
1482
- tracesUrl: _chunkSPUEME2Bcjs.Schema.string().optional(),
1483
- logsUrl: _chunkSPUEME2Bcjs.Schema.string().optional(),
1484
- headers: _chunkSPUEME2Bcjs.Schema.record(_chunkSPUEME2Bcjs.Schema.string()).optional(),
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: _chunkSPUEME2Bcjs.Schema.number({ min: 1, int: true }).optional(),
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 = _chunkSPUEME2Bcjs.Schema.union([
1491
- _chunkSPUEME2Bcjs.Schema.literal(false),
1491
+ var samplingOptions = _chunkCZIVE6NTcjs.Schema.union([
1492
+ _chunkCZIVE6NTcjs.Schema.literal(false),
1492
1493
  ratio,
1493
1494
  fn,
1494
- _chunkSPUEME2Bcjs.Schema.object({
1495
+ _chunkCZIVE6NTcjs.Schema.object({
1495
1496
  ratio: ratio.optional(),
1496
- rules: _chunkSPUEME2Bcjs.Schema.array(object).optional(),
1497
- sampler: _chunkSPUEME2Bcjs.Schema.union([fn, object]).optional(),
1498
- respectRemoteSampled: _chunkSPUEME2Bcjs.Schema.boolean().optional(),
1499
- forceSampleOnError: _chunkSPUEME2Bcjs.Schema.boolean().optional()
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 = _chunkSPUEME2Bcjs.Schema.object({
1503
- serviceName: _chunkSPUEME2Bcjs.Schema.string({ minLength: 1 }).optional(),
1504
- serviceVersion: _chunkSPUEME2Bcjs.Schema.string({ minLength: 1 }).optional(),
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,74 @@ var observabilityOptions = _chunkSPUEME2Bcjs.Schema.object({
1509
1510
  traces: falseOrObject.optional(),
1510
1511
  sampling: samplingOptions.optional(),
1511
1512
  redaction: falseOrObject.optional(),
1512
- cardinality: _chunkSPUEME2Bcjs.Schema.union([
1513
- _chunkSPUEME2Bcjs.Schema.literal(false),
1514
- _chunkSPUEME2Bcjs.Schema.object({
1515
- maxValuesPerLabel: _chunkSPUEME2Bcjs.Schema.number({ min: 1, int: true }).optional(),
1516
- overflowValue: _chunkSPUEME2Bcjs.Schema.string({ minLength: 1 }).optional()
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: _chunkSPUEME2Bcjs.Schema.number({ min: 1, int: true }).optional(),
1521
- autoStart: _chunkSPUEME2Bcjs.Schema.boolean().optional(),
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
- _chunkSPUEME2Bcjs.parseConfig.call(void 0, "ObservabilityOptions", observabilityOptions, options);
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
1531
1572
  function makeObservability(options = {}) {
1532
1573
  validateObservabilityOptions(options);
1533
1574
  const serviceName = _nullishCoalesce(options.serviceName, () => ( "brass-runtime"));
1534
- const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0, _chunkJX3LZQJHcjs.EventBus)()));
1535
- const rawMetrics = _chunkJX3LZQJHcjs.makeMetrics.call(void 0, );
1575
+ const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0, _chunk52PPNNI4cjs.EventBus)()));
1576
+ const rawMetrics = _chunk52PPNNI4cjs.makeMetrics.call(void 0, );
1536
1577
  const metrics = options.cardinality === false ? rawMetrics : makeCardinalityLimitedMetrics(rawMetrics, _nullishCoalesce(options.cardinality, () => ( {})));
1537
1578
  const redactor = makeObservabilityRedactor(options.redaction);
1538
1579
  const traceOptions = options.traces && typeof options.traces === "object" ? options.traces : {};
1539
- const tracer = new (0, _chunkJX3LZQJHcjs.InMemoryTracer)({
1580
+ const tracer = new (0, _chunk52PPNNI4cjs.InMemoryTracer)({
1540
1581
  maxFinishedSpans: _nullishCoalesce(traceOptions.maxFinishedSpans, () => ( 1e4)),
1541
1582
  maxSpanAgeMs: _nullishCoalesce(traceOptions.maxSpanAgeMs, () => ( 10 * 6e4)),
1542
1583
  clock: traceOptions.clock,
@@ -1556,7 +1597,7 @@ function makeObservability(options = {}) {
1556
1597
  childName: options.childName
1557
1598
  }
1558
1599
  });
1559
- const env = makeEnv(options.traceSeed, _optionalChain([options, 'access', _172 => _172.traceSeed, 'optionalAccess', _173 => _173.baggage]));
1600
+ const env = makeEnv(options.traceSeed, _optionalChain([options, 'access', _173 => _173.traceSeed, 'optionalAccess', _174 => _174.baggage]));
1560
1601
  const envForRequest = (input) => makeEnv(_nullishCoalesce(resolveRequestTraceSeed(input), () => ( options.traceSeed)), resolveRequestBaggage(input));
1561
1602
  const resource = {
1562
1603
  "service.name": serviceName,
@@ -1567,12 +1608,12 @@ function makeObservability(options = {}) {
1567
1608
  const { prometheus: _prometheus, ...metricsOptions } = _nullishCoalesce(options.metrics, () => ( {}));
1568
1609
  eventBus.subscribeHooks(makeRuntimeMetricsSink(metrics, metricsOptions));
1569
1610
  }
1570
- const logPipeline = options.logs !== false && _optionalChain([options, 'access', _174 => _174.otlp, 'optionalAccess', _175 => _175.logsUrl]) ? makeExportPipeline({
1611
+ const logPipeline = options.logs !== false && _optionalChain([options, 'access', _175 => _175.otlp, 'optionalAccess', _176 => _176.logsUrl]) ? makeExportPipeline({
1571
1612
  signal: "logs",
1572
1613
  metrics,
1573
1614
  ..._nullishCoalesce(options.otlp.pipeline, () => ( {})),
1574
- timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access', _176 => _176.otlp, 'access', _177 => _177.pipeline, 'optionalAccess', _178 => _178.timeoutMs]))),
1575
- retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access', _179 => _179.otlp, 'access', _180 => _180.pipeline, 'optionalAccess', _181 => _181.retry]))),
1615
+ timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access', _177 => _177.otlp, 'access', _178 => _178.pipeline, 'optionalAccess', _179 => _179.timeoutMs]))),
1616
+ retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access', _180 => _180.otlp, 'access', _181 => _181.pipeline, 'optionalAccess', _182 => _182.retry]))),
1576
1617
  exportBatch: async (records) => {
1577
1618
  const body = JSON.stringify(structuredLogsToOtlp(records, {
1578
1619
  resource,
@@ -1596,15 +1637,15 @@ function makeObservability(options = {}) {
1596
1637
  write: (record) => {
1597
1638
  if (configuredWrite) configuredWrite(record);
1598
1639
  else defaultStructuredLogWriter(record);
1599
- _optionalChain([logPipeline, 'optionalAccess', _182 => _182.enqueue, 'call', _183 => _183([record])]);
1640
+ _optionalChain([logPipeline, 'optionalAccess', _183 => _183.enqueue, 'call', _184 => _184([record])]);
1600
1641
  }
1601
1642
  }));
1602
1643
  }
1603
1644
  if (options.traces !== false) {
1604
1645
  eventBus.subscribeHooks(tracer);
1605
1646
  }
1606
- const prometheus = makePrometheusMetricsExporter(metrics, options.metrics !== false ? _optionalChain([options, 'access', _184 => _184.metrics, 'optionalAccess', _185 => _185.prometheus]) : void 0);
1607
- const otlpMetrics = _optionalChain([options, 'access', _186 => _186.otlp, 'optionalAccess', _187 => _187.metricsUrl]) ? makeOtlpHttpMetricsExporter(metrics, {
1647
+ const prometheus = makePrometheusMetricsExporter(metrics, options.metrics !== false ? _optionalChain([options, 'access', _185 => _185.metrics, 'optionalAccess', _186 => _186.prometheus]) : void 0);
1648
+ const otlpMetrics = _optionalChain([options, 'access', _187 => _187.otlp, 'optionalAccess', _188 => _188.metricsUrl]) ? makeOtlpHttpMetricsExporter(metrics, {
1608
1649
  url: options.otlp.metricsUrl,
1609
1650
  headers: options.otlp.headers,
1610
1651
  fetch: options.otlp.fetch,
@@ -1615,11 +1656,11 @@ function makeObservability(options = {}) {
1615
1656
  const otlpMetricsExporter = otlpMetrics ? {
1616
1657
  export: async () => {
1617
1658
  const result = await exportWithRetry(
1618
- () => withTimeout(() => otlpMetrics.export(), _nullishCoalesce(_optionalChain([options, 'access', _188 => _188.otlp, 'optionalAccess', _189 => _189.timeoutMs]), () => ( 1e4))),
1659
+ () => withTimeout(() => otlpMetrics.export(), _nullishCoalesce(_optionalChain([options, 'access', _189 => _189.otlp, 'optionalAccess', _190 => _190.timeoutMs]), () => ( 1e4))),
1619
1660
  {
1620
1661
  signal: "metrics",
1621
1662
  metrics,
1622
- retry: _optionalChain([options, 'access', _190 => _190.otlp, 'optionalAccess', _191 => _191.retry])
1663
+ retry: _optionalChain([options, 'access', _191 => _191.otlp, 'optionalAccess', _192 => _192.retry])
1623
1664
  }
1624
1665
  );
1625
1666
  return result.value;
@@ -1628,12 +1669,12 @@ function makeObservability(options = {}) {
1628
1669
  const exportedSpanIds = /* @__PURE__ */ new Set();
1629
1670
  const queuedSpanIds = /* @__PURE__ */ new Set();
1630
1671
  const pendingSpans = () => tracer.exportFinished().filter((span) => !exportedSpanIds.has(span.spanId) && !queuedSpanIds.has(span.spanId));
1631
- const tracePipeline = _optionalChain([options, 'access', _192 => _192.otlp, 'optionalAccess', _193 => _193.tracesUrl]) ? makeExportPipeline({
1672
+ const tracePipeline = _optionalChain([options, 'access', _193 => _193.otlp, 'optionalAccess', _194 => _194.tracesUrl]) ? makeExportPipeline({
1632
1673
  signal: "traces",
1633
1674
  metrics,
1634
1675
  ..._nullishCoalesce(options.otlp.pipeline, () => ( {})),
1635
- timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access', _194 => _194.otlp, 'access', _195 => _195.pipeline, 'optionalAccess', _196 => _196.timeoutMs]))),
1636
- retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access', _197 => _197.otlp, 'access', _198 => _198.pipeline, 'optionalAccess', _199 => _199.retry]))),
1676
+ timeoutMs: _nullishCoalesce(options.otlp.timeoutMs, () => ( _optionalChain([options, 'access', _195 => _195.otlp, 'access', _196 => _196.pipeline, 'optionalAccess', _197 => _197.timeoutMs]))),
1677
+ retry: _nullishCoalesce(options.otlp.retry, () => ( _optionalChain([options, 'access', _198 => _198.otlp, 'access', _199 => _199.pipeline, 'optionalAccess', _200 => _200.retry]))),
1637
1678
  exportBatch: async (spans) => {
1638
1679
  const body = JSON.stringify(spansToOtlp(spans, {
1639
1680
  resource,
@@ -1664,7 +1705,7 @@ function makeObservability(options = {}) {
1664
1705
  for (const spanId of spanIds) exportedSpanIds.delete(spanId);
1665
1706
  }
1666
1707
  }) : void 0;
1667
- const otlpTraces = _optionalChain([options, 'access', _200 => _200.otlp, 'optionalAccess', _201 => _201.tracesUrl]) ? {
1708
+ const otlpTraces = _optionalChain([options, 'access', _201 => _201.otlp, 'optionalAccess', _202 => _202.tracesUrl]) ? {
1668
1709
  pipeline: tracePipeline,
1669
1710
  export: async () => {
1670
1711
  const spans = pendingSpans();
@@ -1709,7 +1750,7 @@ function makeObservability(options = {}) {
1709
1750
  metricsResult = await otlpMetricsExporter.export();
1710
1751
  } catch (error) {
1711
1752
  errors.push({ signal: "metrics", error });
1712
- _optionalChain([options, 'access', _202 => _202.onFlushError, 'optionalCall', _203 => _203(error, "metrics")]);
1753
+ _optionalChain([options, 'access', _203 => _203.onFlushError, 'optionalCall', _204 => _204(error, "metrics")]);
1713
1754
  }
1714
1755
  }
1715
1756
  if (otlpTraces) {
@@ -1717,7 +1758,7 @@ function makeObservability(options = {}) {
1717
1758
  tracesResult = await otlpTraces.export();
1718
1759
  } catch (error) {
1719
1760
  errors.push({ signal: "traces", error });
1720
- _optionalChain([options, 'access', _204 => _204.onFlushError, 'optionalCall', _205 => _205(error, "traces")]);
1761
+ _optionalChain([options, 'access', _205 => _205.onFlushError, 'optionalCall', _206 => _206(error, "traces")]);
1721
1762
  }
1722
1763
  }
1723
1764
  if (otlpLogs) {
@@ -1725,7 +1766,7 @@ function makeObservability(options = {}) {
1725
1766
  logsResult = await otlpLogs.export();
1726
1767
  } catch (error) {
1727
1768
  errors.push({ signal: "logs", error });
1728
- _optionalChain([options, 'access', _206 => _206.onFlushError, 'optionalCall', _207 => _207(error, "logs")]);
1769
+ _optionalChain([options, 'access', _207 => _207.onFlushError, 'optionalCall', _208 => _208(error, "logs")]);
1729
1770
  }
1730
1771
  }
1731
1772
  return { metrics: metricsResult, traces: tracesResult, logs: logsResult, errors };
@@ -1746,7 +1787,7 @@ function makeObservability(options = {}) {
1746
1787
  interval = setInterval(() => {
1747
1788
  void flush();
1748
1789
  }, options.flushIntervalMs);
1749
- _optionalChain([interval, 'access', _208 => _208.unref, 'optionalCall', _209 => _209()]);
1790
+ _optionalChain([interval, 'access', _209 => _209.unref, 'optionalCall', _210 => _210()]);
1750
1791
  };
1751
1792
  const stop = () => {
1752
1793
  if (!interval) return;
@@ -1760,10 +1801,10 @@ function makeObservability(options = {}) {
1760
1801
  let traces = result.traces;
1761
1802
  let logs = result.logs;
1762
1803
  if (tracePipeline && tracePipeline.stats().queueSize > 0) {
1763
- const drain = await tracePipeline.shutdown(_optionalChain([options, 'access', _210 => _210.otlp, 'optionalAccess', _211 => _211.pipeline, 'optionalAccess', _212 => _212.shutdownTimeoutMs]));
1804
+ const drain = await tracePipeline.shutdown(_optionalChain([options, 'access', _211 => _211.otlp, 'optionalAccess', _212 => _212.pipeline, 'optionalAccess', _213 => _213.shutdownTimeoutMs]));
1764
1805
  for (const error of drain.errors) {
1765
1806
  drainErrors.push({ signal: "traces", error });
1766
- _optionalChain([options, 'access', _213 => _213.onFlushError, 'optionalCall', _214 => _214(error, "traces")]);
1807
+ _optionalChain([options, 'access', _214 => _214.onFlushError, 'optionalCall', _215 => _215(error, "traces")]);
1767
1808
  }
1768
1809
  traces = _nullishCoalesce(traces, () => ( {
1769
1810
  status: drain.status,
@@ -1772,10 +1813,10 @@ function makeObservability(options = {}) {
1772
1813
  }));
1773
1814
  }
1774
1815
  if (logPipeline && logPipeline.stats().queueSize > 0) {
1775
- const drain = await logPipeline.shutdown(_optionalChain([options, 'access', _215 => _215.otlp, 'optionalAccess', _216 => _216.pipeline, 'optionalAccess', _217 => _217.shutdownTimeoutMs]));
1816
+ const drain = await logPipeline.shutdown(_optionalChain([options, 'access', _216 => _216.otlp, 'optionalAccess', _217 => _217.pipeline, 'optionalAccess', _218 => _218.shutdownTimeoutMs]));
1776
1817
  for (const error of drain.errors) {
1777
1818
  drainErrors.push({ signal: "logs", error });
1778
- _optionalChain([options, 'access', _218 => _218.onFlushError, 'optionalCall', _219 => _219(error, "logs")]);
1819
+ _optionalChain([options, 'access', _219 => _219.onFlushError, 'optionalCall', _220 => _220(error, "logs")]);
1779
1820
  }
1780
1821
  logs = _nullishCoalesce(logs, () => ( {
1781
1822
  status: drain.status,
@@ -1848,7 +1889,7 @@ function resolveRequestBaggage(input) {
1848
1889
  const maybeRequest = input;
1849
1890
  if (typeof maybeRequest.baggage === "string") return parseBaggage(maybeRequest.baggage);
1850
1891
  if (maybeRequest.baggage) return maybeRequest.baggage;
1851
- if (_optionalChain([maybeRequest, 'access', _220 => _220.trace, 'optionalAccess', _221 => _221.baggage])) return maybeRequest.trace.baggage;
1892
+ if (_optionalChain([maybeRequest, 'access', _221 => _221.trace, 'optionalAccess', _222 => _222.baggage])) return maybeRequest.trace.baggage;
1852
1893
  if (maybeRequest.headers) return extractBaggage(maybeRequest.headers);
1853
1894
  return extractBaggage(input);
1854
1895
  }
@@ -1861,14 +1902,15 @@ function makeRuntimeTraceIdGenerator() {
1861
1902
  newSpanId: () => randomHexId(16)
1862
1903
  };
1863
1904
  }
1905
+ var HEX_BYTE = Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0"));
1864
1906
  function randomHexId(length) {
1865
1907
  const cryptoLike = globalThis.crypto;
1866
- if (typeof _optionalChain([cryptoLike, 'optionalAccess', _222 => _222.getRandomValues]) === "function") {
1908
+ if (typeof _optionalChain([cryptoLike, 'optionalAccess', _223 => _223.getRandomValues]) === "function") {
1867
1909
  const bytes = new Uint8Array(Math.ceil(length / 2));
1868
1910
  cryptoLike.getRandomValues(bytes);
1869
- return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, length);
1911
+ return bytesToHex(bytes, length);
1870
1912
  }
1871
- if (typeof _optionalChain([cryptoLike, 'optionalAccess', _223 => _223.randomUUID]) === "function") {
1913
+ if (typeof _optionalChain([cryptoLike, 'optionalAccess', _224 => _224.randomUUID]) === "function") {
1872
1914
  const hex = cryptoLike.randomUUID().replace(/-/g, "");
1873
1915
  if (hex.length >= length) return hex.slice(0, length);
1874
1916
  }
@@ -1878,6 +1920,13 @@ function randomHexId(length) {
1878
1920
  }
1879
1921
  return out.slice(0, length);
1880
1922
  }
1923
+ function bytesToHex(bytes, length) {
1924
+ let out = "";
1925
+ for (let i = 0; i < bytes.length; i++) {
1926
+ out += HEX_BYTE[bytes[i]];
1927
+ }
1928
+ return out.length === length ? out : out.slice(0, length);
1929
+ }
1881
1930
 
1882
1931
  // src/observability/request.ts
1883
1932
  function makeRequestObservabilityContext(observability, input = {}) {
@@ -1885,7 +1934,7 @@ function makeRequestObservabilityContext(observability, input = {}) {
1885
1934
  const env = observability.envForRequest(input);
1886
1935
  const attributes = requestSpanAttributes(input);
1887
1936
  const defaultSpanName = _nullishCoalesce(input.spanName, () => ( (input.method && input.route ? `${input.method} ${input.route}` : _nullishCoalesce(input.route, () => ( "request")))));
1888
- const makeRuntime = (extraEnv, options = {}) => new (0, _chunkWQ5QNU5Rcjs.Runtime)({
1937
+ const makeRuntime = (extraEnv, options = {}) => new (0, _chunkGLE2WY7Zcjs.Runtime)({
1889
1938
  ...options,
1890
1939
  env: mergeEnv(extraEnv, env),
1891
1940
  hooks: observability.hooks
@@ -1943,23 +1992,23 @@ async function runObservedHttpServerEffect(observability, input, effect, options
1943
1992
  );
1944
1993
  }
1945
1994
  function withServerSpanEvents(effect, options) {
1946
- return _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
1995
+ return _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
1947
1996
  effect,
1948
- (error) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
1997
+ (error) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
1949
1998
  spanEvent("http.server.error", {
1950
1999
  "http.response.status_code": 500,
1951
2000
  "error.type": error instanceof Error ? error.name : typeof error
1952
2001
  }),
1953
- () => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error)
2002
+ () => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error)
1954
2003
  ),
1955
2004
  (value) => {
1956
- const statusCode = _nullishCoalesce(_optionalChain([options, 'access', _224 => _224.statusCode, 'optionalCall', _225 => _225(value)]), () => ( 200));
1957
- return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
2005
+ const statusCode = _nullishCoalesce(_optionalChain([options, 'access', _225 => _225.statusCode, 'optionalCall', _226 => _226(value)]), () => ( 200));
2006
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
1958
2007
  spanEvent("http.server.response", {
1959
2008
  "http.response.status_code": statusCode,
1960
2009
  "http.outcome": statusCode >= 500 ? "error" : "success"
1961
2010
  }),
1962
- () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, value)
2011
+ () => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, value)
1963
2012
  );
1964
2013
  }
1965
2014
  );
@@ -1969,8 +2018,8 @@ async function observeHttpServerRequest(observability, input, handler, options =
1969
2018
  const ctx = makeRequestObservabilityContext(observability, input);
1970
2019
  const startedAt = resolved.clock();
1971
2020
  const baseLabels = requestBaseLabels(input, resolved);
1972
- const inFlight = _optionalChain([resolved, 'access', _226 => _226.metrics, 'optionalAccess', _227 => _227.gauge, 'call', _228 => _228("brass_http_server_in_flight", baseLabels)]);
1973
- _optionalChain([inFlight, 'optionalAccess', _229 => _229.increment, 'call', _230 => _230()]);
2021
+ const inFlight = _optionalChain([resolved, 'access', _227 => _227.metrics, 'optionalAccess', _228 => _228.gauge, 'call', _229 => _229("brass_http_server_in_flight", baseLabels)]);
2022
+ _optionalChain([inFlight, 'optionalAccess', _230 => _230.increment, 'call', _231 => _231()]);
1974
2023
  try {
1975
2024
  await ctx.run(logHttpServerRequest(input, resolved));
1976
2025
  const value = await handler(ctx);
@@ -2004,8 +2053,8 @@ function finishServerObservation(startedAt, input, trace, statusCode, outcome, o
2004
2053
  outcome: statusCode >= 500 ? "error" : outcome,
2005
2054
  status: String(statusCode)
2006
2055
  };
2007
- _optionalChain([options, 'access', _231 => _231.metrics, 'optionalAccess', _232 => _232.counter, 'call', _233 => _233("brass_http_server_requests_total", labels), 'access', _234 => _234.increment, 'call', _235 => _235()]);
2008
- _optionalChain([options, 'access', _236 => _236.metrics, 'optionalAccess', _237 => _237.histogram, 'call', _238 => _238("brass_http_server_duration_ms", [..._nullishCoalesce(options.durationBuckets, () => ( DEFAULT_DURATION_BUCKETS2))], labels), 'access', _239 => _239.observe, 'call', _240 => _240(
2056
+ _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()]);
2057
+ _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
2058
  durationMs,
2010
2059
  exemplarFromTraceContext(trace, durationMs, startedAt + durationMs)
2011
2060
  )]);
@@ -2039,7 +2088,7 @@ function logHttpServerError(input, error, durationMs, options) {
2039
2088
  });
2040
2089
  }
2041
2090
  function logNoop() {
2042
- return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
2091
+ return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
2043
2092
  }
2044
2093
  function serverSpanName(input, options) {
2045
2094
  if (options.spans && options.spans.name) {
@@ -2048,7 +2097,7 @@ function serverSpanName(input, options) {
2048
2097
  return input.method && input.route ? `${input.method} ${input.route}` : _nullishCoalesce(input.route, () => ( "request"));
2049
2098
  }
2050
2099
  function serverSpanAttributes(input, options) {
2051
- const spanOptions = options.spans === false ? {} : _optionalChain([options, 'access', _241 => _241.spans, 'optionalAccess', _242 => _242.attributes]);
2100
+ const spanOptions = options.spans === false ? {} : _optionalChain([options, 'access', _242 => _242.spans, 'optionalAccess', _243 => _243.attributes]);
2052
2101
  const custom = typeof spanOptions === "function" ? spanOptions(input) : _nullishCoalesce(spanOptions, () => ( {}));
2053
2102
  return {
2054
2103
  "span.kind": "server",
@@ -2140,4 +2189,5 @@ function compactLabels(labels) {
2140
2189
 
2141
2190
 
2142
2191
 
2143
- 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.makeObservability = makeObservability; exports.resolveRequestTraceSeed = resolveRequestTraceSeed; exports.resolveRequestBaggage = resolveRequestBaggage; exports.makeRequestObservabilityContext = makeRequestObservabilityContext; exports.runObservedHttpServerEffect = runObservedHttpServerEffect; exports.observeHttpServerRequest = observeHttpServerRequest;
2192
+
2193
+ 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.makeObservability = makeObservability; exports.resolveRequestTraceSeed = resolveRequestTraceSeed; exports.resolveRequestBaggage = resolveRequestBaggage; exports.makeRequestObservabilityContext = makeRequestObservabilityContext; exports.runObservedHttpServerEffect = runObservedHttpServerEffect; exports.observeHttpServerRequest = observeHttpServerRequest;