@ceon-oy/monitor-sdk 1.2.0 → 1.2.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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -1
- package/dist/index.mjs +13 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -225,6 +225,7 @@ declare class MonitorClient {
|
|
|
225
225
|
private healthCheckFetchTimer;
|
|
226
226
|
private healthCheckTimers;
|
|
227
227
|
private healthCheckResultsQueue;
|
|
228
|
+
private healthCheckFlushTimer;
|
|
228
229
|
constructor(config: MonitorClientConfig);
|
|
229
230
|
/**
|
|
230
231
|
* Security: Validate and sanitize metadata to prevent oversized payloads
|
package/dist/index.d.ts
CHANGED
|
@@ -225,6 +225,7 @@ declare class MonitorClient {
|
|
|
225
225
|
private healthCheckFetchTimer;
|
|
226
226
|
private healthCheckTimers;
|
|
227
227
|
private healthCheckResultsQueue;
|
|
228
|
+
private healthCheckFlushTimer;
|
|
228
229
|
constructor(config: MonitorClientConfig);
|
|
229
230
|
/**
|
|
230
231
|
* Security: Validate and sanitize metadata to prevent oversized payloads
|
package/dist/index.js
CHANGED
|
@@ -73,8 +73,10 @@ var CONFIG_LIMITS = {
|
|
|
73
73
|
// 60 seconds (default)
|
|
74
74
|
HEALTH_CHECK_MIN_INTERVAL_MS: 1e4,
|
|
75
75
|
// 10 seconds (min endpoint interval)
|
|
76
|
-
HEALTH_CHECK_MAX_BATCH_SIZE: 50
|
|
76
|
+
HEALTH_CHECK_MAX_BATCH_SIZE: 50,
|
|
77
77
|
// Max results per batch
|
|
78
|
+
HEALTH_CHECK_FLUSH_INTERVAL_MS: 3e4
|
|
79
|
+
// Flush health results every 30 seconds
|
|
78
80
|
};
|
|
79
81
|
var MonitorClient = class {
|
|
80
82
|
constructor(config) {
|
|
@@ -91,6 +93,7 @@ var MonitorClient = class {
|
|
|
91
93
|
this.healthCheckFetchTimer = null;
|
|
92
94
|
this.healthCheckTimers = /* @__PURE__ */ new Map();
|
|
93
95
|
this.healthCheckResultsQueue = [];
|
|
96
|
+
this.healthCheckFlushTimer = null;
|
|
94
97
|
if (!config.apiKey || config.apiKey.trim().length === 0) {
|
|
95
98
|
throw new Error("[MonitorClient] API key is required");
|
|
96
99
|
}
|
|
@@ -1321,6 +1324,11 @@ var MonitorClient = class {
|
|
|
1321
1324
|
console.error("[MonitorClient] Failed to fetch and schedule health checks:", err);
|
|
1322
1325
|
});
|
|
1323
1326
|
}, this.healthCheckFetchIntervalMs);
|
|
1327
|
+
this.healthCheckFlushTimer = setInterval(() => {
|
|
1328
|
+
this.flushHealthResults().catch((err) => {
|
|
1329
|
+
console.error("[MonitorClient] Failed to flush health results:", err);
|
|
1330
|
+
});
|
|
1331
|
+
}, CONFIG_LIMITS.HEALTH_CHECK_FLUSH_INTERVAL_MS);
|
|
1324
1332
|
}
|
|
1325
1333
|
/**
|
|
1326
1334
|
* Fetch health endpoints and schedule individual checks
|
|
@@ -1392,6 +1400,10 @@ var MonitorClient = class {
|
|
|
1392
1400
|
clearInterval(this.healthCheckFetchTimer);
|
|
1393
1401
|
this.healthCheckFetchTimer = null;
|
|
1394
1402
|
}
|
|
1403
|
+
if (this.healthCheckFlushTimer) {
|
|
1404
|
+
clearInterval(this.healthCheckFlushTimer);
|
|
1405
|
+
this.healthCheckFlushTimer = null;
|
|
1406
|
+
}
|
|
1395
1407
|
for (const [endpointId, timer] of this.healthCheckTimers.entries()) {
|
|
1396
1408
|
clearInterval(timer);
|
|
1397
1409
|
this.healthCheckTimers.delete(endpointId);
|
package/dist/index.mjs
CHANGED
|
@@ -37,8 +37,10 @@ var CONFIG_LIMITS = {
|
|
|
37
37
|
// 60 seconds (default)
|
|
38
38
|
HEALTH_CHECK_MIN_INTERVAL_MS: 1e4,
|
|
39
39
|
// 10 seconds (min endpoint interval)
|
|
40
|
-
HEALTH_CHECK_MAX_BATCH_SIZE: 50
|
|
40
|
+
HEALTH_CHECK_MAX_BATCH_SIZE: 50,
|
|
41
41
|
// Max results per batch
|
|
42
|
+
HEALTH_CHECK_FLUSH_INTERVAL_MS: 3e4
|
|
43
|
+
// Flush health results every 30 seconds
|
|
42
44
|
};
|
|
43
45
|
var MonitorClient = class {
|
|
44
46
|
constructor(config) {
|
|
@@ -55,6 +57,7 @@ var MonitorClient = class {
|
|
|
55
57
|
this.healthCheckFetchTimer = null;
|
|
56
58
|
this.healthCheckTimers = /* @__PURE__ */ new Map();
|
|
57
59
|
this.healthCheckResultsQueue = [];
|
|
60
|
+
this.healthCheckFlushTimer = null;
|
|
58
61
|
if (!config.apiKey || config.apiKey.trim().length === 0) {
|
|
59
62
|
throw new Error("[MonitorClient] API key is required");
|
|
60
63
|
}
|
|
@@ -1285,6 +1288,11 @@ var MonitorClient = class {
|
|
|
1285
1288
|
console.error("[MonitorClient] Failed to fetch and schedule health checks:", err);
|
|
1286
1289
|
});
|
|
1287
1290
|
}, this.healthCheckFetchIntervalMs);
|
|
1291
|
+
this.healthCheckFlushTimer = setInterval(() => {
|
|
1292
|
+
this.flushHealthResults().catch((err) => {
|
|
1293
|
+
console.error("[MonitorClient] Failed to flush health results:", err);
|
|
1294
|
+
});
|
|
1295
|
+
}, CONFIG_LIMITS.HEALTH_CHECK_FLUSH_INTERVAL_MS);
|
|
1288
1296
|
}
|
|
1289
1297
|
/**
|
|
1290
1298
|
* Fetch health endpoints and schedule individual checks
|
|
@@ -1356,6 +1364,10 @@ var MonitorClient = class {
|
|
|
1356
1364
|
clearInterval(this.healthCheckFetchTimer);
|
|
1357
1365
|
this.healthCheckFetchTimer = null;
|
|
1358
1366
|
}
|
|
1367
|
+
if (this.healthCheckFlushTimer) {
|
|
1368
|
+
clearInterval(this.healthCheckFlushTimer);
|
|
1369
|
+
this.healthCheckFlushTimer = null;
|
|
1370
|
+
}
|
|
1359
1371
|
for (const [endpointId, timer] of this.healthCheckTimers.entries()) {
|
|
1360
1372
|
clearInterval(timer);
|
|
1361
1373
|
this.healthCheckTimers.delete(endpointId);
|
package/package.json
CHANGED