brass-runtime 1.18.0 → 1.18.2

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 (84) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/agent/cli/main.cjs +31 -31
  3. package/dist/agent/cli/main.js +3 -3
  4. package/dist/agent/cli/main.mjs +3 -3
  5. package/dist/agent/index.cjs +4 -4
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +3 -3
  8. package/dist/agent/index.mjs +3 -3
  9. package/dist/{chunk-PSEU65ND.js → chunk-2R3RVNS2.js} +6 -6
  10. package/dist/{chunk-ITZQ526U.mjs → chunk-3NKXUX4T.mjs} +2 -2
  11. package/dist/{chunk-JH4GI3DW.js → chunk-4PKBNG2H.js} +38 -18
  12. package/dist/{chunk-Z3PSSXP3.mjs → chunk-5RVHSBJ6.mjs} +292 -36
  13. package/dist/{chunk-QZ6QFJNM.mjs → chunk-5UBJT4RW.mjs} +4 -4
  14. package/dist/{chunk-7TXQJFZX.cjs → chunk-6STX4PS3.cjs} +13 -13
  15. package/dist/{chunk-VIFA4DPN.cjs → chunk-7FZUTJM3.cjs} +508 -252
  16. package/dist/{chunk-4YQHPIWJ.js → chunk-A6EG5WRL.js} +3 -3
  17. package/dist/{chunk-XSAHV5HQ.js → chunk-APQBU7TM.js} +264 -133
  18. package/dist/{chunk-RREBJX2S.mjs → chunk-AQQQFNYD.mjs} +38 -18
  19. package/dist/{chunk-AADFFVYS.js → chunk-B2VXVNIS.js} +1 -1
  20. package/dist/{chunk-R6WDSZA6.mjs → chunk-BLXBZ6RE.mjs} +1 -1
  21. package/dist/{chunk-ITG6I7ZS.js → chunk-C3CWI42G.js} +1 -1
  22. package/dist/{chunk-LXBU5E77.cjs → chunk-DV644N7P.cjs} +85 -85
  23. package/dist/{chunk-G5JTCFMI.mjs → chunk-EKLEDIVJ.mjs} +2 -2
  24. package/dist/{chunk-IBRHSH5H.js → chunk-EXBGIC66.js} +1 -1
  25. package/dist/{chunk-W6WR37HN.js → chunk-FC5N5QHJ.js} +2 -2
  26. package/dist/{chunk-6MLAZPBL.mjs → chunk-FNWOH2T2.js} +18 -6
  27. package/dist/{chunk-AJMKZXRB.cjs → chunk-FYWWU3Z7.cjs} +2 -2
  28. package/dist/{chunk-IFRBVMWJ.cjs → chunk-GOEO763K.cjs} +21 -21
  29. package/dist/{chunk-S4HHFUYP.js → chunk-GXOIUBKE.js} +2 -2
  30. package/dist/{chunk-BG5RNEA2.js → chunk-H4ZRUQZL.js} +4 -4
  31. package/dist/{chunk-OI4ESUMC.mjs → chunk-HW2CLRJ3.mjs} +6 -6
  32. package/dist/{chunk-3PHU7FWS.js → chunk-JWFOWPMB.js} +163 -155
  33. package/dist/{chunk-OT2TESZU.mjs → chunk-KAPZHDO4.mjs} +1 -1
  34. package/dist/{chunk-ELLF55ER.mjs → chunk-KDXNWGPB.mjs} +1 -1
  35. package/dist/{chunk-UUMKZJRJ.cjs → chunk-KPOL2YEO.cjs} +18 -6
  36. package/dist/{chunk-2SLT3X6G.cjs → chunk-MA74OYCI.cjs} +6 -6
  37. package/dist/{chunk-2QNREG6K.mjs → chunk-MUMBUXU6.mjs} +264 -133
  38. package/dist/{chunk-YTX2JYYP.cjs → chunk-NQW3YUFN.cjs} +18 -18
  39. package/dist/{chunk-3PFZGP23.cjs → chunk-OO7BGCC3.cjs} +54 -34
  40. package/dist/{chunk-QCOLAHU3.mjs → chunk-OX6MF7SZ.mjs} +163 -155
  41. package/dist/{chunk-KHACHFBQ.cjs → chunk-QBVS3UYN.cjs} +245 -237
  42. package/dist/{chunk-H5GYX7RZ.js → chunk-RZGB3DXR.js} +292 -36
  43. package/dist/{chunk-KRYP6CAE.mjs → chunk-URVS2OE2.mjs} +3 -3
  44. package/dist/{chunk-HCJ4S3YB.js → chunk-UZQ3BB6W.mjs} +18 -6
  45. package/dist/{chunk-N6QNSTWD.cjs → chunk-YQWZ7FZX.cjs} +5 -5
  46. package/dist/{chunk-5XADBMSU.cjs → chunk-Z2YIDHRI.cjs} +5 -5
  47. package/dist/{chunk-SSQJKDN3.cjs → chunk-ZDZNV6NA.cjs} +286 -155
  48. package/dist/core/index.cjs +14 -8
  49. package/dist/core/index.d.ts +6 -6
  50. package/dist/core/index.js +13 -7
  51. package/dist/core/index.mjs +13 -7
  52. package/dist/{defaultClient-DhpCQW9m.d.ts → defaultClient-Cid0JoUR.d.ts} +29 -4
  53. package/dist/{effect-CtUDl5M5.d.ts → effect-DnGUuhw6.d.ts} +22 -1
  54. package/dist/http/index.cjs +58 -54
  55. package/dist/http/index.d.ts +8 -8
  56. package/dist/http/index.js +11 -7
  57. package/dist/http/index.mjs +11 -7
  58. package/dist/http/testing.cjs +9 -9
  59. package/dist/http/testing.d.ts +4 -4
  60. package/dist/http/testing.js +5 -5
  61. package/dist/http/testing.mjs +5 -5
  62. package/dist/index.cjs +92 -86
  63. package/dist/index.d.ts +7 -7
  64. package/dist/index.js +14 -8
  65. package/dist/index.mjs +14 -8
  66. package/dist/{layer-BalPI6cN.d.ts → layer-D2LFcBVx.d.ts} +1 -1
  67. package/dist/observability/index.cjs +10 -10
  68. package/dist/observability/index.d.ts +7 -7
  69. package/dist/observability/index.js +9 -9
  70. package/dist/observability/index.mjs +9 -9
  71. package/dist/perf/cli.cjs +26 -26
  72. package/dist/perf/cli.js +11 -11
  73. package/dist/perf/cli.mjs +11 -11
  74. package/dist/perf/index.cjs +13 -13
  75. package/dist/perf/index.js +11 -11
  76. package/dist/perf/index.mjs +11 -11
  77. package/dist/schema/index.cjs +2 -2
  78. package/dist/schema/index.js +1 -1
  79. package/dist/schema/index.mjs +1 -1
  80. package/dist/{server-C1zVmqE6.d.ts → server-Bf1zNYZk.d.ts} +4 -4
  81. package/dist/{stream-Bb4FTejt.d.ts → stream-I7bkvF7a.d.ts} +1 -1
  82. package/dist/{tracer-DzfuE6um.d.ts → tracer-DF83nLn6.d.ts} +2 -2
  83. package/dist/{tracing-BABA5arE.d.ts → tracing-CWV4gT0u.d.ts} +1 -1
  84. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk5XADBMSUcjs = require('./chunk-5XADBMSU.cjs');
3
+ var _chunkZ2YIDHRIcjs = require('./chunk-Z2YIDHRI.cjs');
4
4
 
5
5
 
6
6
 
@@ -13,30 +13,26 @@ var _chunk5XADBMSUcjs = require('./chunk-5XADBMSU.cjs');
13
13
 
14
14
 
15
15
 
16
- var _chunkLXBU5E77cjs = require('./chunk-LXBU5E77.cjs');
16
+ var _chunkDV644N7Pcjs = require('./chunk-DV644N7P.cjs');
17
17
 
18
18
 
19
19
 
20
20
 
21
21
 
22
22
 
23
- var _chunkVIFA4DPNcjs = require('./chunk-VIFA4DPN.cjs');
23
+ var _chunk7FZUTJM3cjs = require('./chunk-7FZUTJM3.cjs');
24
24
 
25
25
 
26
26
  var _chunkL6VB5N7Qcjs = require('./chunk-L6VB5N7Q.cjs');
27
27
 
28
28
 
29
29
 
30
- var _chunk7TXQJFZXcjs = require('./chunk-7TXQJFZX.cjs');
31
-
32
-
33
-
34
-
35
- var _chunkSSQJKDN3cjs = require('./chunk-SSQJKDN3.cjs');
30
+ var _chunk6STX4PS3cjs = require('./chunk-6STX4PS3.cjs');
36
31
 
37
32
 
38
33
 
39
34
 
35
+ var _chunkZDZNV6NAcjs = require('./chunk-ZDZNV6NA.cjs');
40
36
 
41
37
 
42
38
 
@@ -120,7 +116,7 @@ var HTTP_OBSERVABILITY_CONTRACT = Object.freeze({
120
116
  });
121
117
  function withHttpObservability(options) {
122
118
  if (!isObservabilityInstance(options)) {
123
- _chunkLXBU5E77cjs.validateHttpObservabilityOptions.call(void 0, _nullishCoalesce(options, () => ( {})));
119
+ _chunkDV644N7Pcjs.validateHttpObservabilityOptions.call(void 0, _nullishCoalesce(options, () => ( {})));
124
120
  }
125
121
  const resolved = resolveHttpObservabilityOptions(options);
126
122
  const metricCache = makeHttpMetricCache();
@@ -134,45 +130,149 @@ function withHttpObservability(options) {
134
130
  return withLeanHttpSampledSpanObservability(next, resolved, metricCache);
135
131
  }
136
132
  return (req) => {
137
- const run = _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
138
- beginHttpObservation(req, resolved, metricCache),
139
- (state) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
140
- logHttpRequest(req, resolved),
141
- () => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
142
- prepareHttpRequest(req, resolved),
143
- (wireReq) => _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
144
- next(wireReq),
145
- (error) => {
146
- const finish = state.finishWithError(error);
147
- const adaptiveLimiterAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
148
- const traceEvent = !shouldEmitHttpSpanEvents(resolved) ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0) : _chunkLXBU5E77cjs.spanEvent.call(void 0, "http.client.error", {
149
- ...finish.spanAttributes,
150
- ...adaptiveLimiterAttrs,
151
- "error.type": error._tag
152
- });
153
- return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
154
- traceEvent,
155
- () => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, logHttpError(req, error, finish, resolved), () => _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error))
156
- );
157
- },
158
- (res) => {
159
- const finish = state.finishWithResponse(res);
160
- const adaptiveLimiterAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
161
- const traceEvent = !shouldEmitHttpSpanEvents(resolved) ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0) : _chunkLXBU5E77cjs.spanEvent.call(void 0, "http.client.response", {
162
- ...finish.spanAttributes,
163
- ...adaptiveLimiterAttrs
164
- });
165
- return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
166
- traceEvent,
167
- () => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, logHttpResponse(req, res, finish, resolved), () => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, res))
168
- );
169
- }
170
- )
171
- )
172
- )
173
- );
133
+ const run = _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env, cb) => {
134
+ const startedAt = resolved.clock();
135
+ const baseLabels = getCachedBaseLabels(req, resolved, metricCache);
136
+ const inFlight = resolved.metrics ? getCachedMetric(
137
+ metricCache,
138
+ metricCache.inFlightGauges,
139
+ metricCacheKey("brass_http_client_in_flight", baseLabels),
140
+ () => resolved.metrics.gauge("brass_http_client_in_flight", baseLabels)
141
+ ) : void 0;
142
+ _optionalChain([inFlight, 'optionalAccess', _ => _.increment, 'call', _2 => _2()]);
143
+ let finished = false;
144
+ let cancelInner;
145
+ const completeFinish = (outcome, status, extra) => {
146
+ const durationMs = Math.max(0, resolved.clock() - startedAt);
147
+ const labels = requestFinishLabelsFromBase(baseLabels, outcome, status);
148
+ if (!finished) {
149
+ finished = true;
150
+ if (inFlight && inFlight.value() > 0) inFlight.decrement();
151
+ if (resolved.metrics) {
152
+ getCachedMetric(
153
+ metricCache,
154
+ metricCache.requestCounters,
155
+ metricCacheKey("brass_http_client_requests_total", labels),
156
+ () => resolved.metrics.counter("brass_http_client_requests_total", labels)
157
+ ).increment();
158
+ getCachedMetric(
159
+ metricCache,
160
+ metricCache.durationHistograms,
161
+ metricCacheKey("brass_http_client_duration_ms", labels),
162
+ () => resolved.metrics.histogram(
163
+ "brass_http_client_duration_ms",
164
+ [..._nullishCoalesce(resolved.durationBuckets, () => ( DEFAULT_DURATION_BUCKETS))],
165
+ labels
166
+ )
167
+ ).observe(
168
+ durationMs,
169
+ resolved.spans === false ? void 0 : currentTraceExemplar(durationMs, startedAt + durationMs)
170
+ );
171
+ }
172
+ }
173
+ return {
174
+ durationMs,
175
+ outcome,
176
+ labels,
177
+ spanAttributes: resolved.spans === false ? EMPTY_SPAN_ATTRIBUTES : {
178
+ "http.duration_ms": durationMs,
179
+ "http.outcome": outcome,
180
+ ...status ? { "http.status_code": Number(status) } : {},
181
+ ...status ? { "http.response.status_code": Number(status) } : {},
182
+ ...extra
183
+ }
184
+ };
185
+ };
186
+ const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
187
+ _optionalChain([fiber, 'optionalAccess', _3 => _3.addFinalizer, 'optionalCall', _4 => _4(() => {
188
+ completeFinish("abort", void 0, { "http.cancelled": true });
189
+ })]);
190
+ const reqLogLevel = resolved.logs === false ? false : _nullishCoalesce(resolved.logs.requestLevel, () => ( false));
191
+ if (reqLogLevel) {
192
+ const logEff = _chunkDV644N7Pcjs.logEffect.call(void 0, reqLogLevel, "http.client.request", requestLogFields(req, resolved));
193
+ _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, logEff, env, () => void 0);
194
+ }
195
+ const wireReq = resolved.injectTraceHeaders ? injectCurrentTraceContext(req) : req;
196
+ const onSuccess = (res) => {
197
+ const finish = completeFinish(httpStatusOutcome(res.status), String(res.status), {});
198
+ const adaptiveAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
199
+ if (shouldEmitHttpSpanEvents(resolved)) {
200
+ const ev = _chunkDV644N7Pcjs.spanEvent.call(void 0, "http.client.response", {
201
+ ...finish.spanAttributes,
202
+ ...adaptiveAttrs
203
+ });
204
+ _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, ev, env, () => void 0);
205
+ }
206
+ const respLevel = resolved.logs === false ? false : (_nullishCoalesce(resolved.logs.responseLevel, () => ( false))) || (finish.outcome === "error" ? _nullishCoalesce(resolved.logs.errorLevel, () => ( "warn")) : false);
207
+ if (respLevel) {
208
+ const logEff = _chunkDV644N7Pcjs.logEffect.call(void 0, respLevel, "http.client.response", {
209
+ ...requestLogFields(req, resolved),
210
+ status: res.status,
211
+ statusText: res.statusText,
212
+ outcome: finish.outcome,
213
+ durationMs: finish.durationMs
214
+ });
215
+ _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, logEff, env, () => void 0);
216
+ }
217
+ cb({ _tag: "Success", value: res });
218
+ };
219
+ const onError = (error) => {
220
+ const status = _chunk7FZUTJM3cjs.httpErrorStatus.call(void 0, error);
221
+ const finish = completeFinish(
222
+ httpErrorOutcome(error),
223
+ status !== void 0 ? String(status) : void 0,
224
+ {
225
+ "error.type": error._tag,
226
+ "http.retryable": _chunk7FZUTJM3cjs.isRetryableHttpError.call(void 0, error)
227
+ }
228
+ );
229
+ const adaptiveAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
230
+ if (shouldEmitHttpSpanEvents(resolved)) {
231
+ const ev = _chunkDV644N7Pcjs.spanEvent.call(void 0, "http.client.error", {
232
+ ...finish.spanAttributes,
233
+ ...adaptiveAttrs,
234
+ "error.type": error._tag
235
+ });
236
+ _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, ev, env, () => void 0);
237
+ }
238
+ const errLevel = resolved.logs === false ? false : _nullishCoalesce(resolved.logs.errorLevel, () => ( "error"));
239
+ if (errLevel) {
240
+ const statusText = httpErrorStatusText(error);
241
+ const logEff = _chunkDV644N7Pcjs.logEffect.call(void 0, errLevel, "http.client.error", {
242
+ ...requestLogFields(req, resolved),
243
+ outcome: finish.outcome,
244
+ durationMs: finish.durationMs,
245
+ ...status !== void 0 ? { status } : {},
246
+ ...statusText ? { statusText } : {},
247
+ retryable: _chunk7FZUTJM3cjs.isRetryableHttpError.call(void 0, error),
248
+ errorTag: error._tag,
249
+ message: httpErrorMessage(error)
250
+ });
251
+ _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, logEff, env, () => void 0);
252
+ }
253
+ cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(error) });
254
+ };
255
+ try {
256
+ cancelInner = _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, next(wireReq), env, (exit) => {
257
+ cancelInner = void 0;
258
+ if (exit._tag === "Success") onSuccess(exit.value);
259
+ else {
260
+ const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
261
+ if (failure._tag === "Some") onError(failure.value);
262
+ else cb(exit);
263
+ }
264
+ });
265
+ } catch (error) {
266
+ cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.die(error) });
267
+ }
268
+ return () => {
269
+ const cancel = cancelInner;
270
+ cancelInner = void 0;
271
+ _optionalChain([cancel, 'optionalCall', _5 => _5()]);
272
+ };
273
+ });
174
274
  if (resolved.spans === false) return run;
175
- return _chunkLXBU5E77cjs.withSpan.call(void 0, spanName(req, resolved.spans), run, spanStartAttributes(req, resolved));
275
+ return _chunkDV644N7Pcjs.withSpan.call(void 0, spanName(req, resolved.spans), run, spanStartAttributes(req, resolved));
176
276
  };
177
277
  };
178
278
  }
@@ -191,7 +291,7 @@ function canUseLeanHttpSampledSpanPath(options, adaptiveLimiter) {
191
291
  function withLeanHttpSampledSpanObservability(next, options, metricCache) {
192
292
  return (req) => _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env, cb) => {
193
293
  const startedAt = options.clock();
194
- const baseLabels = requestBaseLabels(req, options);
294
+ const baseLabels = getCachedBaseLabels(req, options, metricCache);
195
295
  const handles = beginLeanHttpMetricsObservation(baseLabels, options, metricCache);
196
296
  const span = startLeanHttpSpan(req, options);
197
297
  let finished = false;
@@ -212,7 +312,7 @@ function withLeanHttpSampledSpanObservability(next, options, metricCache) {
212
312
  finishLeanHttpSpan(span, "success");
213
313
  } else {
214
314
  const error = httpErrorFromCause(exit.cause);
215
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
315
+ const status = _chunk7FZUTJM3cjs.httpErrorStatus.call(void 0, error);
216
316
  recordHttpMetricsFinish(
217
317
  handles,
218
318
  httpErrorOutcome(error),
@@ -249,14 +349,14 @@ function withLeanHttpSampledSpanObservability(next, options, metricCache) {
249
349
  }
250
350
  const cancel = cancelInner;
251
351
  cancelInner = void 0;
252
- _optionalChain([cancel, 'optionalCall', _ => _()]);
352
+ _optionalChain([cancel, 'optionalCall', _6 => _6()]);
253
353
  };
254
354
  });
255
355
  }
256
356
  function withLeanHttpMetricsObservability(next, options, metricCache) {
257
357
  return (req) => _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env, cb) => {
258
358
  const startedAt = options.clock();
259
- const baseLabels = requestBaseLabels(req, options);
359
+ const baseLabels = getCachedBaseLabels(req, options, metricCache);
260
360
  const handles = beginLeanHttpMetricsObservation(baseLabels, options, metricCache);
261
361
  let finished = false;
262
362
  let cancelInner;
@@ -275,7 +375,7 @@ function withLeanHttpMetricsObservability(next, options, metricCache) {
275
375
  );
276
376
  } else {
277
377
  const error = httpErrorFromCause(exit.cause);
278
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
378
+ const status = _chunk7FZUTJM3cjs.httpErrorStatus.call(void 0, error);
279
379
  recordHttpMetricsFinish(
280
380
  handles,
281
381
  httpErrorOutcome(error),
@@ -310,7 +410,7 @@ function withLeanHttpMetricsObservability(next, options, metricCache) {
310
410
  }
311
411
  const cancel = cancelInner;
312
412
  cancelInner = void 0;
313
- _optionalChain([cancel, 'optionalCall', _2 => _2()]);
413
+ _optionalChain([cancel, 'optionalCall', _7 => _7()]);
314
414
  };
315
415
  });
316
416
  }
@@ -318,7 +418,7 @@ function beginLeanHttpMetricsObservation(baseLabels, options, metricCache) {
318
418
  const cacheKey = metricCacheKey("brass_http_client", baseLabels);
319
419
  const existing = metricCache.disabled ? void 0 : metricCache.leanEntries.get(cacheKey);
320
420
  if (existing) {
321
- _optionalChain([existing, 'access', _3 => _3.inFlight, 'optionalAccess', _4 => _4.increment, 'call', _5 => _5()]);
421
+ _optionalChain([existing, 'access', _8 => _8.inFlight, 'optionalAccess', _9 => _9.increment, 'call', _10 => _10()]);
322
422
  return existing;
323
423
  }
324
424
  const inFlight = options.metrics ? getCachedMetric(
@@ -327,7 +427,7 @@ function beginLeanHttpMetricsObservation(baseLabels, options, metricCache) {
327
427
  metricCacheKey("brass_http_client_in_flight", baseLabels),
328
428
  () => options.metrics.gauge("brass_http_client_in_flight", baseLabels)
329
429
  ) : void 0;
330
- _optionalChain([inFlight, 'optionalAccess', _6 => _6.increment, 'call', _7 => _7()]);
430
+ _optionalChain([inFlight, 'optionalAccess', _11 => _11.increment, 'call', _12 => _12()]);
331
431
  const created = {
332
432
  baseLabels,
333
433
  inFlight,
@@ -340,7 +440,7 @@ function beginLeanHttpMetricsObservation(baseLabels, options, metricCache) {
340
440
  }
341
441
  function recordHttpMetricsFinish(handles, outcome, status, startedAt, options, metricCache) {
342
442
  const durationMs = Math.max(0, options.clock() - startedAt);
343
- _optionalChain([handles, 'access', _8 => _8.inFlight, 'optionalAccess', _9 => _9.decrement, 'call', _10 => _10()]);
443
+ _optionalChain([handles, 'access', _13 => _13.inFlight, 'optionalAccess', _14 => _14.decrement, 'call', _15 => _15()]);
344
444
  if (!options.metrics) return;
345
445
  const finishKey = `${outcome}|${_nullishCoalesce(status, () => ( "none"))}`;
346
446
  let finishMetrics = metricCache.disabled ? void 0 : handles.finishMetrics.get(finishKey);
@@ -365,20 +465,20 @@ function startLeanHttpSpan(req, options) {
365
465
  if (configuredSampleRate <= 0) return void 0;
366
466
  if (configuredSampleRate < 1 && Math.random() >= configuredSampleRate) return void 0;
367
467
  }
368
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
369
- const runtime = _optionalChain([fiber, 'optionalAccess', _11 => _11.runtime]);
370
- const sink = _nullishCoalesce(options.spanSink, () => ( _optionalChain([runtime, 'optionalAccess', _12 => _12.hooks])));
371
- if (!_optionalChain([fiber, 'optionalAccess', _13 => _13.fiberContext]) || !runtime || !sink) return void 0;
468
+ const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
469
+ const runtime = _optionalChain([fiber, 'optionalAccess', _16 => _16.runtime]);
470
+ const sink = _nullishCoalesce(options.spanSink, () => ( _optionalChain([runtime, 'optionalAccess', _17 => _17.hooks])));
471
+ if (!_optionalChain([fiber, 'optionalAccess', _18 => _18.fiberContext]) || !runtime || !sink) return void 0;
372
472
  const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
373
- const brass = _optionalChain([runtime, 'access', _14 => _14.env, 'optionalAccess', _15 => _15.brass]);
374
- if (_optionalChain([previousTrace, 'optionalAccess', _16 => _16.sampled]) === false && _optionalChain([brass, 'optionalAccess', _17 => _17.respectRemoteSampled]) !== false) return void 0;
473
+ const brass = _optionalChain([runtime, 'access', _19 => _19.env, 'optionalAccess', _20 => _20.brass]);
474
+ if (_optionalChain([previousTrace, 'optionalAccess', _21 => _21.sampled]) === false && _optionalChain([brass, 'optionalAccess', _22 => _22.respectRemoteSampled]) !== false) return void 0;
375
475
  const name = spanName(req, options.spans);
376
476
  const tracer = resolveRuntimeTracer(runtime);
377
- let traceId = _optionalChain([previousTrace, 'optionalAccess', _18 => _18.traceId]);
378
- let sampled = _optionalChain([previousTrace, 'optionalAccess', _19 => _19.sampled]);
477
+ let traceId = _optionalChain([previousTrace, 'optionalAccess', _23 => _23.traceId]);
478
+ let sampled = _optionalChain([previousTrace, 'optionalAccess', _24 => _24.sampled]);
379
479
  let attributes;
380
480
  if (!previousTrace && configuredSampleRate === void 0) {
381
- const ratio = traceSamplerRatio(_optionalChain([brass, 'optionalAccess', _20 => _20.sampler]));
481
+ const ratio = traceSamplerRatio(_optionalChain([brass, 'optionalAccess', _25 => _25.sampler]));
382
482
  if (ratio !== void 0) {
383
483
  if (ratio <= 0) return void 0;
384
484
  if (ratio < 1 && Math.random() >= ratio) return void 0;
@@ -392,10 +492,10 @@ function startLeanHttpSpan(req, options) {
392
492
  attributes = spanStartAttributes(req, options);
393
493
  if (sampled === void 0) {
394
494
  traceId = _nullishCoalesce(traceId, () => ( tracer.newTraceId()));
395
- sampled = _chunkLXBU5E77cjs.shouldSampleWith.call(void 0, _optionalChain([brass, 'optionalAccess', _21 => _21.sampler]), {
495
+ sampled = _chunkDV644N7Pcjs.shouldSampleWith.call(void 0, _optionalChain([brass, 'optionalAccess', _26 => _26.sampler]), {
396
496
  traceId,
397
497
  spanName: name,
398
- parentSampled: _optionalChain([previousTrace, 'optionalAccess', _22 => _22.sampled]),
498
+ parentSampled: _optionalChain([previousTrace, 'optionalAccess', _27 => _27.sampled]),
399
499
  attributes
400
500
  });
401
501
  }
@@ -403,10 +503,10 @@ function startLeanHttpSpan(req, options) {
403
503
  const trace = {
404
504
  traceId: _nullishCoalesce(traceId, () => ( tracer.newTraceId())),
405
505
  spanId: tracer.newSpanId(),
406
- parentSpanId: _optionalChain([previousTrace, 'optionalAccess', _23 => _23.spanId]),
506
+ parentSpanId: _optionalChain([previousTrace, 'optionalAccess', _28 => _28.spanId]),
407
507
  sampled: true,
408
- traceState: _optionalChain([previousTrace, 'optionalAccess', _24 => _24.traceState]),
409
- ..._optionalChain([previousTrace, 'optionalAccess', _25 => _25.baggage]) ? { baggage: previousTrace.baggage } : {}
508
+ traceState: _optionalChain([previousTrace, 'optionalAccess', _29 => _29.traceState]),
509
+ ..._optionalChain([previousTrace, 'optionalAccess', _30 => _30.baggage]) ? { baggage: previousTrace.baggage } : {}
410
510
  };
411
511
  const state = {
412
512
  fiber,
@@ -417,9 +517,9 @@ function startLeanHttpSpan(req, options) {
417
517
  ended: false
418
518
  };
419
519
  fiber.fiberContext = { ...fiber.fiberContext, trace };
420
- _optionalChain([fiber, 'access', _26 => _26.addFinalizer, 'optionalCall', _27 => _27((exit) => {
421
- const status = _optionalChain([exit, 'optionalAccess', _28 => _28._tag]) === "Success" ? "success" : _optionalChain([exit, 'optionalAccess', _29 => _29.cause]) && _chunkMVGUEJ5Zcjs.Cause.containsInterrupt(exit.cause) ? "interrupted" : "failure";
422
- finishLeanHttpSpan(state, status, _optionalChain([exit, 'optionalAccess', _30 => _30._tag]) === "Failure" ? exit.cause : void 0);
520
+ _optionalChain([fiber, 'access', _31 => _31.addFinalizer, 'optionalCall', _32 => _32((exit) => {
521
+ const status = _optionalChain([exit, 'optionalAccess', _33 => _33._tag]) === "Success" ? "success" : _optionalChain([exit, 'optionalAccess', _34 => _34.cause]) && _chunkMVGUEJ5Zcjs.Cause.containsInterrupt(exit.cause) ? "interrupted" : "failure";
522
+ finishLeanHttpSpan(state, status, _optionalChain([exit, 'optionalAccess', _35 => _35._tag]) === "Failure" ? exit.cause : void 0);
423
523
  })]);
424
524
  sink.emit(
425
525
  { type: "span.start", name, attributes, links: [] },
@@ -434,14 +534,14 @@ function finishLeanHttpSpan(state, status, error) {
434
534
  { type: "span.end", name: state.name, status, error },
435
535
  leanSpanContext(state.fiber, state.trace)
436
536
  );
437
- if (_optionalChain([state, 'access', _31 => _31.fiber, 'optionalAccess', _32 => _32.fiberContext])) {
537
+ if (_optionalChain([state, 'access', _36 => _36.fiber, 'optionalAccess', _37 => _37.fiberContext])) {
438
538
  state.fiber.fiberContext = { ...state.fiber.fiberContext, trace: state.previousTrace };
439
539
  }
440
540
  }
441
541
  function leanSpanContext(fiber, trace) {
442
542
  return {
443
- fiberId: _optionalChain([fiber, 'optionalAccess', _33 => _33.id]),
444
- scopeId: _optionalChain([fiber, 'optionalAccess', _34 => _34.scopeId]),
543
+ fiberId: _optionalChain([fiber, 'optionalAccess', _38 => _38.id]),
544
+ scopeId: _optionalChain([fiber, 'optionalAccess', _39 => _39.scopeId]),
445
545
  traceId: trace.traceId,
446
546
  spanId: trace.spanId,
447
547
  parentSpanId: trace.parentSpanId,
@@ -451,8 +551,8 @@ function leanSpanContext(fiber, trace) {
451
551
  };
452
552
  }
453
553
  function resolveRuntimeTracer(runtime) {
454
- const tracer = _optionalChain([runtime, 'optionalAccess', _35 => _35.env, 'optionalAccess', _36 => _36.brass, 'optionalAccess', _37 => _37.tracer]);
455
- if (_optionalChain([tracer, 'optionalAccess', _38 => _38.newTraceId]) && _optionalChain([tracer, 'optionalAccess', _39 => _39.newSpanId])) return tracer;
554
+ const tracer = _optionalChain([runtime, 'optionalAccess', _40 => _40.env, 'optionalAccess', _41 => _41.brass, 'optionalAccess', _42 => _42.tracer]);
555
+ if (_optionalChain([tracer, 'optionalAccess', _43 => _43.newTraceId]) && _optionalChain([tracer, 'optionalAccess', _44 => _44.newSpanId])) return tracer;
456
556
  return {
457
557
  newTraceId: () => randomRuntimeId("trace"),
458
558
  newSpanId: () => randomRuntimeId("span")
@@ -465,7 +565,7 @@ function traceSamplerRatio(sampler) {
465
565
  }
466
566
  function randomRuntimeId(prefix) {
467
567
  const cryptoLike = globalThis.crypto;
468
- if (typeof _optionalChain([cryptoLike, 'optionalAccess', _40 => _40.randomUUID]) === "function") return cryptoLike.randomUUID();
568
+ if (typeof _optionalChain([cryptoLike, 'optionalAccess', _45 => _45.randomUUID]) === "function") return cryptoLike.randomUUID();
469
569
  return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
470
570
  }
471
571
  function httpErrorFromCause(cause) {
@@ -486,9 +586,23 @@ function makeHttpMetricCache() {
486
586
  leanEntries: /* @__PURE__ */ new Map(),
487
587
  inFlightGauges: /* @__PURE__ */ new Map(),
488
588
  requestCounters: /* @__PURE__ */ new Map(),
489
- durationHistograms: /* @__PURE__ */ new Map()
589
+ durationHistograms: /* @__PURE__ */ new Map(),
590
+ baseLabelsCache: /* @__PURE__ */ new Map()
490
591
  };
491
592
  }
593
+ function getCachedBaseLabels(req, options, cache) {
594
+ if (cache.disabled) return requestBaseLabels(req, options);
595
+ const route = requestRoute(req, options);
596
+ const host = options.includeHostLabel ? requestHost(req) : void 0;
597
+ const policy = _chunk7FZUTJM3cjs.getHttpRequestPolicy.call(void 0, req);
598
+ const preset = typeof policy === "string" ? policy : _optionalChain([policy, 'optionalAccess', _46 => _46.preset]);
599
+ const key = `${req.method}|${_nullishCoalesce(host, () => ( ""))}|${_nullishCoalesce(route, () => ( ""))}|${_nullishCoalesce(preset, () => ( ""))}`;
600
+ const existing = cache.baseLabelsCache.get(key);
601
+ if (existing) return existing;
602
+ const fresh = requestBaseLabels(req, options);
603
+ cache.baseLabelsCache.set(key, fresh);
604
+ return fresh;
605
+ }
492
606
  function attachMetricCache(metrics, cache) {
493
607
  if (!metrics) return;
494
608
  const existing = metricResetRegistry.get(metrics);
@@ -536,127 +650,21 @@ function metricCacheKey(name, labels) {
536
650
  }
537
651
  return key;
538
652
  }
539
- function beginHttpObservation(req, options, metricCache) {
540
- return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
541
- const startedAt = options.clock();
542
- let finished = false;
543
- const baseLabels = requestBaseLabels(req, options);
544
- const inFlight = options.metrics ? getCachedMetric(
545
- metricCache,
546
- metricCache.inFlightGauges,
547
- metricCacheKey("brass_http_client_in_flight", baseLabels),
548
- () => options.metrics.gauge("brass_http_client_in_flight", baseLabels)
549
- ) : void 0;
550
- _optionalChain([inFlight, 'optionalAccess', _41 => _41.increment, 'call', _42 => _42()]);
551
- const finish = (outcome, status, extra = {}) => {
552
- const durationMs = Math.max(0, options.clock() - startedAt);
553
- const labels = requestFinishLabelsFromBase(baseLabels, outcome, status);
554
- if (!finished) {
555
- finished = true;
556
- if (inFlight && inFlight.value() > 0) inFlight.decrement();
557
- if (options.metrics) {
558
- getCachedMetric(
559
- metricCache,
560
- metricCache.requestCounters,
561
- metricCacheKey("brass_http_client_requests_total", labels),
562
- () => options.metrics.counter("brass_http_client_requests_total", labels)
563
- ).increment();
564
- getCachedMetric(
565
- metricCache,
566
- metricCache.durationHistograms,
567
- metricCacheKey("brass_http_client_duration_ms", labels),
568
- () => options.metrics.histogram(
569
- "brass_http_client_duration_ms",
570
- [..._nullishCoalesce(options.durationBuckets, () => ( DEFAULT_DURATION_BUCKETS))],
571
- labels
572
- )
573
- ).observe(
574
- durationMs,
575
- options.spans === false ? void 0 : currentTraceExemplar(durationMs, startedAt + durationMs)
576
- );
577
- }
578
- }
579
- return {
580
- durationMs,
581
- outcome,
582
- labels,
583
- spanAttributes: options.spans === false ? EMPTY_SPAN_ATTRIBUTES : {
584
- "http.duration_ms": durationMs,
585
- "http.outcome": outcome,
586
- ...status ? { "http.status_code": Number(status) } : {},
587
- ...status ? { "http.response.status_code": Number(status) } : {},
588
- ...extra
589
- }
590
- };
591
- };
592
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
593
- _optionalChain([fiber, 'optionalAccess', _43 => _43.addFinalizer, 'optionalCall', _44 => _44(() => {
594
- finish("abort", void 0, { "http.cancelled": true });
595
- })]);
596
- return {
597
- finishWithResponse: (res) => finish(httpStatusOutcome(res.status), String(res.status)),
598
- finishWithError: (error) => {
599
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
600
- return finish(httpErrorOutcome(error), status !== void 0 ? String(status) : void 0, {
601
- "error.type": error._tag,
602
- "http.retryable": _chunkVIFA4DPNcjs.isRetryableHttpError.call(void 0, error)
603
- });
604
- }
605
- };
606
- });
607
- }
608
- function prepareHttpRequest(req, options) {
609
- if (!options.injectTraceHeaders) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, req);
610
- return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => injectCurrentTraceContext(req));
611
- }
612
- function logHttpRequest(req, options) {
613
- const level = options.logs === false ? false : _nullishCoalesce(options.logs.requestLevel, () => ( false));
614
- if (!level) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
615
- return _chunkLXBU5E77cjs.logEffect.call(void 0, level, "http.client.request", requestLogFields(req, options));
616
- }
617
- function logHttpResponse(req, res, finish, options) {
618
- const configured = options.logs === false ? false : _nullishCoalesce(options.logs.responseLevel, () => ( false));
619
- const level = configured || (finish.outcome === "error" ? options.logs !== false ? _nullishCoalesce(options.logs.errorLevel, () => ( "warn")) : false : false);
620
- if (!level) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
621
- return _chunkLXBU5E77cjs.logEffect.call(void 0, level, "http.client.response", {
622
- ...requestLogFields(req, options),
623
- status: res.status,
624
- statusText: res.statusText,
625
- outcome: finish.outcome,
626
- durationMs: finish.durationMs
627
- });
628
- }
629
- function logHttpError(req, error, finish, options) {
630
- const level = options.logs === false ? false : _nullishCoalesce(options.logs.errorLevel, () => ( "error"));
631
- if (!level) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
632
- const status = _chunkVIFA4DPNcjs.httpErrorStatus.call(void 0, error);
633
- const statusText = httpErrorStatusText(error);
634
- return _chunkLXBU5E77cjs.logEffect.call(void 0, level, "http.client.error", {
635
- ...requestLogFields(req, options),
636
- outcome: finish.outcome,
637
- durationMs: finish.durationMs,
638
- ...status !== void 0 ? { status } : {},
639
- ...statusText ? { statusText } : {},
640
- retryable: _chunkVIFA4DPNcjs.isRetryableHttpError.call(void 0, error),
641
- errorTag: error._tag,
642
- message: httpErrorMessage(error)
643
- });
644
- }
645
653
  function resolveHttpObservabilityOptions(options) {
646
654
  const maybeObservability = isObservabilityInstance(options) ? options : void 0;
647
655
  const raw = maybeObservability ? { metrics: maybeObservability.metrics } : options;
648
656
  return {
649
- metrics: _optionalChain([raw, 'optionalAccess', _45 => _45.metrics]) === false ? void 0 : _optionalChain([raw, 'optionalAccess', _46 => _46.metrics]),
650
- logs: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _47 => _47.logs]), () => ( {})),
651
- spans: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _48 => _48.spans]), () => ( {})),
652
- spanSink: _optionalChain([raw, 'optionalAccess', _49 => _49.spanSink]) === false ? void 0 : _optionalChain([raw, 'optionalAccess', _50 => _50.spanSink]),
653
- adaptiveLimiter: resolveAdaptiveLimiterObservabilityOptions(_optionalChain([raw, 'optionalAccess', _51 => _51.adaptiveLimiter])),
654
- policy: resolveHttpPolicyObservabilityOptions(_optionalChain([raw, 'optionalAccess', _52 => _52.policy])),
655
- injectTraceHeaders: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _53 => _53.injectTraceHeaders]), () => ( true)),
656
- includeHostLabel: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _54 => _54.includeHostLabel]), () => ( true)),
657
- route: _optionalChain([raw, 'optionalAccess', _55 => _55.route]),
658
- clock: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _56 => _56.clock]), () => ( Date.now)),
659
- durationBuckets: _optionalChain([raw, 'optionalAccess', _57 => _57.durationBuckets])
657
+ metrics: _optionalChain([raw, 'optionalAccess', _47 => _47.metrics]) === false ? void 0 : _optionalChain([raw, 'optionalAccess', _48 => _48.metrics]),
658
+ logs: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _49 => _49.logs]), () => ( {})),
659
+ spans: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _50 => _50.spans]), () => ( {})),
660
+ spanSink: _optionalChain([raw, 'optionalAccess', _51 => _51.spanSink]) === false ? void 0 : _optionalChain([raw, 'optionalAccess', _52 => _52.spanSink]),
661
+ adaptiveLimiter: resolveAdaptiveLimiterObservabilityOptions(_optionalChain([raw, 'optionalAccess', _53 => _53.adaptiveLimiter])),
662
+ policy: resolveHttpPolicyObservabilityOptions(_optionalChain([raw, 'optionalAccess', _54 => _54.policy])),
663
+ injectTraceHeaders: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _55 => _55.injectTraceHeaders]), () => ( true)),
664
+ includeHostLabel: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _56 => _56.includeHostLabel]), () => ( true)),
665
+ route: _optionalChain([raw, 'optionalAccess', _57 => _57.route]),
666
+ clock: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _58 => _58.clock]), () => ( Date.now)),
667
+ durationBuckets: _optionalChain([raw, 'optionalAccess', _59 => _59.durationBuckets])
660
668
  };
661
669
  }
662
670
  function isObservabilityInstance(options) {
@@ -719,11 +727,11 @@ function adaptiveLimiterLabels(req, stats, options) {
719
727
  });
720
728
  }
721
729
  function inferAdaptiveLimiterKey(req, stats) {
722
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
730
+ const policy = _chunk7FZUTJM3cjs.getHttpRequestPolicy.call(void 0, req);
723
731
  if (policy.poolKey) return policy.poolKey;
724
732
  const host = requestHost(req);
725
733
  if (host) return host;
726
- return _optionalChain([stats, 'access', _58 => _58.keys, 'optionalAccess', _59 => _59.length]) === 1 ? stats.keys[0] : void 0;
734
+ return _optionalChain([stats, 'access', _60 => _60.keys, 'optionalAccess', _61 => _61.length]) === 1 ? stats.keys[0] : void 0;
727
735
  }
728
736
  function setGauge(metrics, name, value, labels) {
729
737
  if (!metrics || value === void 0 || !Number.isFinite(value)) return;
@@ -801,7 +809,7 @@ function requestLogFields(req, options) {
801
809
  }
802
810
  function requestPolicyLogFields(req, options) {
803
811
  if (!options.policy.enabled) return void 0;
804
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
812
+ const policy = _chunk7FZUTJM3cjs.getHttpRequestPolicy.call(void 0, req);
805
813
  const fields = {
806
814
  ...policy.preset ? { preset: policy.preset } : {},
807
815
  ...policy.lane ? { lane: policy.lane } : {},
@@ -814,7 +822,7 @@ function requestPolicyLogFields(req, options) {
814
822
  }
815
823
  function requestPolicySpanAttributes(req, options) {
816
824
  if (!options.policy.enabled) return {};
817
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
825
+ const policy = _chunk7FZUTJM3cjs.getHttpRequestPolicy.call(void 0, req);
818
826
  return {
819
827
  ...compactSpanAttributes({
820
828
  "http.request.policy.lane": policy.lane,
@@ -828,7 +836,7 @@ function requestPolicySpanAttributes(req, options) {
828
836
  }
829
837
  function requestPolicyMetricLabels(req, options) {
830
838
  if (!options.policy.enabled || options.policy.labelKeys.length === 0) return {};
831
- const policy = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req);
839
+ const policy = _chunk7FZUTJM3cjs.getHttpRequestPolicy.call(void 0, req);
832
840
  const values = {
833
841
  preset: policy.preset,
834
842
  lane: policy.lane,
@@ -904,17 +912,17 @@ function httpErrorStatusText(error) {
904
912
  return error._tag === "FetchError" ? error.statusText : void 0;
905
913
  }
906
914
  function injectCurrentTraceContext(req) {
907
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
908
- const trace = _optionalChain([fiber, 'optionalAccess', _60 => _60.fiberContext, 'optionalAccess', _61 => _61.trace]);
909
- if (!_optionalChain([trace, 'optionalAccess', _62 => _62.traceId]) || !_optionalChain([trace, 'optionalAccess', _63 => _63.spanId])) return req;
915
+ const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
916
+ const trace = _optionalChain([fiber, 'optionalAccess', _62 => _62.fiberContext, 'optionalAccess', _63 => _63.trace]);
917
+ if (!_optionalChain([trace, 'optionalAccess', _64 => _64.traceId]) || !_optionalChain([trace, 'optionalAccess', _65 => _65.spanId])) return req;
910
918
  return {
911
919
  ...req,
912
- headers: _chunkLXBU5E77cjs.injectTraceContext.call(void 0, req.headers, trace)
920
+ headers: _chunkDV644N7Pcjs.injectTraceContext.call(void 0, req.headers, trace)
913
921
  };
914
922
  }
915
923
  function currentTraceExemplar(value, timestamp) {
916
- const fiber = _chunkSSQJKDN3cjs.getCurrentFiber.call(void 0, );
917
- return _chunkLXBU5E77cjs.exemplarFromTraceContext.call(void 0, _optionalChain([fiber, 'optionalAccess', _64 => _64.fiberContext, 'optionalAccess', _65 => _65.trace]), value, timestamp);
924
+ const fiber = _chunkZDZNV6NAcjs.getCurrentFiber.call(void 0, );
925
+ return _chunkDV644N7Pcjs.exemplarFromTraceContext.call(void 0, _optionalChain([fiber, 'optionalAccess', _66 => _66.fiberContext, 'optionalAccess', _67 => _67.trace]), value, timestamp);
918
926
  }
919
927
  function requestHost(req) {
920
928
  if (!isAbsoluteUrl(req.url)) return void 0;
@@ -982,38 +990,38 @@ function compactLabels(labels) {
982
990
 
983
991
  // src/observability/adapters.ts
984
992
  function makeFetchRequestObservabilityContext(observability, request, input = {}) {
985
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
993
+ return _chunkDV644N7Pcjs.makeRequestObservabilityContext.call(void 0, observability, {
986
994
  headers: request.headers,
987
995
  method: request.method,
988
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, request.url),
989
- route: _nullishCoalesce(input.route, () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, urlPathname(request.url)))),
996
+ target: _chunkDV644N7Pcjs.sanitizeHttpTarget.call(void 0, request.url),
997
+ route: _nullishCoalesce(input.route, () => ( _chunkDV644N7Pcjs.normalizeHttpRoute.call(void 0, urlPathname(request.url)))),
990
998
  ...input
991
999
  });
992
1000
  }
993
1001
  function makeNodeRequestObservabilityContext(observability, request, input = {}) {
994
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
1002
+ return _chunkDV644N7Pcjs.makeRequestObservabilityContext.call(void 0, observability, {
995
1003
  headers: request.headers,
996
1004
  method: request.method,
997
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, request.url),
998
- route: _nullishCoalesce(input.route, () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, request.url))),
1005
+ target: _chunkDV644N7Pcjs.sanitizeHttpTarget.call(void 0, request.url),
1006
+ route: _nullishCoalesce(input.route, () => ( _chunkDV644N7Pcjs.normalizeHttpRoute.call(void 0, request.url))),
999
1007
  ...input
1000
1008
  });
1001
1009
  }
1002
1010
  function makeExpressRequestObservabilityContext(observability, request, input = {}) {
1003
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
1011
+ return _chunkDV644N7Pcjs.makeRequestObservabilityContext.call(void 0, observability, {
1004
1012
  headers: request.headers,
1005
1013
  method: request.method,
1006
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, _nullishCoalesce(request.originalUrl, () => ( request.url))),
1007
- route: _nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _66 => _66.route, 'optionalAccess', _67 => _67.path]))), () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, _nullishCoalesce(request.path, () => ( request.url))))),
1014
+ target: _chunkDV644N7Pcjs.sanitizeHttpTarget.call(void 0, _nullishCoalesce(request.originalUrl, () => ( request.url))),
1015
+ route: _nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _68 => _68.route, 'optionalAccess', _69 => _69.path]))), () => ( _chunkDV644N7Pcjs.normalizeHttpRoute.call(void 0, _nullishCoalesce(request.path, () => ( request.url))))),
1008
1016
  ...input
1009
1017
  });
1010
1018
  }
1011
1019
  function makeFastifyRequestObservabilityContext(observability, request, input = {}) {
1012
- return _chunkLXBU5E77cjs.makeRequestObservabilityContext.call(void 0, observability, {
1020
+ return _chunkDV644N7Pcjs.makeRequestObservabilityContext.call(void 0, observability, {
1013
1021
  headers: request.headers,
1014
1022
  method: request.method,
1015
- target: _chunkLXBU5E77cjs.sanitizeHttpTarget.call(void 0, request.url),
1016
- route: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _68 => _68.routeOptions, 'optionalAccess', _69 => _69.url]))), () => ( request.routerPath)), () => ( _chunkLXBU5E77cjs.normalizeHttpRoute.call(void 0, request.url))),
1023
+ target: _chunkDV644N7Pcjs.sanitizeHttpTarget.call(void 0, request.url),
1024
+ route: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _70 => _70.routeOptions, 'optionalAccess', _71 => _71.url]))), () => ( request.routerPath)), () => ( _chunkDV644N7Pcjs.normalizeHttpRoute.call(void 0, request.url))),
1017
1025
  ...input
1018
1026
  });
1019
1027
  }
@@ -1034,7 +1042,7 @@ function urlPathname(url) {
1034
1042
 
1035
1043
  // src/observability/config.ts
1036
1044
  function makeNoopObservability() {
1037
- return _chunkLXBU5E77cjs.makeObservability.call(void 0, {
1045
+ return _chunkDV644N7Pcjs.makeObservability.call(void 0, {
1038
1046
  metrics: false,
1039
1047
  logs: false,
1040
1048
  traces: false,
@@ -1043,12 +1051,12 @@ function makeNoopObservability() {
1043
1051
  }
1044
1052
  function makeObservabilityPreset(preset, overrides = {}) {
1045
1053
  if (preset === "disabled") return makeNoopObservability();
1046
- return _chunkLXBU5E77cjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsForPreset(preset), overrides));
1054
+ return _chunkDV644N7Pcjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsForPreset(preset), overrides));
1047
1055
  }
1048
1056
  function makeObservabilityFromEnv(env = readProcessEnv(), overrides = {}) {
1049
1057
  const preset = env.BRASS_OBSERVABILITY === "disabled" ? "disabled" : parsePreset(_nullishCoalesce(env.BRASS_OBSERVABILITY_PRESET, () => ( env.NODE_ENV)));
1050
1058
  if (preset === "disabled") return makeNoopObservability();
1051
- return _chunkLXBU5E77cjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsFromEnv(env, preset), overrides));
1059
+ return _chunkDV644N7Pcjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsFromEnv(env, preset), overrides));
1052
1060
  }
1053
1061
  function observabilityOptionsForPreset(preset) {
1054
1062
  switch (preset) {
@@ -1132,10 +1140,10 @@ function mergeObservabilityOptions(base, overrides) {
1132
1140
  otlp: {
1133
1141
  ..._nullishCoalesce(base.otlp, () => ( {})),
1134
1142
  ..._nullishCoalesce(overrides.otlp, () => ( {})),
1135
- retry: _nullishCoalesce(_optionalChain([overrides, 'access', _70 => _70.otlp, 'optionalAccess', _71 => _71.retry]), () => ( _optionalChain([base, 'access', _72 => _72.otlp, 'optionalAccess', _73 => _73.retry]))),
1143
+ retry: _nullishCoalesce(_optionalChain([overrides, 'access', _72 => _72.otlp, 'optionalAccess', _73 => _73.retry]), () => ( _optionalChain([base, 'access', _74 => _74.otlp, 'optionalAccess', _75 => _75.retry]))),
1136
1144
  pipeline: {
1137
- ..._nullishCoalesce(_optionalChain([base, 'access', _74 => _74.otlp, 'optionalAccess', _75 => _75.pipeline]), () => ( {})),
1138
- ..._nullishCoalesce(_optionalChain([overrides, 'access', _76 => _76.otlp, 'optionalAccess', _77 => _77.pipeline]), () => ( {}))
1145
+ ..._nullishCoalesce(_optionalChain([base, 'access', _76 => _76.otlp, 'optionalAccess', _77 => _77.pipeline]), () => ( {})),
1146
+ ..._nullishCoalesce(_optionalChain([overrides, 'access', _78 => _78.otlp, 'optionalAccess', _79 => _79.pipeline]), () => ( {}))
1139
1147
  }
1140
1148
  }
1141
1149
  };
@@ -1179,27 +1187,27 @@ function readProcessEnv() {
1179
1187
  }
1180
1188
 
1181
1189
  // src/observability/layer.ts
1182
- var ObservabilityService = _chunk7TXQJFZXcjs.makeServiceTag.call(void 0, "Observability");
1190
+ var ObservabilityService = _chunk6STX4PS3cjs.makeServiceTag.call(void 0, "Observability");
1183
1191
  function makeObservabilityLayer(config = {}, options = {}) {
1184
1192
  const tag = _nullishCoalesce(options.tag, () => ( ObservabilityService));
1185
- return _chunk7TXQJFZXcjs.layerEffect.call(void 0,
1193
+ return _chunk6STX4PS3cjs.layerEffect.call(void 0,
1186
1194
  tag,
1187
- (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => _chunkLXBU5E77cjs.makeObservability.call(void 0, resolveObservabilityLayerConfig(config, context))),
1195
+ (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => _chunkDV644N7Pcjs.makeObservability.call(void 0, resolveObservabilityLayerConfig(config, context))),
1188
1196
  shutdownObservability
1189
1197
  );
1190
1198
  }
1191
1199
  function makeObservedRuntimeLayer(options = {}) {
1192
1200
  const {
1193
1201
  observabilityTag = ObservabilityService,
1194
- runtimeTag = _chunk5XADBMSUcjs.RuntimeService,
1202
+ runtimeTag = _chunkZ2YIDHRIcjs.RuntimeService,
1195
1203
  env = {},
1196
1204
  ...runtimeOptions
1197
1205
  } = options;
1198
- return _chunk7TXQJFZXcjs.layerEffect.call(void 0,
1206
+ return _chunk6STX4PS3cjs.layerEffect.call(void 0,
1199
1207
  runtimeTag,
1200
1208
  (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
1201
1209
  const observability = context.unsafeGet(observabilityTag);
1202
- return new (0, _chunkSSQJKDN3cjs.Runtime)({
1210
+ return new (0, _chunkZDZNV6NAcjs.Runtime)({
1203
1211
  ...runtimeOptions,
1204
1212
  env: mergeRuntimeEnv(resolveObservedRuntimeLayerEnv(env, context, observability), observability.env),
1205
1213
  hooks: observability.hooks
@@ -1209,8 +1217,8 @@ function makeObservedRuntimeLayer(options = {}) {
1209
1217
  }
1210
1218
  function makeObservedHttpClientLayer(config = {}, options = {}) {
1211
1219
  const observabilityTag = _nullishCoalesce(options.observabilityTag, () => ( ObservabilityService));
1212
- const httpTag = _nullishCoalesce(options.httpTag, () => ( _chunkVIFA4DPNcjs.HttpClientService));
1213
- return _chunk7TXQJFZXcjs.layerEffect.call(void 0,
1220
+ const httpTag = _nullishCoalesce(options.httpTag, () => ( _chunk7FZUTJM3cjs.HttpClientService));
1221
+ return _chunk6STX4PS3cjs.layerEffect.call(void 0,
1214
1222
  httpTag,
1215
1223
  (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
1216
1224
  const observability = context.unsafeGet(observabilityTag);
@@ -1220,7 +1228,7 @@ function makeObservedHttpClientLayer(config = {}, options = {}) {
1220
1228
  context,
1221
1229
  observability
1222
1230
  );
1223
- return _chunkVIFA4DPNcjs.makeDefaultHttpClient.call(void 0, {
1231
+ return _chunk7FZUTJM3cjs.makeDefaultHttpClient.call(void 0, {
1224
1232
  ...httpConfig,
1225
1233
  middleware: [
1226
1234
  ..._nullishCoalesce(httpConfig.middleware, () => ( [])),
@@ -1250,7 +1258,7 @@ function mergeRuntimeEnv(env, observabilityEnv) {
1250
1258
  return Object.assign({}, env, observabilityEnv);
1251
1259
  }
1252
1260
  function shutdownObservability(observability) {
1253
- return _chunkSSQJKDN3cjs.fromPromiseAbortable.call(void 0,
1261
+ return _chunkZDZNV6NAcjs.fromPromiseAbortable.call(void 0,
1254
1262
  () => observability.shutdown().then(() => void 0),
1255
1263
  () => void 0,
1256
1264
  { label: "observability.shutdown" }