viberadar 0.3.216 → 0.3.218
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/server/index.d.ts.map +1 -1
- package/dist/server/index.js +42 -12
- package/dist/server/index.js.map +1 -1
- package/dist/ui/dashboard.html +195 -38
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,UAAU,EAA4H,MAAM,YAAY,CAAC;AAOlK,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AA0vED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,UAAU,EAA4H,MAAM,YAAY,CAAC;AAOlK,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AA0vED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CA83G1G"}
|
package/dist/server/index.js
CHANGED
|
@@ -5385,30 +5385,58 @@ a{color:var(--blue)}
|
|
|
5385
5385
|
}
|
|
5386
5386
|
});
|
|
5387
5387
|
let jsonPos = 0;
|
|
5388
|
-
|
|
5388
|
+
let jsonRemainder = '';
|
|
5389
|
+
const flushLoadMetrics = (force = false) => {
|
|
5389
5390
|
if (!loadRunning) {
|
|
5390
5391
|
clearInterval(watchInterval);
|
|
5391
5392
|
return;
|
|
5392
5393
|
}
|
|
5393
5394
|
try {
|
|
5394
|
-
if (!fs.existsSync(jsonOutPath))
|
|
5395
|
+
if (!fs.existsSync(jsonOutPath)) {
|
|
5396
|
+
if (force) {
|
|
5397
|
+
broadcast('load-progress', { runId: loadState.runId, buckets: loadState.buckets.slice(-60), total: loadState.totalRequests, errors: loadState.totalErrors });
|
|
5398
|
+
}
|
|
5395
5399
|
return;
|
|
5400
|
+
}
|
|
5396
5401
|
const stat = fs.statSync(jsonOutPath);
|
|
5397
|
-
|
|
5402
|
+
let text = '';
|
|
5403
|
+
if (stat.size > jsonPos) {
|
|
5404
|
+
const buf = Buffer.alloc(stat.size - jsonPos);
|
|
5405
|
+
const fd = fs.openSync(jsonOutPath, 'r');
|
|
5406
|
+
fs.readSync(fd, buf, 0, buf.length, jsonPos);
|
|
5407
|
+
fs.closeSync(fd);
|
|
5408
|
+
jsonPos = stat.size;
|
|
5409
|
+
text = jsonRemainder + buf.toString();
|
|
5410
|
+
}
|
|
5411
|
+
else if (force && jsonRemainder) {
|
|
5412
|
+
text = jsonRemainder;
|
|
5413
|
+
}
|
|
5414
|
+
else {
|
|
5415
|
+
if (force) {
|
|
5416
|
+
broadcast('load-progress', { runId: loadState.runId, buckets: loadState.buckets.slice(-60), total: loadState.totalRequests, errors: loadState.totalErrors });
|
|
5417
|
+
}
|
|
5398
5418
|
return;
|
|
5399
|
-
|
|
5400
|
-
const
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5419
|
+
}
|
|
5420
|
+
const lines = text.split(/\r?\n/);
|
|
5421
|
+
jsonRemainder = force ? '' : (lines.pop() || '');
|
|
5422
|
+
if (!force && jsonRemainder.trim()) {
|
|
5423
|
+
try {
|
|
5424
|
+
JSON.parse(jsonRemainder);
|
|
5425
|
+
lines.push(jsonRemainder);
|
|
5426
|
+
jsonRemainder = '';
|
|
5427
|
+
}
|
|
5428
|
+
catch { }
|
|
5429
|
+
}
|
|
5404
5430
|
let changed = false;
|
|
5405
|
-
for (const ln of
|
|
5431
|
+
for (const ln of lines) {
|
|
5406
5432
|
if (!ln.trim())
|
|
5407
5433
|
continue;
|
|
5408
5434
|
try {
|
|
5409
5435
|
const obj = JSON.parse(ln);
|
|
5410
5436
|
if (obj.type !== 'Point')
|
|
5411
5437
|
continue;
|
|
5438
|
+
if (!obj.data || !obj.data.time || typeof obj.data.value !== 'number')
|
|
5439
|
+
continue;
|
|
5412
5440
|
const bucketTs = Math.floor((new Date(obj.data.time).getTime() - loadState.startTime) / 2000) * 2000;
|
|
5413
5441
|
let bkt = loadState.buckets.find(b => b.ts === bucketTs);
|
|
5414
5442
|
if (!bkt) {
|
|
@@ -5437,14 +5465,16 @@ a{color:var(--blue)}
|
|
|
5437
5465
|
}
|
|
5438
5466
|
catch { }
|
|
5439
5467
|
}
|
|
5440
|
-
if (changed) {
|
|
5441
|
-
const slice = loadState.buckets.slice(-
|
|
5468
|
+
if (changed || force) {
|
|
5469
|
+
const slice = loadState.buckets.slice(-60);
|
|
5442
5470
|
broadcast('load-progress', { runId: loadState.runId, buckets: slice, total: loadState.totalRequests, errors: loadState.totalErrors });
|
|
5443
5471
|
}
|
|
5444
5472
|
}
|
|
5445
5473
|
catch { }
|
|
5446
|
-
}
|
|
5474
|
+
};
|
|
5475
|
+
const watchInterval = setInterval(() => flushLoadMetrics(false), 1000);
|
|
5447
5476
|
loadProc.on('close', (code) => {
|
|
5477
|
+
flushLoadMetrics(true);
|
|
5448
5478
|
clearInterval(watchInterval);
|
|
5449
5479
|
loadRunning = false;
|
|
5450
5480
|
loadProc = null;
|