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.
- package/CHANGELOG.md +17 -0
- package/README.md +283 -18
- package/dist/agent/cli/main.cjs +38 -38
- package/dist/agent/cli/main.js +6 -6
- package/dist/agent/cli/main.mjs +6 -6
- package/dist/agent/index.cjs +7 -7
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +6 -6
- package/dist/agent/index.mjs +6 -6
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
- package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
- package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
- package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-76YMRMH2.cjs +777 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
- package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-AVNQLJ5V.js +777 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/chunk-BABBZK4Y.js +2024 -0
- package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
- package/dist/{chunk-F5EUMJL7.mjs → chunk-CIZFIMK5.js} +55 -5
- package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
- package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
- package/dist/chunk-DNFO2EIZ.mjs +777 -0
- package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
- package/dist/{chunk-JNFRRJYH.cjs → chunk-ENKODRU3.cjs} +242 -192
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
- package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
- package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
- package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
- package/dist/chunk-HLWLMW2F.mjs +2024 -0
- package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
- package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
- package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
- package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
- package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
- package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
- package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
- package/dist/{chunk-7XOPAB5Q.js → chunk-MT3OWDPC.mjs} +55 -5
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
- package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
- package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VN44DYYT.cjs +2024 -0
- package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
- package/dist/core/index.cjs +135 -9
- package/dist/core/index.d.ts +238 -33
- package/dist/core/index.js +155 -29
- package/dist/core/index.mjs +155 -29
- package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
- package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
- package/dist/http/index.cjs +324 -2986
- package/dist/http/index.d.ts +54 -68
- package/dist/http/index.js +238 -2900
- package/dist/http/index.mjs +238 -2900
- package/dist/http/testing.cjs +14 -12
- package/dist/http/testing.d.ts +5 -4
- package/dist/http/testing.js +10 -8
- package/dist/http/testing.mjs +10 -8
- package/dist/index.cjs +423 -255
- package/dist/index.d.ts +87 -69
- package/dist/index.js +301 -133
- package/dist/index.mjs +301 -133
- package/dist/observability/index.cjs +16 -531
- package/dist/observability/index.d.ts +81 -8
- package/dist/observability/index.js +23 -538
- package/dist/observability/index.mjs +23 -538
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +6 -2
- package/dist/schema/index.d.ts +3 -1
- package/dist/schema/index.js +5 -1
- package/dist/schema/index.mjs +5 -1
- package/dist/{server-C8hDXA74.d.ts → server-GJPg8ZSG.d.ts} +4 -3
- package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
- package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +63 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +336 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +98 -0
- package/docs/observability.md +542 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +22 -2
- package/dist/chunk-45F7OKGT.cjs +0 -104
- package/dist/chunk-7V4KY4RL.mjs +0 -104
- package/dist/chunk-DJQ7OMMB.cjs +0 -144
- package/dist/chunk-GOV47PPB.mjs +0 -552
- package/dist/chunk-JF4XXPZ5.cjs +0 -552
- package/dist/chunk-KCPT2D6G.js +0 -552
- package/dist/chunk-NOYZIMUJ.mjs +0 -144
- package/dist/chunk-PNVFW245.js +0 -144
- package/dist/chunk-ROJC3NBJ.js +0 -104
- package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
- package/dist/schedule-Fque9Abz.d.ts +0 -70
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
var _chunk76YMRMH2cjs = require('../chunk-76YMRMH2.cjs');
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
@@ -60,545 +61,29 @@
|
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
|
|
63
|
-
var _chunkJNFRRJYHcjs = require('../chunk-JNFRRJYH.cjs');
|
|
64
|
-
require('../chunk-JX3LZQJH.cjs');
|
|
65
64
|
|
|
66
65
|
|
|
67
|
-
var _chunkWQ5QNU5Rcjs = require('../chunk-WQ5QNU5R.cjs');
|
|
68
66
|
|
|
69
67
|
|
|
70
68
|
|
|
71
69
|
|
|
72
70
|
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var _chunkENKODRU3cjs = require('../chunk-ENKODRU3.cjs');
|
|
80
|
+
require('../chunk-52PPNNI4.cjs');
|
|
81
|
+
require('../chunk-3LOYJFRR.cjs');
|
|
82
|
+
require('../chunk-GLE2WY7Z.cjs');
|
|
83
|
+
require('../chunk-MVGUEJ5Z.cjs');
|
|
84
|
+
require('../chunk-CZIVE6NT.cjs');
|
|
76
85
|
require('../chunk-OBGZSXTJ.cjs');
|
|
77
86
|
|
|
78
|
-
// src/observability/http.ts
|
|
79
|
-
var DEFAULT_DURATION_BUCKETS = [1, 5, 10, 25, 50, 100, 250, 500, 1e3, 2500, 5e3, 1e4];
|
|
80
|
-
function withHttpObservability(options) {
|
|
81
|
-
const resolved = resolveHttpObservabilityOptions(options);
|
|
82
|
-
return (next) => {
|
|
83
|
-
return (req) => {
|
|
84
|
-
const run = _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
85
|
-
beginHttpObservation(req, resolved),
|
|
86
|
-
(state) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
87
|
-
logHttpRequest(req, resolved),
|
|
88
|
-
() => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
89
|
-
prepareHttpRequest(req, resolved),
|
|
90
|
-
(wireReq) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
91
|
-
next(wireReq),
|
|
92
|
-
(error) => {
|
|
93
|
-
const finish = state.finishWithError(error);
|
|
94
|
-
const adaptiveLimiterAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
|
|
95
|
-
return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
96
|
-
_chunkJNFRRJYHcjs.spanEvent.call(void 0, "http.client.error", {
|
|
97
|
-
...finish.spanAttributes,
|
|
98
|
-
...adaptiveLimiterAttrs,
|
|
99
|
-
"error.type": error._tag
|
|
100
|
-
}),
|
|
101
|
-
() => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, logHttpError(req, error, finish, resolved), () => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error))
|
|
102
|
-
);
|
|
103
|
-
},
|
|
104
|
-
(res) => {
|
|
105
|
-
const finish = state.finishWithResponse(res);
|
|
106
|
-
const adaptiveLimiterAttrs = observeAdaptiveLimiter(wireReq, next, resolved);
|
|
107
|
-
return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
108
|
-
_chunkJNFRRJYHcjs.spanEvent.call(void 0, "http.client.response", {
|
|
109
|
-
...finish.spanAttributes,
|
|
110
|
-
...adaptiveLimiterAttrs
|
|
111
|
-
}),
|
|
112
|
-
() => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, logHttpResponse(req, res, finish, resolved), () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, res))
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
)
|
|
118
|
-
);
|
|
119
|
-
if (resolved.spans === false) return run;
|
|
120
|
-
return _chunkJNFRRJYHcjs.withSpan.call(void 0, spanName(req, resolved.spans), run, spanStartAttributes(req, resolved));
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
var makeHttpObservabilityMiddleware = withHttpObservability;
|
|
125
|
-
function beginHttpObservation(req, options) {
|
|
126
|
-
return _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
127
|
-
const startedAt = options.clock();
|
|
128
|
-
let finished = false;
|
|
129
|
-
const inFlight = _optionalChain([options, 'access', _ => _.metrics, 'optionalAccess', _2 => _2.gauge, 'call', _3 => _3("brass_http_client_in_flight", requestBaseLabels(req, options))]);
|
|
130
|
-
_optionalChain([inFlight, 'optionalAccess', _4 => _4.increment, 'call', _5 => _5()]);
|
|
131
|
-
const finish = (outcome, status, extra = {}) => {
|
|
132
|
-
const durationMs = Math.max(0, options.clock() - startedAt);
|
|
133
|
-
const labels = requestFinishLabels(req, outcome, status, options);
|
|
134
|
-
if (!finished) {
|
|
135
|
-
finished = true;
|
|
136
|
-
if (inFlight && inFlight.value() > 0) inFlight.decrement();
|
|
137
|
-
_optionalChain([options, 'access', _6 => _6.metrics, 'optionalAccess', _7 => _7.counter, 'call', _8 => _8("brass_http_client_requests_total", labels), 'access', _9 => _9.increment, 'call', _10 => _10()]);
|
|
138
|
-
_optionalChain([options, 'access', _11 => _11.metrics, 'optionalAccess', _12 => _12.histogram, 'call', _13 => _13("brass_http_client_duration_ms", [..._nullishCoalesce(options.durationBuckets, () => ( DEFAULT_DURATION_BUCKETS))], labels), 'access', _14 => _14.observe, 'call', _15 => _15(durationMs, currentTraceExemplar(durationMs, startedAt + durationMs))]);
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
durationMs,
|
|
142
|
-
outcome,
|
|
143
|
-
labels,
|
|
144
|
-
spanAttributes: {
|
|
145
|
-
"http.duration_ms": durationMs,
|
|
146
|
-
"http.outcome": outcome,
|
|
147
|
-
...status ? { "http.status_code": Number(status) } : {},
|
|
148
|
-
...status ? { "http.response.status_code": Number(status) } : {},
|
|
149
|
-
...extra
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
|
|
154
|
-
_optionalChain([fiber, 'optionalAccess', _16 => _16.addFinalizer, 'optionalCall', _17 => _17(() => {
|
|
155
|
-
finish("abort", void 0, { "http.cancelled": true });
|
|
156
|
-
})]);
|
|
157
|
-
return {
|
|
158
|
-
finishWithResponse: (res) => finish(httpStatusOutcome(res.status), String(res.status)),
|
|
159
|
-
finishWithError: (error) => finish(httpErrorOutcome(error), void 0, { "error.type": error._tag })
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function prepareHttpRequest(req, options) {
|
|
164
|
-
if (!options.injectTraceHeaders) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, req);
|
|
165
|
-
return _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => injectCurrentTraceContext(req));
|
|
166
|
-
}
|
|
167
|
-
function logHttpRequest(req, options) {
|
|
168
|
-
const level = options.logs === false ? false : _nullishCoalesce(options.logs.requestLevel, () => ( false));
|
|
169
|
-
if (!level) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
170
|
-
return _chunkJNFRRJYHcjs.logEffect.call(void 0, level, "http.client.request", requestLogFields(req, options));
|
|
171
|
-
}
|
|
172
|
-
function logHttpResponse(req, res, finish, options) {
|
|
173
|
-
const configured = options.logs === false ? false : _nullishCoalesce(options.logs.responseLevel, () => ( false));
|
|
174
|
-
const level = configured || (finish.outcome === "error" ? options.logs !== false ? _nullishCoalesce(options.logs.errorLevel, () => ( "warn")) : false : false);
|
|
175
|
-
if (!level) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
176
|
-
return _chunkJNFRRJYHcjs.logEffect.call(void 0, level, "http.client.response", {
|
|
177
|
-
...requestLogFields(req, options),
|
|
178
|
-
status: res.status,
|
|
179
|
-
statusText: res.statusText,
|
|
180
|
-
outcome: finish.outcome,
|
|
181
|
-
durationMs: finish.durationMs
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
function logHttpError(req, error, finish, options) {
|
|
185
|
-
const level = options.logs === false ? false : _nullishCoalesce(options.logs.errorLevel, () => ( "error"));
|
|
186
|
-
if (!level) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
187
|
-
return _chunkJNFRRJYHcjs.logEffect.call(void 0, level, "http.client.error", {
|
|
188
|
-
...requestLogFields(req, options),
|
|
189
|
-
outcome: finish.outcome,
|
|
190
|
-
durationMs: finish.durationMs,
|
|
191
|
-
errorTag: error._tag,
|
|
192
|
-
message: httpErrorMessage(error)
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function resolveHttpObservabilityOptions(options) {
|
|
196
|
-
const maybeObservability = options && "eventBus" in options && "prometheus" in options ? options : void 0;
|
|
197
|
-
const raw = maybeObservability ? { metrics: maybeObservability.metrics } : options;
|
|
198
|
-
return {
|
|
199
|
-
metrics: _optionalChain([raw, 'optionalAccess', _18 => _18.metrics]) === false ? void 0 : _optionalChain([raw, 'optionalAccess', _19 => _19.metrics]),
|
|
200
|
-
logs: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _20 => _20.logs]), () => ( {})),
|
|
201
|
-
spans: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _21 => _21.spans]), () => ( {})),
|
|
202
|
-
adaptiveLimiter: resolveAdaptiveLimiterObservabilityOptions(_optionalChain([raw, 'optionalAccess', _22 => _22.adaptiveLimiter])),
|
|
203
|
-
injectTraceHeaders: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _23 => _23.injectTraceHeaders]), () => ( true)),
|
|
204
|
-
includeHostLabel: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _24 => _24.includeHostLabel]), () => ( true)),
|
|
205
|
-
route: _optionalChain([raw, 'optionalAccess', _25 => _25.route]),
|
|
206
|
-
clock: _nullishCoalesce(_optionalChain([raw, 'optionalAccess', _26 => _26.clock]), () => ( Date.now)),
|
|
207
|
-
durationBuckets: _optionalChain([raw, 'optionalAccess', _27 => _27.durationBuckets])
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
function resolveAdaptiveLimiterObservabilityOptions(options) {
|
|
211
|
-
if (options === false) return { enabled: false, includeKeyLabel: false };
|
|
212
|
-
if (options === true || options === void 0) return { enabled: true, includeKeyLabel: false };
|
|
213
|
-
return {
|
|
214
|
-
enabled: _nullishCoalesce(options.enabled, () => ( true)),
|
|
215
|
-
includeKeyLabel: _nullishCoalesce(options.includeKeyLabel, () => ( false))
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
function observeAdaptiveLimiter(req, next, options) {
|
|
219
|
-
if (!options.adaptiveLimiter.enabled) return {};
|
|
220
|
-
const limiter = adaptiveLimiterOf(next);
|
|
221
|
-
if (!limiter || !options.metrics && options.spans === false) return {};
|
|
222
|
-
const stats = limiter.stats();
|
|
223
|
-
const labels = adaptiveLimiterLabels(req, stats, options);
|
|
224
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_limit", stats.limit, labels);
|
|
225
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_in_flight", stats.inFlight, labels);
|
|
226
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_queue_depth", stats.queueDepth, labels);
|
|
227
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_state_count", stats.stateCount, labels);
|
|
228
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_utilization", stats.utilization, labels);
|
|
229
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_error_rate", stats.errorRate, labels);
|
|
230
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_requests_per_second", stats.requestsPerSecond, labels);
|
|
231
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_completions_per_second", stats.completionsPerSecond, labels);
|
|
232
|
-
setGauge(options.metrics, "brass_http_adaptive_limiter_rejection_rate", stats.rejectionRate, labels);
|
|
233
|
-
return compactSpanAttributes({
|
|
234
|
-
"http.adaptive_limiter.limit": stats.limit,
|
|
235
|
-
"http.adaptive_limiter.in_flight": stats.inFlight,
|
|
236
|
-
"http.adaptive_limiter.queue_depth": stats.queueDepth,
|
|
237
|
-
"http.adaptive_limiter.state_count": stats.stateCount,
|
|
238
|
-
"http.adaptive_limiter.utilization": stats.utilization,
|
|
239
|
-
"http.adaptive_limiter.error_rate": stats.errorRate,
|
|
240
|
-
"http.adaptive_limiter.requests_per_second": stats.requestsPerSecond,
|
|
241
|
-
"http.adaptive_limiter.completions_per_second": stats.completionsPerSecond,
|
|
242
|
-
"http.adaptive_limiter.rejection_rate": stats.rejectionRate
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
function adaptiveLimiterOf(next) {
|
|
246
|
-
const limiter = next.adaptiveLimiter;
|
|
247
|
-
return limiter && typeof limiter.stats === "function" ? limiter : void 0;
|
|
248
|
-
}
|
|
249
|
-
function adaptiveLimiterLabels(req, stats, options) {
|
|
250
|
-
const key = options.adaptiveLimiter.includeKeyLabel ? inferAdaptiveLimiterKey(req, stats) : void 0;
|
|
251
|
-
return compactLabels({
|
|
252
|
-
...requestBaseLabels(req, options),
|
|
253
|
-
key
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
function inferAdaptiveLimiterKey(req, stats) {
|
|
257
|
-
if (req.poolKey) return req.poolKey;
|
|
258
|
-
const host = requestHost(req);
|
|
259
|
-
if (host) return host;
|
|
260
|
-
return _optionalChain([stats, 'access', _28 => _28.keys, 'optionalAccess', _29 => _29.length]) === 1 ? stats.keys[0] : void 0;
|
|
261
|
-
}
|
|
262
|
-
function setGauge(metrics, name, value, labels) {
|
|
263
|
-
if (!metrics || value === void 0 || !Number.isFinite(value)) return;
|
|
264
|
-
metrics.gauge(name, labels).set(value);
|
|
265
|
-
}
|
|
266
|
-
function compactSpanAttributes(attrs) {
|
|
267
|
-
const out = {};
|
|
268
|
-
for (const [key, value] of Object.entries(attrs)) {
|
|
269
|
-
if (value !== void 0 && Number.isFinite(value)) out[key] = value;
|
|
270
|
-
}
|
|
271
|
-
return out;
|
|
272
|
-
}
|
|
273
|
-
function spanName(req, options) {
|
|
274
|
-
if (options && options.name) {
|
|
275
|
-
return typeof options.name === "function" ? options.name(req) : options.name;
|
|
276
|
-
}
|
|
277
|
-
return `HTTP ${req.method}`;
|
|
278
|
-
}
|
|
279
|
-
function spanStartAttributes(req, options) {
|
|
280
|
-
const spanOptions = options.spans === false ? {} : options.spans.attributes;
|
|
281
|
-
const custom = typeof spanOptions === "function" ? spanOptions(req) : _nullishCoalesce(spanOptions, () => ( {}));
|
|
282
|
-
const host = requestHost(req);
|
|
283
|
-
const route = requestRoute(req, options);
|
|
284
|
-
return {
|
|
285
|
-
"span.kind": "client",
|
|
286
|
-
"http.method": req.method,
|
|
287
|
-
"http.request.method": req.method,
|
|
288
|
-
"http.url": sanitizeUrl(req.url),
|
|
289
|
-
"url.full": sanitizeUrl(req.url),
|
|
290
|
-
...urlScheme(req.url) ? { "url.scheme": urlScheme(req.url) } : {},
|
|
291
|
-
...urlPath(req.url) ? { "url.path": urlPath(req.url) } : {},
|
|
292
|
-
...host ? { "server.address": host } : {},
|
|
293
|
-
...route ? { "http.route": route } : {},
|
|
294
|
-
...custom
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
function requestBaseLabels(req, options) {
|
|
298
|
-
return compactLabels({
|
|
299
|
-
method: req.method,
|
|
300
|
-
...options.includeHostLabel ? { host: requestHost(req) } : {},
|
|
301
|
-
...requestRoute(req, options) ? { route: requestRoute(req, options) } : {}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
function requestFinishLabels(req, outcome, status, options) {
|
|
305
|
-
return {
|
|
306
|
-
...requestBaseLabels(req, options),
|
|
307
|
-
outcome,
|
|
308
|
-
status: _nullishCoalesce(status, () => ( "none"))
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
function requestLogFields(req, options) {
|
|
312
|
-
const host = requestHost(req);
|
|
313
|
-
const route = requestRoute(req, options);
|
|
314
|
-
return {
|
|
315
|
-
method: req.method,
|
|
316
|
-
url: sanitizeUrl(req.url),
|
|
317
|
-
...host ? { host } : {},
|
|
318
|
-
...route ? { route } : {}
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
function requestRoute(req, options) {
|
|
322
|
-
if (typeof options.route === "function") return options.route(req);
|
|
323
|
-
return options.route;
|
|
324
|
-
}
|
|
325
|
-
function httpStatusOutcome(status) {
|
|
326
|
-
return status >= 400 ? "error" : "success";
|
|
327
|
-
}
|
|
328
|
-
function httpErrorOutcome(error) {
|
|
329
|
-
switch (error._tag) {
|
|
330
|
-
case "Abort":
|
|
331
|
-
return "abort";
|
|
332
|
-
case "BadUrl":
|
|
333
|
-
return "bad_url";
|
|
334
|
-
case "FetchError":
|
|
335
|
-
return "fetch_error";
|
|
336
|
-
case "Timeout":
|
|
337
|
-
return "timeout";
|
|
338
|
-
case "PoolRejected":
|
|
339
|
-
return "pool_rejected";
|
|
340
|
-
case "PoolTimeout":
|
|
341
|
-
return "pool_timeout";
|
|
342
|
-
case "PoolClosed":
|
|
343
|
-
return "pool_closed";
|
|
344
|
-
case "BatchSplitError":
|
|
345
|
-
return "batch_split_error";
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
function httpErrorMessage(error) {
|
|
349
|
-
return "message" in error ? error.message : void 0;
|
|
350
|
-
}
|
|
351
|
-
function injectCurrentTraceContext(req) {
|
|
352
|
-
const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
|
|
353
|
-
const trace = _optionalChain([fiber, 'optionalAccess', _30 => _30.fiberContext, 'optionalAccess', _31 => _31.trace]);
|
|
354
|
-
if (!_optionalChain([trace, 'optionalAccess', _32 => _32.traceId]) || !_optionalChain([trace, 'optionalAccess', _33 => _33.spanId])) return req;
|
|
355
|
-
return {
|
|
356
|
-
...req,
|
|
357
|
-
headers: _chunkJNFRRJYHcjs.injectTraceContext.call(void 0, req.headers, trace)
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
function currentTraceExemplar(value, timestamp) {
|
|
361
|
-
const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
|
|
362
|
-
return _chunkJNFRRJYHcjs.exemplarFromTraceContext.call(void 0, _optionalChain([fiber, 'optionalAccess', _34 => _34.fiberContext, 'optionalAccess', _35 => _35.trace]), value, timestamp);
|
|
363
|
-
}
|
|
364
|
-
function requestHost(req) {
|
|
365
|
-
try {
|
|
366
|
-
return new URL(req.url).host;
|
|
367
|
-
} catch (e) {
|
|
368
|
-
return void 0;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
function urlScheme(url) {
|
|
372
|
-
try {
|
|
373
|
-
return new URL(url).protocol.replace(/:$/, "");
|
|
374
|
-
} catch (e2) {
|
|
375
|
-
return void 0;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function urlPath(url) {
|
|
379
|
-
try {
|
|
380
|
-
return new URL(url).pathname;
|
|
381
|
-
} catch (e3) {
|
|
382
|
-
return void 0;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
function sanitizeUrl(url) {
|
|
386
|
-
try {
|
|
387
|
-
const parsed = new URL(url);
|
|
388
|
-
parsed.search = "";
|
|
389
|
-
parsed.hash = "";
|
|
390
|
-
return parsed.toString();
|
|
391
|
-
} catch (e4) {
|
|
392
|
-
const [withoutHash] = url.split("#", 1);
|
|
393
|
-
const [withoutQuery] = withoutHash.split("?", 1);
|
|
394
|
-
return withoutQuery;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
function compactLabels(labels) {
|
|
398
|
-
const out = {};
|
|
399
|
-
for (const [key, value] of Object.entries(labels)) {
|
|
400
|
-
if (value !== void 0 && value !== "") out[key] = value;
|
|
401
|
-
}
|
|
402
|
-
return out;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// src/observability/adapters.ts
|
|
406
|
-
function makeFetchRequestObservabilityContext(observability, request, input = {}) {
|
|
407
|
-
return _chunkJNFRRJYHcjs.makeRequestObservabilityContext.call(void 0, observability, {
|
|
408
|
-
headers: request.headers,
|
|
409
|
-
method: request.method,
|
|
410
|
-
target: _chunkJNFRRJYHcjs.sanitizeHttpTarget.call(void 0, request.url),
|
|
411
|
-
route: _nullishCoalesce(input.route, () => ( _chunkJNFRRJYHcjs.normalizeHttpRoute.call(void 0, urlPathname(request.url)))),
|
|
412
|
-
...input
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
function makeNodeRequestObservabilityContext(observability, request, input = {}) {
|
|
416
|
-
return _chunkJNFRRJYHcjs.makeRequestObservabilityContext.call(void 0, observability, {
|
|
417
|
-
headers: request.headers,
|
|
418
|
-
method: request.method,
|
|
419
|
-
target: _chunkJNFRRJYHcjs.sanitizeHttpTarget.call(void 0, request.url),
|
|
420
|
-
route: _nullishCoalesce(input.route, () => ( _chunkJNFRRJYHcjs.normalizeHttpRoute.call(void 0, request.url))),
|
|
421
|
-
...input
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
function makeExpressRequestObservabilityContext(observability, request, input = {}) {
|
|
425
|
-
return _chunkJNFRRJYHcjs.makeRequestObservabilityContext.call(void 0, observability, {
|
|
426
|
-
headers: request.headers,
|
|
427
|
-
method: request.method,
|
|
428
|
-
target: _chunkJNFRRJYHcjs.sanitizeHttpTarget.call(void 0, _nullishCoalesce(request.originalUrl, () => ( request.url))),
|
|
429
|
-
route: _nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _36 => _36.route, 'optionalAccess', _37 => _37.path]))), () => ( _chunkJNFRRJYHcjs.normalizeHttpRoute.call(void 0, _nullishCoalesce(request.path, () => ( request.url))))),
|
|
430
|
-
...input
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
function makeFastifyRequestObservabilityContext(observability, request, input = {}) {
|
|
434
|
-
return _chunkJNFRRJYHcjs.makeRequestObservabilityContext.call(void 0, observability, {
|
|
435
|
-
headers: request.headers,
|
|
436
|
-
method: request.method,
|
|
437
|
-
target: _chunkJNFRRJYHcjs.sanitizeHttpTarget.call(void 0, request.url),
|
|
438
|
-
route: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(input.route, () => ( _optionalChain([request, 'access', _38 => _38.routeOptions, 'optionalAccess', _39 => _39.url]))), () => ( request.routerPath)), () => ( _chunkJNFRRJYHcjs.normalizeHttpRoute.call(void 0, request.url))),
|
|
439
|
-
...input
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
function withFetchRequestObservability(observability, handler, input = {}) {
|
|
443
|
-
return async (request) => handler(makeFetchRequestObservabilityContext(observability, request, input), request);
|
|
444
|
-
}
|
|
445
|
-
function withNodeRequestObservability(observability, handler, input = {}) {
|
|
446
|
-
return async (request) => handler(makeNodeRequestObservabilityContext(observability, request, input), request);
|
|
447
|
-
}
|
|
448
|
-
function urlPathname(url) {
|
|
449
|
-
if (!url) return void 0;
|
|
450
|
-
try {
|
|
451
|
-
return new URL(url, "http://local").pathname;
|
|
452
|
-
} catch (e5) {
|
|
453
|
-
return url;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// src/observability/config.ts
|
|
458
|
-
function makeNoopObservability() {
|
|
459
|
-
return _chunkJNFRRJYHcjs.makeObservability.call(void 0, {
|
|
460
|
-
metrics: false,
|
|
461
|
-
logs: false,
|
|
462
|
-
traces: false,
|
|
463
|
-
autoStart: false
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
function makeObservabilityPreset(preset, overrides = {}) {
|
|
467
|
-
if (preset === "disabled") return makeNoopObservability();
|
|
468
|
-
return _chunkJNFRRJYHcjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsForPreset(preset), overrides));
|
|
469
|
-
}
|
|
470
|
-
function makeObservabilityFromEnv(env = readProcessEnv(), overrides = {}) {
|
|
471
|
-
const preset = env.BRASS_OBSERVABILITY === "disabled" ? "disabled" : parsePreset(_nullishCoalesce(env.BRASS_OBSERVABILITY_PRESET, () => ( env.NODE_ENV)));
|
|
472
|
-
if (preset === "disabled") return makeNoopObservability();
|
|
473
|
-
return _chunkJNFRRJYHcjs.makeObservability.call(void 0, mergeObservabilityOptions(observabilityOptionsFromEnv(env, preset), overrides));
|
|
474
|
-
}
|
|
475
|
-
function observabilityOptionsForPreset(preset) {
|
|
476
|
-
switch (preset) {
|
|
477
|
-
case "production":
|
|
478
|
-
return {
|
|
479
|
-
logs: { minLevel: "info" },
|
|
480
|
-
sampling: { ratio: 1, respectRemoteSampled: true, forceSampleOnError: true },
|
|
481
|
-
redaction: {},
|
|
482
|
-
cardinality: { maxValuesPerLabel: 100 },
|
|
483
|
-
otlp: {
|
|
484
|
-
timeoutMs: 1e4,
|
|
485
|
-
retry: { attempts: 3, initialDelayMs: 100, maxDelayMs: 2e3 },
|
|
486
|
-
pipeline: {
|
|
487
|
-
maxQueueSize: 1e4,
|
|
488
|
-
batchSize: 512,
|
|
489
|
-
dropPolicy: "drop-oldest",
|
|
490
|
-
shutdownTimeoutMs: 1e4
|
|
491
|
-
}
|
|
492
|
-
},
|
|
493
|
-
flushIntervalMs: 1e4,
|
|
494
|
-
autoStart: true
|
|
495
|
-
};
|
|
496
|
-
case "test":
|
|
497
|
-
return {
|
|
498
|
-
logs: false,
|
|
499
|
-
sampling: 1,
|
|
500
|
-
redaction: {},
|
|
501
|
-
otlp: {
|
|
502
|
-
timeoutMs: 1e3,
|
|
503
|
-
retry: { attempts: 1 },
|
|
504
|
-
pipeline: { maxQueueSize: 1e3, batchSize: 256, shutdownTimeoutMs: 1e3 }
|
|
505
|
-
},
|
|
506
|
-
autoStart: false
|
|
507
|
-
};
|
|
508
|
-
case "development":
|
|
509
|
-
return {
|
|
510
|
-
logs: { minLevel: "debug" },
|
|
511
|
-
sampling: 1,
|
|
512
|
-
redaction: {},
|
|
513
|
-
cardinality: { maxValuesPerLabel: 100 },
|
|
514
|
-
autoStart: false
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
function observabilityOptionsFromEnv(env = readProcessEnv(), preset = parsePreset(_nullishCoalesce(env.BRASS_OBSERVABILITY_PRESET, () => ( env.NODE_ENV)))) {
|
|
519
|
-
const base = observabilityOptionsForPreset(preset);
|
|
520
|
-
const serviceName = _nullishCoalesce(env.OTEL_SERVICE_NAME, () => ( env.BRASS_SERVICE_NAME));
|
|
521
|
-
const serviceVersion = _nullishCoalesce(env.OTEL_SERVICE_VERSION, () => ( env.BRASS_SERVICE_VERSION));
|
|
522
|
-
const endpoint = trimTrailingSlash(env.OTEL_EXPORTER_OTLP_ENDPOINT);
|
|
523
|
-
const metricsUrl = _nullishCoalesce(env.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, () => ( (endpoint ? `${endpoint}/v1/metrics` : void 0)));
|
|
524
|
-
const tracesUrl = _nullishCoalesce(env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, () => ( (endpoint ? `${endpoint}/v1/traces` : void 0)));
|
|
525
|
-
const logsUrl = _nullishCoalesce(env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, () => ( (endpoint ? `${endpoint}/v1/logs` : void 0)));
|
|
526
|
-
const headers = parseHeaders(env.OTEL_EXPORTER_OTLP_HEADERS);
|
|
527
|
-
const flushIntervalMs = parsePositiveInt(env.BRASS_OBSERVABILITY_FLUSH_INTERVAL_MS);
|
|
528
|
-
const timeoutMs = parsePositiveInt(env.BRASS_OBSERVABILITY_EXPORT_TIMEOUT_MS);
|
|
529
|
-
const sampleRatio = parseRatio(_nullishCoalesce(env.BRASS_TRACE_SAMPLE_RATIO, () => ( env.OTEL_TRACES_SAMPLER_ARG)));
|
|
530
|
-
const minLevel = env.BRASS_OBSERVABILITY_LOG_LEVEL;
|
|
531
|
-
const otlp = {
|
|
532
|
-
..._nullishCoalesce(base.otlp, () => ( {})),
|
|
533
|
-
...metricsUrl ? { metricsUrl } : {},
|
|
534
|
-
...tracesUrl ? { tracesUrl } : {},
|
|
535
|
-
...logsUrl ? { logsUrl } : {},
|
|
536
|
-
...headers ? { headers } : {},
|
|
537
|
-
...timeoutMs ? { timeoutMs } : {}
|
|
538
|
-
};
|
|
539
|
-
return mergeObservabilityOptions(base, {
|
|
540
|
-
...serviceName ? { serviceName } : {},
|
|
541
|
-
...serviceVersion ? { serviceVersion } : {},
|
|
542
|
-
...Object.keys(otlp).length > 0 ? { otlp } : {},
|
|
543
|
-
...flushIntervalMs ? { flushIntervalMs, autoStart: true } : {},
|
|
544
|
-
...sampleRatio !== void 0 ? { sampling: { ratio: sampleRatio, respectRemoteSampled: true, forceSampleOnError: true } } : {},
|
|
545
|
-
...minLevel === "debug" || minLevel === "info" || minLevel === "warn" || minLevel === "error" ? { logs: { minLevel } } : {}
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
function mergeObservabilityOptions(base, overrides) {
|
|
549
|
-
return {
|
|
550
|
-
...base,
|
|
551
|
-
...overrides,
|
|
552
|
-
metrics: _nullishCoalesce(overrides.metrics, () => ( base.metrics)),
|
|
553
|
-
logs: _nullishCoalesce(overrides.logs, () => ( base.logs)),
|
|
554
|
-
otlp: {
|
|
555
|
-
..._nullishCoalesce(base.otlp, () => ( {})),
|
|
556
|
-
..._nullishCoalesce(overrides.otlp, () => ( {})),
|
|
557
|
-
retry: _nullishCoalesce(_optionalChain([overrides, 'access', _40 => _40.otlp, 'optionalAccess', _41 => _41.retry]), () => ( _optionalChain([base, 'access', _42 => _42.otlp, 'optionalAccess', _43 => _43.retry]))),
|
|
558
|
-
pipeline: {
|
|
559
|
-
..._nullishCoalesce(_optionalChain([base, 'access', _44 => _44.otlp, 'optionalAccess', _45 => _45.pipeline]), () => ( {})),
|
|
560
|
-
..._nullishCoalesce(_optionalChain([overrides, 'access', _46 => _46.otlp, 'optionalAccess', _47 => _47.pipeline]), () => ( {}))
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
function parsePreset(value) {
|
|
566
|
-
if (value === "production" || value === "prod") return "production";
|
|
567
|
-
if (value === "test") return "test";
|
|
568
|
-
return "development";
|
|
569
|
-
}
|
|
570
|
-
function parseHeaders(value) {
|
|
571
|
-
if (!value) return void 0;
|
|
572
|
-
const out = {};
|
|
573
|
-
for (const part of value.split(",")) {
|
|
574
|
-
const index = part.indexOf("=");
|
|
575
|
-
if (index <= 0) continue;
|
|
576
|
-
const key = part.slice(0, index).trim();
|
|
577
|
-
const headerValue = part.slice(index + 1).trim();
|
|
578
|
-
if (key) out[key] = headerValue;
|
|
579
|
-
}
|
|
580
|
-
return Object.keys(out).length > 0 ? out : void 0;
|
|
581
|
-
}
|
|
582
|
-
function parsePositiveInt(value) {
|
|
583
|
-
if (!value) return void 0;
|
|
584
|
-
const parsed = Number.parseInt(value, 10);
|
|
585
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
|
|
586
|
-
}
|
|
587
|
-
function parseRatio(value) {
|
|
588
|
-
if (!value) return void 0;
|
|
589
|
-
const parsed = Number.parseFloat(value);
|
|
590
|
-
if (!Number.isFinite(parsed)) return void 0;
|
|
591
|
-
return Math.max(0, Math.min(1, parsed));
|
|
592
|
-
}
|
|
593
|
-
function trimTrailingSlash(value) {
|
|
594
|
-
if (!value) return void 0;
|
|
595
|
-
let out = value;
|
|
596
|
-
while (out.endsWith("/")) out = out.slice(0, -1);
|
|
597
|
-
return out || void 0;
|
|
598
|
-
}
|
|
599
|
-
function readProcessEnv() {
|
|
600
|
-
return typeof process !== "undefined" ? process.env : {};
|
|
601
|
-
}
|
|
602
87
|
|
|
603
88
|
|
|
604
89
|
|
|
@@ -674,4 +159,4 @@ function readProcessEnv() {
|
|
|
674
159
|
|
|
675
160
|
|
|
676
161
|
|
|
677
|
-
exports.OTLP_JSON_CONTENT_TYPE =
|
|
162
|
+
exports.HTTP_OBSERVABILITY_CONTRACT = _chunk76YMRMH2cjs.HTTP_OBSERVABILITY_CONTRACT; exports.OTLP_JSON_CONTENT_TYPE = _chunkENKODRU3cjs.OTLP_JSON_CONTENT_TYPE; exports.PROMETHEUS_CONTENT_TYPE = _chunkENKODRU3cjs.PROMETHEUS_CONTENT_TYPE; exports.alwaysOffSampler = _chunkENKODRU3cjs.alwaysOffSampler; exports.alwaysOnSampler = _chunkENKODRU3cjs.alwaysOnSampler; exports.currentBaggage = _chunkENKODRU3cjs.currentBaggage; exports.currentSpanLink = _chunkENKODRU3cjs.currentSpanLink; exports.defaultStructuredLogWriter = _chunkENKODRU3cjs.defaultStructuredLogWriter; exports.exemplarFromTraceContext = _chunkENKODRU3cjs.exemplarFromTraceContext; exports.exportWithRetry = _chunkENKODRU3cjs.exportWithRetry; exports.extractBaggage = _chunkENKODRU3cjs.extractBaggage; exports.extractTraceContext = _chunkENKODRU3cjs.extractTraceContext; exports.formatBaggage = _chunkENKODRU3cjs.formatBaggage; exports.formatPrometheusMetrics = _chunkENKODRU3cjs.formatPrometheusMetrics; exports.formatStructuredLog = _chunkENKODRU3cjs.formatStructuredLog; exports.formatTraceparent = _chunkENKODRU3cjs.formatTraceparent; exports.healthToHttpResponse = _chunkENKODRU3cjs.healthToHttpResponse; exports.injectBaggage = _chunkENKODRU3cjs.injectBaggage; exports.injectTraceContext = _chunkENKODRU3cjs.injectTraceContext; exports.logEffect = _chunkENKODRU3cjs.logEffect; exports.makeCardinalityLimitedMetrics = _chunkENKODRU3cjs.makeCardinalityLimitedMetrics; exports.makeExportPipeline = _chunkENKODRU3cjs.makeExportPipeline; exports.makeExpressRequestObservabilityContext = _chunk76YMRMH2cjs.makeExpressRequestObservabilityContext; exports.makeFastifyRequestObservabilityContext = _chunk76YMRMH2cjs.makeFastifyRequestObservabilityContext; exports.makeFetchRequestObservabilityContext = _chunk76YMRMH2cjs.makeFetchRequestObservabilityContext; exports.makeHttpObservabilityMiddleware = _chunk76YMRMH2cjs.makeHttpObservabilityMiddleware; exports.makeNodeRequestObservabilityContext = _chunk76YMRMH2cjs.makeNodeRequestObservabilityContext; exports.makeNoopObservability = _chunk76YMRMH2cjs.makeNoopObservability; exports.makeObservability = _chunkENKODRU3cjs.makeObservability; exports.makeObservabilityFromEnv = _chunk76YMRMH2cjs.makeObservabilityFromEnv; exports.makeObservabilityPreset = _chunk76YMRMH2cjs.makeObservabilityPreset; exports.makeObservabilityRedactor = _chunkENKODRU3cjs.makeObservabilityRedactor; exports.makeOtlpHttpLogExporter = _chunkENKODRU3cjs.makeOtlpHttpLogExporter; exports.makeOtlpHttpMetricsExporter = _chunkENKODRU3cjs.makeOtlpHttpMetricsExporter; exports.makeOtlpHttpSpanExporter = _chunkENKODRU3cjs.makeOtlpHttpSpanExporter; exports.makePrometheusMetricsExporter = _chunkENKODRU3cjs.makePrometheusMetricsExporter; exports.makeRequestObservabilityContext = _chunkENKODRU3cjs.makeRequestObservabilityContext; exports.makeRuntimeHealth = _chunkENKODRU3cjs.makeRuntimeHealth; exports.makeRuntimeMetricsSink = _chunkENKODRU3cjs.makeRuntimeMetricsSink; exports.makeStructuredLogSink = _chunkENKODRU3cjs.makeStructuredLogSink; exports.makeTraceSampler = _chunkENKODRU3cjs.makeTraceSampler; exports.metricsSnapshotToOtlp = _chunkENKODRU3cjs.metricsSnapshotToOtlp; exports.normalizeHttpRoute = _chunkENKODRU3cjs.normalizeHttpRoute; exports.normalizeSpanId = _chunkENKODRU3cjs.normalizeSpanId; exports.normalizeTraceId = _chunkENKODRU3cjs.normalizeTraceId; exports.observabilityOptionsForPreset = _chunk76YMRMH2cjs.observabilityOptionsForPreset; exports.observabilityOptionsFromEnv = _chunk76YMRMH2cjs.observabilityOptionsFromEnv; exports.observeHttpServerRequest = _chunkENKODRU3cjs.observeHttpServerRequest; exports.otlpAnyValue = _chunkENKODRU3cjs.otlpAnyValue; exports.parseBaggage = _chunkENKODRU3cjs.parseBaggage; exports.parseTraceparent = _chunkENKODRU3cjs.parseTraceparent; exports.postOtlpJson = _chunkENKODRU3cjs.postOtlpJson; exports.ratioSampler = _chunkENKODRU3cjs.ratioSampler; exports.readiness = _chunkENKODRU3cjs.readiness; exports.resolveRequestBaggage = _chunkENKODRU3cjs.resolveRequestBaggage; exports.resolveRequestTraceSeed = _chunkENKODRU3cjs.resolveRequestTraceSeed; exports.resolveTraceSampling = _chunkENKODRU3cjs.resolveTraceSampling; exports.runObservedHttpServerEffect = _chunkENKODRU3cjs.runObservedHttpServerEffect; exports.runtimeHealth = _chunkENKODRU3cjs.runtimeHealth; exports.sanitizeHttpTarget = _chunkENKODRU3cjs.sanitizeHttpTarget; exports.shouldSampleWith = _chunkENKODRU3cjs.shouldSampleWith; exports.snapshotRuntimeHealth = _chunkENKODRU3cjs.snapshotRuntimeHealth; exports.spanEvent = _chunkENKODRU3cjs.spanEvent; exports.spanLink = _chunkENKODRU3cjs.spanLink; exports.spansToOtlp = _chunkENKODRU3cjs.spansToOtlp; exports.structuredLogsToOtlp = _chunkENKODRU3cjs.structuredLogsToOtlp; exports.toOtlpAttributes = _chunkENKODRU3cjs.toOtlpAttributes; exports.unixNanoFromMs = _chunkENKODRU3cjs.unixNanoFromMs; exports.withBaggage = _chunkENKODRU3cjs.withBaggage; exports.withFetchRequestObservability = _chunk76YMRMH2cjs.withFetchRequestObservability; exports.withHttpObservability = _chunk76YMRMH2cjs.withHttpObservability; exports.withLogContext = _chunkENKODRU3cjs.withLogContext; exports.withNodeRequestObservability = _chunk76YMRMH2cjs.withNodeRequestObservability; exports.withSpan = _chunkENKODRU3cjs.withSpan; exports.withTimeout = _chunkENKODRU3cjs.withTimeout;
|