@saplings/quality-node-diagnostics 0.17.2 → 0.17.3
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 +8 -0
- package/README.md +1 -1
- package/dist/index.d.ts +1 -13
- package/dist/index.js +1 -28
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @saplings/quality-node-diagnostics
|
|
2
2
|
|
|
3
|
+
## 0.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d8be144: Add a shared Node.js observability package for structured logs, OpenTelemetry traces and metrics, and process and request diagnostics. The SDK and quality diagnostics use the shared implementations through their existing exports.
|
|
8
|
+
- Updated dependencies [d8be144]
|
|
9
|
+
- @saplings/observability@0.1.0
|
|
10
|
+
|
|
3
11
|
## 0.17.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @saplings/quality-node-diagnostics
|
|
2
2
|
|
|
3
|
-
Collect process and event-loop metrics in a Node.js service.
|
|
3
|
+
Collect process and event-loop metrics in a Node.js service. The implementation is shared with [@saplings/observability](https://www.npmjs.com/package/@saplings/observability), which also provides correlated JSON logs and OpenTelemetry helpers.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function createNodeDiagnostics(): {
|
|
3
|
-
snapshot(): {
|
|
4
|
-
eventLoopLagP95Ms: number;
|
|
5
|
-
eventLoopLagMaxMs: number;
|
|
6
|
-
heapUsedMb: number;
|
|
7
|
-
rssMb: number;
|
|
8
|
-
externalMb: number;
|
|
9
|
-
cpuPercent: number;
|
|
10
|
-
uptimeSeconds: number;
|
|
11
|
-
};
|
|
12
|
-
close(): void;
|
|
13
|
-
};
|
|
1
|
+
export { createNodeDiagnostics } from '@saplings/observability';
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { memoryUsage, cpuUsage } from 'node:process';
|
|
3
|
-
/** Optional Node.js in-process diagnostics for applications that elect to expose /quality-metrics. */
|
|
4
|
-
export function createNodeDiagnostics() {
|
|
5
|
-
const histogram = monitorEventLoopDelay({ resolution: 20 });
|
|
6
|
-
histogram.enable();
|
|
7
|
-
let previousCPU = cpuUsage(), previousTime = performance.now();
|
|
8
|
-
return {
|
|
9
|
-
snapshot() {
|
|
10
|
-
const now = performance.now(), cpu = cpuUsage(previousCPU), delta = now - previousTime;
|
|
11
|
-
previousTime = now;
|
|
12
|
-
previousCPU = cpuUsage();
|
|
13
|
-
const mem = memoryUsage();
|
|
14
|
-
return {
|
|
15
|
-
eventLoopLagP95Ms: histogram.percentile(95) / 1e6,
|
|
16
|
-
eventLoopLagMaxMs: histogram.max / 1e6,
|
|
17
|
-
heapUsedMb: mem.heapUsed / 1048576,
|
|
18
|
-
rssMb: mem.rss / 1048576,
|
|
19
|
-
externalMb: mem.external / 1048576,
|
|
20
|
-
cpuPercent: delta > 0 ? ((cpu.user + cpu.system) / 1000 / delta) * 100 : 0,
|
|
21
|
-
uptimeSeconds: process.uptime(),
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
close() {
|
|
25
|
-
histogram.disable();
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
}
|
|
1
|
+
export { createNodeDiagnostics } from '@saplings/observability';
|
|
29
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saplings/quality-node-diagnostics",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"README.md",
|
|
16
16
|
"CHANGELOG.md"
|
|
17
17
|
],
|
|
18
|
-
"dependencies": {
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@saplings/observability": "0.1.0"
|
|
20
|
+
},
|
|
19
21
|
"license": "MIT",
|
|
20
22
|
"repository": {
|
|
21
23
|
"type": "git",
|