@techalmondsai/nodejs-monitoring 1.0.0
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/README.md +494 -0
- package/dist/MonitoringService.d.ts +40 -0
- package/dist/MonitoringService.d.ts.map +1 -0
- package/dist/MonitoringService.js +326 -0
- package/dist/MonitoringService.js.map +1 -0
- package/dist/collectors/RequestTracker.d.ts +31 -0
- package/dist/collectors/RequestTracker.d.ts.map +1 -0
- package/dist/collectors/RequestTracker.js +99 -0
- package/dist/collectors/RequestTracker.js.map +1 -0
- package/dist/collectors/SystemMetrics.d.ts +37 -0
- package/dist/collectors/SystemMetrics.d.ts.map +1 -0
- package/dist/collectors/SystemMetrics.js +124 -0
- package/dist/collectors/SystemMetrics.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/probes/BuiltInProbes.d.ts +11 -0
- package/dist/probes/BuiltInProbes.d.ts.map +1 -0
- package/dist/probes/BuiltInProbes.js +256 -0
- package/dist/probes/BuiltInProbes.js.map +1 -0
- package/dist/types/index.d.ts +68 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/ContainerDetector.d.ts +31 -0
- package/dist/utils/ContainerDetector.d.ts.map +1 -0
- package/dist/utils/ContainerDetector.js +237 -0
- package/dist/utils/ContainerDetector.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ContainerDetector = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
class ContainerDetector {
|
|
40
|
+
static isContainer() {
|
|
41
|
+
if (this._isContainer === true)
|
|
42
|
+
return true;
|
|
43
|
+
if (this._isContainer === false &&
|
|
44
|
+
Date.now() - this._detectedAt < this.REDETECT_INTERVAL_MS) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
this._isContainer = false;
|
|
48
|
+
this._cgroupVersion = null;
|
|
49
|
+
this._detectedAt = Date.now();
|
|
50
|
+
if (this.fileExists("/.dockerenv")) {
|
|
51
|
+
this._isContainer = true;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (this.fileExists("/var/run/secrets/kubernetes.io/serviceaccount/token")) {
|
|
55
|
+
this._isContainer = true;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const cgroup = fs.readFileSync("/proc/1/cgroup", "utf8");
|
|
60
|
+
if (cgroup.includes("docker") ||
|
|
61
|
+
cgroup.includes("kubepods") ||
|
|
62
|
+
cgroup.includes("containerd")) {
|
|
63
|
+
this._isContainer = true;
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
}
|
|
69
|
+
if (this.fileExists("/sys/fs/cgroup/cgroup.controllers")) {
|
|
70
|
+
try {
|
|
71
|
+
const memMax = fs
|
|
72
|
+
.readFileSync("/sys/fs/cgroup/memory.max", "utf8")
|
|
73
|
+
.trim();
|
|
74
|
+
if (memMax !== "max") {
|
|
75
|
+
this._isContainer = true;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return this._isContainer;
|
|
83
|
+
}
|
|
84
|
+
static getCgroupVersion() {
|
|
85
|
+
if (this._cgroupVersion !== null)
|
|
86
|
+
return this._cgroupVersion;
|
|
87
|
+
if (this.fileExists("/sys/fs/cgroup/cgroup.controllers")) {
|
|
88
|
+
this._cgroupVersion = 2;
|
|
89
|
+
}
|
|
90
|
+
else if (this.fileExists("/sys/fs/cgroup/memory/memory.limit_in_bytes")) {
|
|
91
|
+
this._cgroupVersion = 1;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this._cgroupVersion = null;
|
|
95
|
+
}
|
|
96
|
+
return this._cgroupVersion;
|
|
97
|
+
}
|
|
98
|
+
static getContainerMemory() {
|
|
99
|
+
if (!this.isContainer())
|
|
100
|
+
return null;
|
|
101
|
+
const version = this.getCgroupVersion();
|
|
102
|
+
try {
|
|
103
|
+
if (version === 2) {
|
|
104
|
+
const total = this.getCachedMemoryLimit();
|
|
105
|
+
if (total === null)
|
|
106
|
+
return null;
|
|
107
|
+
const current = this.readCgroupFile("/sys/fs/cgroup/memory.current");
|
|
108
|
+
if (current === null)
|
|
109
|
+
return null;
|
|
110
|
+
return { used: parseInt(current, 10), total };
|
|
111
|
+
}
|
|
112
|
+
if (version === 1) {
|
|
113
|
+
const total = this.getCachedMemoryLimit();
|
|
114
|
+
if (total === null)
|
|
115
|
+
return null;
|
|
116
|
+
const usage = this.readCgroupFile("/sys/fs/cgroup/memory/memory.usage_in_bytes");
|
|
117
|
+
if (usage === null)
|
|
118
|
+
return null;
|
|
119
|
+
return { used: parseInt(usage, 10), total };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
static getCachedMemoryLimit() {
|
|
127
|
+
const now = Date.now();
|
|
128
|
+
if (this._cachedMemoryLimit &&
|
|
129
|
+
now - this._cachedMemoryLimit.cachedAt < this.MEM_LIMIT_CACHE_TTL_MS) {
|
|
130
|
+
return this._cachedMemoryLimit.value;
|
|
131
|
+
}
|
|
132
|
+
const version = this.getCgroupVersion();
|
|
133
|
+
let limit = null;
|
|
134
|
+
if (version === 2) {
|
|
135
|
+
const raw = this.readCgroupFile("/sys/fs/cgroup/memory.max");
|
|
136
|
+
if (raw === null)
|
|
137
|
+
return null;
|
|
138
|
+
limit = raw === "max" ? os.totalmem() : parseInt(raw, 10);
|
|
139
|
+
}
|
|
140
|
+
else if (version === 1) {
|
|
141
|
+
const raw = this.readCgroupFile("/sys/fs/cgroup/memory/memory.limit_in_bytes");
|
|
142
|
+
if (raw === null)
|
|
143
|
+
return null;
|
|
144
|
+
const parsed = parseInt(raw, 10);
|
|
145
|
+
limit = parsed > os.totalmem() ? os.totalmem() : parsed;
|
|
146
|
+
}
|
|
147
|
+
this._cachedMemoryLimit = { value: limit, cachedAt: now };
|
|
148
|
+
return limit;
|
|
149
|
+
}
|
|
150
|
+
static getContainerCpuInfo() {
|
|
151
|
+
if (!this.isContainer())
|
|
152
|
+
return null;
|
|
153
|
+
if (this._cachedCpuInfo) {
|
|
154
|
+
return this._cachedCpuInfo.value;
|
|
155
|
+
}
|
|
156
|
+
const version = this.getCgroupVersion();
|
|
157
|
+
let result = null;
|
|
158
|
+
try {
|
|
159
|
+
if (version === 2) {
|
|
160
|
+
const cpuMax = this.readCgroupFile("/sys/fs/cgroup/cpu.max");
|
|
161
|
+
if (!cpuMax)
|
|
162
|
+
return null;
|
|
163
|
+
const parts = cpuMax.split(" ");
|
|
164
|
+
const quotaUs = parts[0] === "max" ? -1 : parseInt(parts[0], 10);
|
|
165
|
+
const periodUs = parseInt(parts[1], 10);
|
|
166
|
+
const cpuCount = os.cpus().length;
|
|
167
|
+
result = { quotaUs, periodUs, cpuCount };
|
|
168
|
+
}
|
|
169
|
+
if (version === 1) {
|
|
170
|
+
const quota = this.readCgroupFile("/sys/fs/cgroup/cpu/cpu.cfs_quota_us");
|
|
171
|
+
const period = this.readCgroupFile("/sys/fs/cgroup/cpu/cpu.cfs_period_us");
|
|
172
|
+
if (!quota || !period)
|
|
173
|
+
return null;
|
|
174
|
+
result = {
|
|
175
|
+
quotaUs: parseInt(quota, 10),
|
|
176
|
+
periodUs: parseInt(period, 10),
|
|
177
|
+
cpuCount: os.cpus().length,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
}
|
|
183
|
+
this._cachedCpuInfo = { value: result, cachedAt: Date.now() };
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
static getEffectiveCpuCount() {
|
|
187
|
+
if (this._cachedEffectiveCpus) {
|
|
188
|
+
return this._cachedEffectiveCpus.value;
|
|
189
|
+
}
|
|
190
|
+
const cpuInfo = this.getContainerCpuInfo();
|
|
191
|
+
let result;
|
|
192
|
+
if (cpuInfo && cpuInfo.quotaUs > 0) {
|
|
193
|
+
result = cpuInfo.quotaUs / cpuInfo.periodUs;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
result = os.cpus().length;
|
|
197
|
+
}
|
|
198
|
+
this._cachedEffectiveCpus = { value: result, cachedAt: Date.now() };
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
static fileExists(path) {
|
|
202
|
+
try {
|
|
203
|
+
fs.accessSync(path, fs.constants.R_OK);
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
static readCgroupFile(path) {
|
|
211
|
+
try {
|
|
212
|
+
return fs.readFileSync(path, "utf8").trim();
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
static reset() {
|
|
219
|
+
this._isContainer = null;
|
|
220
|
+
this._cgroupVersion = null;
|
|
221
|
+
this._detectedAt = 0;
|
|
222
|
+
this._cachedCpuInfo = null;
|
|
223
|
+
this._cachedMemoryLimit = null;
|
|
224
|
+
this._cachedEffectiveCpus = null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.ContainerDetector = ContainerDetector;
|
|
228
|
+
ContainerDetector._isContainer = null;
|
|
229
|
+
ContainerDetector._cgroupVersion = null;
|
|
230
|
+
ContainerDetector._detectedAt = 0;
|
|
231
|
+
ContainerDetector.REDETECT_INTERVAL_MS = 60000;
|
|
232
|
+
ContainerDetector._cachedCpuInfo = null;
|
|
233
|
+
ContainerDetector._cachedMemoryLimit = null;
|
|
234
|
+
ContainerDetector._cachedEffectiveCpus = null;
|
|
235
|
+
ContainerDetector.CPU_CACHE_TTL_MS = Infinity;
|
|
236
|
+
ContainerDetector.MEM_LIMIT_CACHE_TTL_MS = 60000;
|
|
237
|
+
//# sourceMappingURL=ContainerDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerDetector.js","sourceRoot":"","sources":["../../src/utils/ContainerDetector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,uCAAyB;AAkBzB,MAAa,iBAAiB;IAkB5B,MAAM,CAAC,WAAW;QAEhB,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAG5C,IACE,IAAI,CAAC,YAAY,KAAK,KAAK;YAC3B,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,oBAAoB,EACzD,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAG9B,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QAGD,IACE,IAAI,CAAC,UAAU,CAAC,qDAAqD,CAAC,EACtE,CAAC;YACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QAGD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;YACzD,IACE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACzB,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAC3B,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAC7B,CAAC;gBACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;gBACzB,OAAO,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AAW,CAAC,CAAC;AACf,sCAAoB,GAAG,KAAK,CAAC;AAGtC,gCAAc,GAC3B,IAAI,CAAC;AACQ,oCAAkB,GAAsC,IAAI,CAAC;AAC7D,sCAAoB,GAA+B,IAAI,CAAC;AAG/C,kCAAgB,GAAG,QAAQ,CAAC;AAE5B,wCAAsB,GAAG,KAAK,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@techalmondsai/nodejs-monitoring",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A comprehensive monitoring service for Node.js applications with built-in health probes and metrics collection",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"dev": "tsc --watch",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"test:watch": "jest --watch",
|
|
12
|
+
"lint": "eslint src/**/*.ts",
|
|
13
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"monitoring",
|
|
18
|
+
"health-check",
|
|
19
|
+
"metrics",
|
|
20
|
+
"nodejs",
|
|
21
|
+
"express",
|
|
22
|
+
"apm",
|
|
23
|
+
"observability"
|
|
24
|
+
],
|
|
25
|
+
"author": "Almonds AI",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"express": "^4.18.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/express": "^4.17.23",
|
|
32
|
+
"@types/jest": "^29.5.0",
|
|
33
|
+
"@types/node": "^20.0.0",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
35
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
36
|
+
"eslint": "^8.0.0",
|
|
37
|
+
"jest": "^29.5.0",
|
|
38
|
+
"ts-jest": "^29.1.0",
|
|
39
|
+
"typescript": "^5.0.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"express": "^4.18.0"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist/**/*",
|
|
46
|
+
"README.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/techalmondsai/nodejs-monitoring.git"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/techalmondsai/nodejs-monitoring/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/techalmondsai/nodejs-monitoring#readme"
|
|
57
|
+
}
|