forked from HarukaMa/snarkOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refac] Move rpc NodeStats types to snarkos_metrics
- Loading branch information
Showing
10 changed files
with
222 additions
and
174 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ pub mod prometheus; | |
|
||
mod metric_types; | ||
|
||
pub mod snapshots; | ||
pub mod stats; | ||
#[cfg(test)] | ||
pub mod testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// Returned value for the `getnodestats` rpc call | ||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeStats { | ||
/// Stats related to messages received by the node. | ||
pub inbound: NodeInboundStats, | ||
/// Stats related to messages sent by the node. | ||
pub outbound: NodeOutboundStats, | ||
/// Stats related to the node's connections. | ||
pub connections: NodeConnectionStats, | ||
/// Stats related to the node's handshakes. | ||
pub handshakes: NodeHandshakeStats, | ||
/// Stats related to the node's queues. | ||
pub queues: NodeQueueStats, | ||
/// Miscellaneous stats related to the node. | ||
pub misc: NodeMiscStats, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeInboundStats { | ||
/// The number of successfully processed inbound messages. | ||
pub all_successes: u64, | ||
/// The number of inbound messages that couldn't be processed. | ||
pub all_failures: u64, | ||
/// The number of all received `Block` messages. | ||
pub blocks: u64, | ||
/// The number of all received `GetBlocks` messages. | ||
pub getblocks: u64, | ||
/// The number of all received `GetMemoryPool` messages. | ||
pub getmemorypool: u64, | ||
/// The number of all received `GetPeers` messages. | ||
pub getpeers: u64, | ||
/// The number of all received `GetSync` messages. | ||
pub getsync: u64, | ||
/// The number of all received `MemoryPool` messages. | ||
pub memorypool: u64, | ||
/// The number of all received `Peers` messages. | ||
pub peers: u64, | ||
/// The number of all received `Ping` messages. | ||
pub pings: u64, | ||
/// The number of all received `Pong` messages. | ||
pub pongs: u64, | ||
/// The number of all received `Sync` messages. | ||
pub syncs: u64, | ||
/// The number of all received `SyncBlock` messages. | ||
pub syncblocks: u64, | ||
/// The number of all received `Transaction` messages. | ||
pub transactions: u64, | ||
/// The number of all received `Unknown` messages. | ||
pub unknown: u64, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeOutboundStats { | ||
/// The number of messages successfully sent by the node. | ||
pub all_successes: u64, | ||
/// The number of messages that failed to be sent to peers. | ||
pub all_failures: u64, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeConnectionStats { | ||
/// The number of all connections the node has accepted. | ||
pub all_accepted: u64, | ||
/// The number of all connections the node has initiated. | ||
pub all_initiated: u64, | ||
/// The number of rejected inbound connection requests. | ||
pub all_rejected: u64, | ||
/// Number of currently connected peers. | ||
pub connected_peers: u32, | ||
/// Number of known disconnected peers. | ||
pub disconnected_peers: u32, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeHandshakeStats { | ||
/// The number of failed handshakes as the initiator. | ||
pub failures_init: u64, | ||
/// The number of failed handshakes as the responder. | ||
pub failures_resp: u64, | ||
/// The number of successful handshakes as the initiator. | ||
pub successes_init: u64, | ||
/// The number of successful handshakes as the responder. | ||
pub successes_resp: u64, | ||
/// The number of handshake timeouts as the initiator. | ||
pub timeouts_init: u64, | ||
/// The number of handshake timeouts as the responder. | ||
pub timeouts_resp: u64, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeQueueStats { | ||
/// The number of messages queued in the common inbound channel. | ||
pub inbound: u64, | ||
/// The number of messages queued in the individual outbound channels. | ||
pub outbound: u64, | ||
} | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct NodeMiscStats { | ||
/// The current block height of the node. | ||
pub block_height: u64, | ||
/// The number of blocks the node has mined. | ||
pub blocks_mined: u64, | ||
/// The number of duplicate blocks received. | ||
pub duplicate_blocks: u64, | ||
/// The number of duplicate sync blocks received. | ||
pub duplicate_sync_blocks: u64, | ||
/// The number of RPC requests received. | ||
pub rpc_requests: u64, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.