@zero-server/observe 0.9.1 → 0.9.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.
- package/LICENSE +21 -21
- package/index.js +22 -22
- package/lib/observe/health.js +326 -0
- package/lib/observe/index.js +50 -0
- package/lib/observe/logger.js +359 -0
- package/lib/observe/metrics.js +805 -0
- package/lib/observe/tracing.js +592 -0
- package/package.json +9 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Tony Wiedman
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tony Wiedman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// AUTO-GENERATED by .tools/generate-package-stubs.js — edit .tools/scope-manifest.js and re-run `npm run packages:generate`.
|
|
2
2
|
'use strict';
|
|
3
|
-
const
|
|
3
|
+
const lib = require("./lib/observe");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
|
-
Logger:
|
|
7
|
-
structuredLogger:
|
|
8
|
-
Counter:
|
|
9
|
-
Gauge:
|
|
10
|
-
Histogram:
|
|
11
|
-
MetricsRegistry:
|
|
12
|
-
DEFAULT_BUCKETS:
|
|
13
|
-
createDefaultMetrics:
|
|
14
|
-
metricsMiddleware:
|
|
15
|
-
metricsEndpoint:
|
|
16
|
-
Span:
|
|
17
|
-
Tracer:
|
|
18
|
-
parseTraceparent:
|
|
19
|
-
formatTraceparent:
|
|
20
|
-
tracingMiddleware:
|
|
21
|
-
instrumentFetch:
|
|
22
|
-
healthCheck:
|
|
23
|
-
createHealthHandlers:
|
|
24
|
-
memoryCheck:
|
|
25
|
-
eventLoopCheck:
|
|
26
|
-
diskSpaceCheck:
|
|
6
|
+
Logger: lib.Logger,
|
|
7
|
+
structuredLogger: lib.structuredLogger,
|
|
8
|
+
Counter: lib.Counter,
|
|
9
|
+
Gauge: lib.Gauge,
|
|
10
|
+
Histogram: lib.Histogram,
|
|
11
|
+
MetricsRegistry: lib.MetricsRegistry,
|
|
12
|
+
DEFAULT_BUCKETS: lib.DEFAULT_BUCKETS,
|
|
13
|
+
createDefaultMetrics: lib.createDefaultMetrics,
|
|
14
|
+
metricsMiddleware: lib.metricsMiddleware,
|
|
15
|
+
metricsEndpoint: lib.metricsEndpoint,
|
|
16
|
+
Span: lib.Span,
|
|
17
|
+
Tracer: lib.Tracer,
|
|
18
|
+
parseTraceparent: lib.parseTraceparent,
|
|
19
|
+
formatTraceparent: lib.formatTraceparent,
|
|
20
|
+
tracingMiddleware: lib.tracingMiddleware,
|
|
21
|
+
instrumentFetch: lib.instrumentFetch,
|
|
22
|
+
healthCheck: lib.healthCheck,
|
|
23
|
+
createHealthHandlers: lib.createHealthHandlers,
|
|
24
|
+
memoryCheck: lib.memoryCheck,
|
|
25
|
+
eventLoopCheck: lib.eventLoopCheck,
|
|
26
|
+
diskSpaceCheck: lib.diskSpaceCheck,
|
|
27
27
|
};
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module observe/health
|
|
3
|
+
* @description Health check middleware with liveness and readiness probes.
|
|
4
|
+
* Kubernetes-compatible `/healthz` and `/readyz` endpoints with
|
|
5
|
+
* composable checks (database ping, memory, event loop lag,
|
|
6
|
+
* disk space) and custom check registration.
|
|
7
|
+
*
|
|
8
|
+
* Returns `200` when healthy, `503` when degraded or during
|
|
9
|
+
* shutdown drain phase, with a JSON body detailing each check.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const { healthCheck } = require('@zero-server/sdk');
|
|
13
|
+
*
|
|
14
|
+
* app.get('/healthz', healthCheck());
|
|
15
|
+
* app.get('/readyz', healthCheck({
|
|
16
|
+
* checks: {
|
|
17
|
+
* database: () => db.ping(),
|
|
18
|
+
* cache: () => redis.ping(),
|
|
19
|
+
* },
|
|
20
|
+
* }));
|
|
21
|
+
*
|
|
22
|
+
* @example | Using the App Integration
|
|
23
|
+
* app.health('/healthz');
|
|
24
|
+
* app.ready('/readyz', {
|
|
25
|
+
* database: () => db.ping(),
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
const os = require('os');
|
|
29
|
+
|
|
30
|
+
// -- Built-in Checks -----------------------------------------------
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check memory usage against a threshold.
|
|
34
|
+
*
|
|
35
|
+
* @param {object} [opts] - Check options.
|
|
36
|
+
* @param {number} [opts.maxHeapUsedPercent=90] - Max heap usage percentage.
|
|
37
|
+
* @param {number} [opts.maxRssBytes] - Max RSS in bytes.
|
|
38
|
+
* @returns {Function} Check function.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* app.get('/healthz', healthCheck({
|
|
42
|
+
* checks: { memory: memoryCheck({ maxHeapUsedPercent: 85 }) },
|
|
43
|
+
* }));
|
|
44
|
+
*/
|
|
45
|
+
function memoryCheck(opts = {})
|
|
46
|
+
{
|
|
47
|
+
const maxPercent = typeof opts.maxHeapUsedPercent === 'number' ? opts.maxHeapUsedPercent : 90;
|
|
48
|
+
const maxRss = opts.maxRssBytes || Infinity;
|
|
49
|
+
|
|
50
|
+
return () =>
|
|
51
|
+
{
|
|
52
|
+
const mem = process.memoryUsage();
|
|
53
|
+
const heapPercent = (mem.heapUsed / mem.heapTotal) * 100;
|
|
54
|
+
const healthy = heapPercent < maxPercent && mem.rss < maxRss;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
healthy,
|
|
58
|
+
details: {
|
|
59
|
+
heapUsed: mem.heapUsed,
|
|
60
|
+
heapTotal: mem.heapTotal,
|
|
61
|
+
heapPercent: Math.round(heapPercent * 100) / 100,
|
|
62
|
+
rss: mem.rss,
|
|
63
|
+
external: mem.external,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Check event loop lag against a threshold.
|
|
71
|
+
*
|
|
72
|
+
* @param {object} [opts] - Check options.
|
|
73
|
+
* @param {number} [opts.maxLagMs=500] - Max acceptable lag in ms.
|
|
74
|
+
* @returns {Function} Check function.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* app.get('/healthz', healthCheck({
|
|
78
|
+
* checks: { eventLoop: eventLoopCheck({ maxLagMs: 200 }) },
|
|
79
|
+
* }));
|
|
80
|
+
*/
|
|
81
|
+
function eventLoopCheck(opts = {})
|
|
82
|
+
{
|
|
83
|
+
const maxLag = opts.maxLagMs || 500;
|
|
84
|
+
let _lastCheck = process.hrtime.bigint();
|
|
85
|
+
let _lag = 0;
|
|
86
|
+
|
|
87
|
+
// Sample event loop lag periodically
|
|
88
|
+
const _check = () =>
|
|
89
|
+
{
|
|
90
|
+
const now = process.hrtime.bigint();
|
|
91
|
+
const expected = 1_000_000_000n; // 1 second in nanoseconds
|
|
92
|
+
const actual = now - _lastCheck;
|
|
93
|
+
_lag = Math.max(0, Number(actual - expected) / 1e6); // ms
|
|
94
|
+
_lastCheck = now;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const timer = setInterval(_check, 1000);
|
|
98
|
+
if (timer.unref) timer.unref();
|
|
99
|
+
|
|
100
|
+
const check = () => ({
|
|
101
|
+
healthy: _lag < maxLag,
|
|
102
|
+
details: { lagMs: Math.round(_lag * 100) / 100, maxLagMs: maxLag },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Expose cleanup for testing
|
|
106
|
+
check._cleanup = () => clearInterval(timer);
|
|
107
|
+
return check;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Check available disk space (simple heuristic using os.freemem).
|
|
112
|
+
*
|
|
113
|
+
* @param {object} [opts] - Check options.
|
|
114
|
+
* @param {number} [opts.minFreeBytes=104857600] - Minimum free memory in bytes (default: 100MB).
|
|
115
|
+
* @returns {Function} Check function.
|
|
116
|
+
*/
|
|
117
|
+
function diskSpaceCheck(opts = {})
|
|
118
|
+
{
|
|
119
|
+
const minFree = opts.minFreeBytes || 104857600; // 100MB
|
|
120
|
+
|
|
121
|
+
return () =>
|
|
122
|
+
{
|
|
123
|
+
const free = os.freemem();
|
|
124
|
+
return {
|
|
125
|
+
healthy: free > minFree,
|
|
126
|
+
details: {
|
|
127
|
+
freeMemory: free,
|
|
128
|
+
totalMemory: os.totalmem(),
|
|
129
|
+
minRequired: minFree,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// -- Health Check Handler ------------------------------------------
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Create a health check route handler.
|
|
139
|
+
*
|
|
140
|
+
* Returns a JSON response with the status of all registered checks.
|
|
141
|
+
* Returns `200` when all checks pass, `503` when any check fails
|
|
142
|
+
* or when the application is in drain/shutdown state.
|
|
143
|
+
*
|
|
144
|
+
* Response format:
|
|
145
|
+
* ```json
|
|
146
|
+
* {
|
|
147
|
+
* "status": "healthy",
|
|
148
|
+
* "uptime": 12345,
|
|
149
|
+
* "timestamp": "2026-01-01T00:00:00.000Z",
|
|
150
|
+
* "checks": {
|
|
151
|
+
* "database": { "healthy": true, "duration": 5, "details": {} }
|
|
152
|
+
* }
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @param {object} [opts] - Options.
|
|
157
|
+
* @param {Object<string, Function>} [opts.checks] - Named check functions. Each returns `{ healthy, details }` or a boolean/Promise.
|
|
158
|
+
* @param {number} [opts.timeout=5000] - Max time to wait for all checks in ms.
|
|
159
|
+
* @param {boolean} [opts.verbose=true] - Include check details in response.
|
|
160
|
+
* @param {Function} [opts.onFailure] - `(results) => void` — called when any check fails.
|
|
161
|
+
* @returns {Function} Route handler `(req, res) => void`.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* app.get('/healthz', healthCheck());
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* app.get('/readyz', healthCheck({
|
|
168
|
+
* checks: {
|
|
169
|
+
* database: async () => {
|
|
170
|
+
* await db.ping();
|
|
171
|
+
* return { healthy: true };
|
|
172
|
+
* },
|
|
173
|
+
* cache: () => ({ healthy: cacheClient.isConnected }),
|
|
174
|
+
* },
|
|
175
|
+
* }));
|
|
176
|
+
*
|
|
177
|
+
* @example | Auto-deregister from Load Balancer
|
|
178
|
+
* app.get('/readyz', healthCheck({
|
|
179
|
+
* checks: {
|
|
180
|
+
* lifecycle: () => ({ healthy: app.lifecycleState === 'running' }),
|
|
181
|
+
* },
|
|
182
|
+
* }));
|
|
183
|
+
*/
|
|
184
|
+
function healthCheck(opts = {})
|
|
185
|
+
{
|
|
186
|
+
const checks = opts.checks || {};
|
|
187
|
+
const timeout = opts.timeout || 5000;
|
|
188
|
+
const verbose = opts.verbose !== false;
|
|
189
|
+
const onFailure = typeof opts.onFailure === 'function' ? opts.onFailure : null;
|
|
190
|
+
|
|
191
|
+
return async (req, res) =>
|
|
192
|
+
{
|
|
193
|
+
const start = Date.now();
|
|
194
|
+
|
|
195
|
+
// Check lifecycle state (auto-deregister during shutdown)
|
|
196
|
+
const app = req.app;
|
|
197
|
+
if (app && app.lifecycleState && app.lifecycleState !== 'running')
|
|
198
|
+
{
|
|
199
|
+
res.status(503).json({
|
|
200
|
+
status: 'unavailable',
|
|
201
|
+
reason: 'shutdown',
|
|
202
|
+
lifecycleState: app.lifecycleState,
|
|
203
|
+
timestamp: new Date().toISOString(),
|
|
204
|
+
});
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const checkNames = Object.keys(checks);
|
|
209
|
+
const results = {};
|
|
210
|
+
let allHealthy = true;
|
|
211
|
+
|
|
212
|
+
if (checkNames.length > 0)
|
|
213
|
+
{
|
|
214
|
+
// Run all checks concurrently with timeout
|
|
215
|
+
const promises = checkNames.map(async (name) =>
|
|
216
|
+
{
|
|
217
|
+
const checkStart = Date.now();
|
|
218
|
+
try
|
|
219
|
+
{
|
|
220
|
+
const result = await Promise.race([
|
|
221
|
+
Promise.resolve(checks[name]()),
|
|
222
|
+
new Promise((_, reject) =>
|
|
223
|
+
setTimeout(() => reject(new Error('Check timed out')), timeout)
|
|
224
|
+
),
|
|
225
|
+
]);
|
|
226
|
+
|
|
227
|
+
const duration = Date.now() - checkStart;
|
|
228
|
+
|
|
229
|
+
if (typeof result === 'boolean')
|
|
230
|
+
{
|
|
231
|
+
results[name] = { healthy: result, duration };
|
|
232
|
+
}
|
|
233
|
+
else if (result && typeof result === 'object')
|
|
234
|
+
{
|
|
235
|
+
results[name] = { healthy: !!result.healthy, duration };
|
|
236
|
+
if (verbose && result.details) results[name].details = result.details;
|
|
237
|
+
}
|
|
238
|
+
else
|
|
239
|
+
{
|
|
240
|
+
results[name] = { healthy: true, duration };
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (err)
|
|
244
|
+
{
|
|
245
|
+
results[name] = {
|
|
246
|
+
healthy: false,
|
|
247
|
+
duration: Date.now() - checkStart,
|
|
248
|
+
error: err.message,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (!results[name].healthy) allHealthy = false;
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
await Promise.all(promises);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const body = {
|
|
259
|
+
status: allHealthy ? 'healthy' : 'unhealthy',
|
|
260
|
+
uptime: process.uptime(),
|
|
261
|
+
timestamp: new Date().toISOString(),
|
|
262
|
+
duration: Date.now() - start,
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
if (checkNames.length > 0) body.checks = results;
|
|
266
|
+
|
|
267
|
+
if (!allHealthy && onFailure)
|
|
268
|
+
{
|
|
269
|
+
try { onFailure(results); }
|
|
270
|
+
catch (_) { /* ignore callback errors */ }
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
res.status(allHealthy ? 200 : 503).json(body);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// -- Convenience Health & Ready Factory ----------------------------
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Create paired liveness and readiness handlers for an app.
|
|
281
|
+
* Liveness includes basic process checks; readiness includes
|
|
282
|
+
* all registered dependency checks.
|
|
283
|
+
*
|
|
284
|
+
* @param {object} [opts] - Options.
|
|
285
|
+
* @param {Object<string, Function>} [opts.checks] - Named readiness checks.
|
|
286
|
+
* @param {boolean} [opts.includeMemory=false] - Include memory check in liveness.
|
|
287
|
+
* @param {boolean} [opts.includeEventLoop=false] - Include event loop lag check.
|
|
288
|
+
* @param {number} [opts.timeout=5000] - Check timeout.
|
|
289
|
+
* @returns {{ health: Function, ready: Function }} Route handlers.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* const { health, ready } = createHealthHandlers({
|
|
293
|
+
* checks: { database: () => db.ping() },
|
|
294
|
+
* includeMemory: true,
|
|
295
|
+
* });
|
|
296
|
+
* app.get('/healthz', health);
|
|
297
|
+
* app.get('/readyz', ready);
|
|
298
|
+
*/
|
|
299
|
+
function createHealthHandlers(opts = {})
|
|
300
|
+
{
|
|
301
|
+
const livenessChecks = {};
|
|
302
|
+
if (opts.includeMemory) livenessChecks.memory = memoryCheck(opts.memoryOpts);
|
|
303
|
+
if (opts.includeEventLoop) livenessChecks.eventLoop = eventLoopCheck(opts.eventLoopOpts);
|
|
304
|
+
|
|
305
|
+
const readinessChecks = { ...livenessChecks };
|
|
306
|
+
if (opts.checks)
|
|
307
|
+
{
|
|
308
|
+
for (const [name, fn] of Object.entries(opts.checks))
|
|
309
|
+
{
|
|
310
|
+
readinessChecks[name] = fn;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return {
|
|
315
|
+
health: healthCheck({ checks: livenessChecks, timeout: opts.timeout }),
|
|
316
|
+
ready: healthCheck({ checks: readinessChecks, timeout: opts.timeout, onFailure: opts.onFailure }),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
module.exports = {
|
|
321
|
+
healthCheck,
|
|
322
|
+
createHealthHandlers,
|
|
323
|
+
memoryCheck,
|
|
324
|
+
eventLoopCheck,
|
|
325
|
+
diskSpaceCheck,
|
|
326
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module observe
|
|
3
|
+
* @description Observability suite — structured logging, metrics, tracing,
|
|
4
|
+
* and health checks. Zero external dependencies.
|
|
5
|
+
*/
|
|
6
|
+
const { Logger, structuredLogger, LEVELS, LEVEL_NAMES } = require('./logger');
|
|
7
|
+
const {
|
|
8
|
+
Counter, Gauge, Histogram,
|
|
9
|
+
MetricsRegistry, DEFAULT_BUCKETS,
|
|
10
|
+
createDefaultMetrics, metricsMiddleware, metricsEndpoint,
|
|
11
|
+
} = require('./metrics');
|
|
12
|
+
const {
|
|
13
|
+
Span, Tracer,
|
|
14
|
+
parseTraceparent, formatTraceparent,
|
|
15
|
+
tracingMiddleware, instrumentFetch,
|
|
16
|
+
} = require('./tracing');
|
|
17
|
+
const {
|
|
18
|
+
healthCheck, createHealthHandlers,
|
|
19
|
+
memoryCheck, eventLoopCheck, diskSpaceCheck,
|
|
20
|
+
} = require('./health');
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
// Structured Logging
|
|
24
|
+
Logger,
|
|
25
|
+
structuredLogger,
|
|
26
|
+
LEVELS,
|
|
27
|
+
LEVEL_NAMES,
|
|
28
|
+
// Metrics
|
|
29
|
+
Counter,
|
|
30
|
+
Gauge,
|
|
31
|
+
Histogram,
|
|
32
|
+
MetricsRegistry,
|
|
33
|
+
DEFAULT_BUCKETS,
|
|
34
|
+
createDefaultMetrics,
|
|
35
|
+
metricsMiddleware,
|
|
36
|
+
metricsEndpoint,
|
|
37
|
+
// Tracing
|
|
38
|
+
Span,
|
|
39
|
+
Tracer,
|
|
40
|
+
parseTraceparent,
|
|
41
|
+
formatTraceparent,
|
|
42
|
+
tracingMiddleware,
|
|
43
|
+
instrumentFetch,
|
|
44
|
+
// Health Checks
|
|
45
|
+
healthCheck,
|
|
46
|
+
createHealthHandlers,
|
|
47
|
+
memoryCheck,
|
|
48
|
+
eventLoopCheck,
|
|
49
|
+
diskSpaceCheck,
|
|
50
|
+
};
|