mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-13 20:51:02 +00:00
Only update hardware stats when necessary (#73)
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
NodeCount,
|
||||
NodeDetails,
|
||||
NodeStats,
|
||||
NodeHardware,
|
||||
NodeLocation,
|
||||
BlockNumber,
|
||||
BlockDetails,
|
||||
@@ -26,12 +27,13 @@ export const Actions = {
|
||||
LocatedNode : 0x04 as 0x04,
|
||||
ImportedBlock : 0x05 as 0x05,
|
||||
NodeStats : 0x06 as 0x06,
|
||||
TimeSync : 0x07 as 0x07,
|
||||
AddedChain : 0x08 as 0x08,
|
||||
RemovedChain : 0x09 as 0x09,
|
||||
SubscribedTo : 0x0A as 0x0A,
|
||||
UnsubscribedFrom : 0x0B as 0x0B,
|
||||
Pong : 0x0C as 0x0C,
|
||||
NodeHardware : 0x07 as 0x07,
|
||||
TimeSync : 0x08 as 0x08,
|
||||
AddedChain : 0x09 as 0x09,
|
||||
RemovedChain : 0x0A as 0x0A,
|
||||
SubscribedTo : 0x0B as 0x0B,
|
||||
UnsubscribedFrom : 0x0C as 0x0C,
|
||||
Pong : 0x0D as 0x0D,
|
||||
};
|
||||
|
||||
export type Action = typeof Actions[keyof typeof Actions];
|
||||
@@ -54,7 +56,7 @@ export namespace Variants {
|
||||
|
||||
export interface AddedNodeMessage extends MessageBase {
|
||||
action: typeof Actions.AddedNode;
|
||||
payload: [NodeId, NodeDetails, NodeStats, BlockDetails, Maybe<NodeLocation>];
|
||||
payload: [NodeId, NodeDetails, NodeStats, NodeHardware, BlockDetails, Maybe<NodeLocation>];
|
||||
}
|
||||
|
||||
export interface RemovedNodeMessage extends MessageBase {
|
||||
@@ -77,6 +79,11 @@ export namespace Variants {
|
||||
payload: [NodeId, NodeStats];
|
||||
}
|
||||
|
||||
export interface NodeHardwareMessage extends MessageBase {
|
||||
action: typeof Actions.NodeHardware;
|
||||
payload: [NodeId, NodeHardware];
|
||||
}
|
||||
|
||||
export interface TimeSyncMessage extends MessageBase {
|
||||
action: typeof Actions.TimeSync;
|
||||
payload: Timestamp;
|
||||
@@ -116,6 +123,7 @@ export type Message =
|
||||
| Variants.LocatedNodeMessage
|
||||
| Variants.ImportedBlockMessage
|
||||
| Variants.NodeStatsMessage
|
||||
| Variants.NodeHardwareMessage
|
||||
| Variants.TimeSyncMessage
|
||||
| Variants.AddedChainMessage
|
||||
| Variants.RemovedChainMessage
|
||||
|
||||
@@ -8,4 +8,4 @@ import * as FeedMessage from './feed';
|
||||
export { Types, FeedMessage };
|
||||
|
||||
// Increment this if breaking changes were made to types in `feed.ts`
|
||||
export const VERSION: Types.FeedVersion = 18 as Types.FeedVersion;
|
||||
export const VERSION: Types.FeedVersion = 19 as Types.FeedVersion;
|
||||
|
||||
@@ -25,5 +25,6 @@ export type CPUUse = Opaque<number, 'CPUUse'>;
|
||||
|
||||
export type BlockDetails = [BlockNumber, BlockHash, Milliseconds, Timestamp, Maybe<PropagationTime>];
|
||||
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion, Maybe<Address>];
|
||||
export type NodeStats = [PeerCount, TransactionCount, Array<MemoryUse>, Array<CPUUse>, Array<Timestamp>];
|
||||
export type NodeStats = [PeerCount, TransactionCount];
|
||||
export type NodeHardware = [Array<MemoryUse>, Array<CPUUse>, Array<Timestamp>];
|
||||
export type NodeLocation = [Latitude, Longitude, City];
|
||||
|
||||
Reference in New Issue
Block a user