mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-05-30 17:01:07 +00:00
feat: Live-update IO stats (#225)
This commit is contained in:
@@ -187,7 +187,8 @@ export type Message =
|
|||||||
| Variants.AfgReceivedPrecommit
|
| Variants.AfgReceivedPrecommit
|
||||||
| Variants.AfgAuthoritySet
|
| Variants.AfgAuthoritySet
|
||||||
| Variants.StaleNodeMessage
|
| Variants.StaleNodeMessage
|
||||||
| Variants.PongMessage;
|
| Variants.PongMessage
|
||||||
|
| Variants.NodeIOMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data type to be sent to the feed. Passing through strings means we can only serialize once,
|
* Data type to be sent to the feed. Passing through strings means we can only serialize once,
|
||||||
|
|||||||
@@ -237,7 +237,25 @@ export class Connection {
|
|||||||
nodes.mutAndMaybeSort(
|
nodes.mutAndMaybeSort(
|
||||||
id,
|
id,
|
||||||
(node) => node.updateHardware(nodeHardware),
|
(node) => node.updateHardware(nodeHardware),
|
||||||
sortByColumn === Column.CPU || sortByColumn === Column.MEM || sortByColumn === Column.UPLOAD || sortByColumn === Column.DOWNLOAD,
|
sortByColumn === Column.CPU
|
||||||
|
|| sortByColumn === Column.MEM
|
||||||
|
|| sortByColumn === Column.UPLOAD
|
||||||
|
|| sortByColumn === Column.DOWNLOAD,
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Actions.NodeIO: {
|
||||||
|
const [id, nodeIO] = message.payload;
|
||||||
|
|
||||||
|
nodes.mutAndMaybeSort(
|
||||||
|
id,
|
||||||
|
(node) => node.updateIO(nodeIO),
|
||||||
|
sortByColumn === Column.STATE_CACHE
|
||||||
|
|| sortByColumn === Column.DB_CACHE
|
||||||
|
|| sortByColumn === Column.DISK_READ
|
||||||
|
|| sortByColumn === Column.DISK_WRITE,
|
||||||
);
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -405,7 +405,9 @@ function formatMemory(kbs: number, stamp: Maybe<Types.Timestamp>): string {
|
|||||||
function formatBytes(bytes: number, stamp: Maybe<Types.Timestamp>): string {
|
function formatBytes(bytes: number, stamp: Maybe<Types.Timestamp>): string {
|
||||||
const ago = stamp ? ` (${formatStamp(stamp)})` : '';
|
const ago = stamp ? ` (${formatStamp(stamp)})` : '';
|
||||||
|
|
||||||
if (bytes >= 1024 * 1024) {
|
if (bytes >= 1024 * 1024 * 1024) {
|
||||||
|
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB${ago}`;
|
||||||
|
} else if (bytes >= 1024 * 1024) {
|
||||||
return `${(bytes / (1024 * 1024)).toFixed(1)} MB${ago}`;
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB${ago}`;
|
||||||
} else if (bytes >= 1000) {
|
} else if (bytes >= 1000) {
|
||||||
return `${(bytes / 1024).toFixed(1)} kB${ago}`;
|
return `${(bytes / 1024).toFixed(1)} kB${ago}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user