mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-05-09 12:48:05 +00:00
Show CPU and memory use, disable last block time for now (#40)
This commit is contained in:
@@ -37,6 +37,8 @@ export default class Node {
|
||||
|
||||
private peers = 0 as Types.PeerCount;
|
||||
private txcount = 0 as Types.TransactionCount;
|
||||
private memory = null as Maybe<Types.MemoryUse>;
|
||||
private cpu = null as Maybe<Types.CPUUse>;
|
||||
|
||||
private readonly ip: string;
|
||||
private readonly socket: WebSocket;
|
||||
@@ -173,7 +175,7 @@ export default class Node {
|
||||
}
|
||||
|
||||
public nodeStats(): Types.NodeStats {
|
||||
return [this.peers, this.txcount];
|
||||
return [this.peers, this.txcount, this.memory, this.cpu];
|
||||
}
|
||||
|
||||
public blockDetails(): Types.BlockDetails {
|
||||
@@ -223,11 +225,13 @@ export default class Node {
|
||||
}
|
||||
|
||||
private onSystemInterval(message: SystemInterval) {
|
||||
const { peers, txcount } = message;
|
||||
const { peers, txcount, cpu, memory } = message;
|
||||
|
||||
if (this.peers !== peers || this.txcount !== txcount) {
|
||||
if (this.peers !== peers || this.txcount !== txcount || this.cpu !== cpu || this.memory !== memory) {
|
||||
this.peers = peers;
|
||||
this.txcount = txcount;
|
||||
this.cpu = cpu;
|
||||
this.memory = memory;
|
||||
|
||||
this.events.emit('stats');
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ export interface SystemInterval extends BestBlock {
|
||||
msg: 'system.interval';
|
||||
txcount: Types.TransactionCount;
|
||||
peers: Types.PeerCount;
|
||||
memory: Maybe<Types.MemoryUse>;
|
||||
cpu: Maybe<Types.CPUUse>;
|
||||
status: 'Idle' | string; // TODO: 'Idle' | ...?
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user