Skip to content

Commit

Permalink
[mempool] Diem -> Aptos
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario committed Mar 11, 2022
1 parent f59528e commit 6cde06d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 29 additions & 29 deletions mempool/src/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub const UNKNOWN_PEER: &str = "unknown_peer";
/// Counter tracking size of various indices in core mempool
static CORE_MEMPOOL_INDEX_SIZE: Lazy<IntGaugeVec> = Lazy::new(|| {
register_int_gauge_vec!(
"aptos_core_mempool_index_size",
"core_mempool_index_size",
"Size of a core mempool index",
&["index"]
)
Expand All @@ -95,7 +95,7 @@ pub fn core_mempool_index_size(label: &'static str, size: usize) {
/// Counter tracking number of txns removed from core mempool
pub static CORE_MEMPOOL_REMOVED_TXNS: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"aptos_core_mempool_removed_txns_count",
"core_mempool_removed_txns_count",
"Number of txns removed from core mempool"
)
.unwrap()
Expand All @@ -105,7 +105,7 @@ pub static CORE_MEMPOOL_REMOVED_TXNS: Lazy<IntCounter> = Lazy::new(|| {
/// (e.g. time from txn entering core mempool to being pulled in consensus block)
pub static CORE_MEMPOOL_TXN_COMMIT_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_core_mempool_txn_commit_latency",
"core_mempool_txn_commit_latency",
"Latency of txn reaching various stages in core mempool after insertion",
&["stage"]
)
Expand All @@ -116,7 +116,7 @@ pub static CORE_MEMPOOL_TXN_COMMIT_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
/// how many txns were actually cleaned up in this GC event
pub static CORE_MEMPOOL_GC_EVENT_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_core_mempool_gc_event_count",
"core_mempool_gc_event_count",
"Number of times the periodic garbage-collection event occurs, regardless of how many txns were actually removed",
&["type"])
.unwrap()
Expand All @@ -125,7 +125,7 @@ pub static CORE_MEMPOOL_GC_EVENT_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
/// Counter tracking time for how long a transaction stayed in core-mempool before being garbage-collected
pub static CORE_MEMPOOL_GC_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_core_mempool_gc_latency",
"core_mempool_gc_latency",
"How long a transaction stayed in core mempool before garbage-collected",
&["type", "status"]
)
Expand All @@ -146,7 +146,7 @@ pub static PENDING_MEMPOOL_NETWORK_EVENTS: Lazy<IntCounterVec> = Lazy::new(|| {
/// (e.g. # txns in block pulled by consensus, # txns committed from state sync)
static MEMPOOL_SERVICE_TXNS: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_mempool_service_transactions",
"mempool_service_transactions",
"Number of transactions handled in one request/response between mempool and consensus/state sync",
&["type"]
)
Expand All @@ -163,7 +163,7 @@ pub fn mempool_service_transactions(label: &'static str, num: usize) {
/// A 'fail' result means the mempool's callback response to consensus/state sync failed.
static MEMPOOL_SERVICE_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_mempool_service_latency_ms",
"mempool_service_latency_ms",
"Latency of mempool processing request from consensus/state sync",
&["type", "result"]
)
Expand All @@ -179,7 +179,7 @@ pub fn mempool_service_latency(label: &'static str, result: &str, duration: Dura
/// Counter for types of network messages received by shared mempool
static SHARED_MEMPOOL_EVENTS: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_shared_mempool_events",
"shared_mempool_events",
"Number of network events received by shared mempool",
&["event"] // type of event: "new_peer", "lost_peer", "message"
)
Expand All @@ -193,7 +193,7 @@ pub fn shared_mempool_event_inc(event: &'static str) {
/// Counter for tracking e2e latency for mempool to process txn submission requests from clients and peers
static PROCESS_TXN_SUBMISSION_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_shared_mempool_request_latency",
"shared_mempool_request_latency",
"Latency of mempool processing txn submission requests",
&["network"]
)
Expand All @@ -215,7 +215,7 @@ pub fn process_txn_submit_latency_timer_client() -> HistogramTimer {
/// Counter for tracking e2e latency for mempool to process get txn by hash requests from clients and peers
static PROCESS_GET_TXN_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_shared_mempool_get_txn_request_latency",
"shared_mempool_get_txn_request_latency",
"Latency of mempool processing get txn by hash requests",
&["network"]
)
Expand All @@ -231,7 +231,7 @@ pub fn process_get_txn_latency_timer_client() -> HistogramTimer {
/// Tracks latency of different stages of txn processing (e.g. vm validation, storage read)
pub static PROCESS_TXN_BREAKDOWN_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_mempool_process_txn_breakdown_latency",
"mempool_process_txn_breakdown_latency",
"Latency of different stages of processing txns in mempool",
&["portion"]
)
Expand All @@ -241,7 +241,7 @@ pub static PROCESS_TXN_BREAKDOWN_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
/// Counter for tracking latency for mempool to broadcast to a peer
static SHARED_MEMPOOL_BROADCAST_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"diem_broadcast_latency",
"mempool_broadcast_latency",
"Latency of mempool executing broadcast to another peer",
&["network"]
)
Expand All @@ -257,7 +257,7 @@ pub fn shared_mempool_broadcast_latency(network_id: NetworkId, latency: Duration
/// Counter for tracking roundtrip-time from sending a broadcast to receiving ACK for that broadcast
pub static SHARED_MEMPOOL_BROADCAST_RTT: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_shared_mempool_broadcast_roundtrip_latency",
"shared_mempool_broadcast_roundtrip_latency",
"Time elapsed between sending a broadcast and receiving an ACK for that broadcast",
&["network"]
)
Expand All @@ -267,7 +267,7 @@ pub static SHARED_MEMPOOL_BROADCAST_RTT: Lazy<HistogramVec> = Lazy::new(|| {
/// Counter tracking number of mempool broadcasts that have not been ACK'ed for
static SHARED_MEMPOOL_PENDING_BROADCASTS_COUNT: Lazy<IntGaugeVec> = Lazy::new(|| {
register_int_gauge_vec!(
"aptos_shared_mempool_pending_broadcasts_count",
"shared_mempool_pending_broadcasts_count",
"Number of mempool broadcasts not ACK'ed for yet",
&["network", "recipient"]
)
Expand All @@ -283,7 +283,7 @@ pub fn shared_mempool_pending_broadcasts(peer: &PeerNetworkId) -> IntGauge {

static SHARED_MEMPOOL_TRANSACTIONS_PROCESSED: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_shared_mempool_transactions_processed",
"shared_mempool_transactions_processed",
"Number of transactions received and handled by shared mempool",
&[
"status", // state of transaction processing: "received", "success", status code from failed txn processing
Expand All @@ -302,7 +302,7 @@ pub fn shared_mempool_transactions_processed_inc(status: &str, network: &str) {
/// Counter for number of transactions in each mempool broadcast sent
static SHARED_MEMPOOL_TRANSACTION_BROADCAST_SIZE: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_shared_mempool_transaction_broadcast",
"shared_mempool_transaction_broadcast",
"Number of transactions in each mempool broadcast sent",
&["network"]
)
Expand All @@ -317,7 +317,7 @@ pub fn shared_mempool_broadcast_size(network_id: NetworkId, num_txns: usize) {

static SHARED_MEMPOOL_BROADCAST_TYPE_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_shared_mempool_rebroadcast_count",
"shared_mempool_rebroadcast_count",
"Number of various types of broadcasts executed by shared mempool",
&["network", "type"]
)
Expand All @@ -332,7 +332,7 @@ pub fn shared_mempool_broadcast_type_inc(network_id: NetworkId, label: &str) {

static SHARED_MEMPOOL_ACK_TYPE_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_shared_mempool_ack_count",
"shared_mempool_ack_count",
"Number of various types of ACKs sent/received by shared mempool",
&["network", "direction", "type"]
)
Expand All @@ -347,7 +347,7 @@ pub fn shared_mempool_ack_inc(network_id: NetworkId, direction: &str, label: &'s

static TASK_SPAWN_LATENCY: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"aptos_mempool_bounded_executor_spawn_latency",
"mempool_bounded_executor_spawn_latency",
"Time it takes for mempool's coordinator to spawn async tasks",
&["task", "stage"]
)
Expand All @@ -362,24 +362,24 @@ pub fn task_spawn_latency_timer(task: &'static str, stage: &'static str) -> Hist

pub static CORE_MEMPOOL_INVARIANT_VIOLATION_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"aptos_mempool_core_mempool_invariant_violated_count",
"mempool_core_mempool_invariant_violated_count",
"Number of times a core mempool invariant was violated"
)
.unwrap()
});

pub static VM_RECONFIG_UPDATE_FAIL_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"aptos_mempool_vm_reconfig_update_fail_count",
"mempool_vm_reconfig_update_fail_count",
"Number of times mempool's VM reconfig update failed"
)
.unwrap()
});

/// Counter for failed Diem network sends
/// Counter for failed network sends
static NETWORK_SEND_FAIL: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_mempool_network_send_fail_count",
"mempool_network_send_fail_count",
"Number of times mempool network send failure occurs",
&["type"]
)
Expand All @@ -392,7 +392,7 @@ pub fn network_send_fail_inc(label: &'static str) {

static UNEXPECTED_NETWORK_MSG_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_mempool_unexpected_network_count",
"mempool_unexpected_network_count",
"Number of unexpected network msgs received",
&["network"]
)
Expand All @@ -408,7 +408,7 @@ pub fn unexpected_msg_count_inc(network_id: &NetworkId) {
/// Counter for failed callback response to JSON RPC
pub static CLIENT_CALLBACK_FAIL: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"aptos_mempool_json_rpc_callback_fail_count",
"mempool_json_rpc_callback_fail_count",
"Number of times callback to JSON RPC failed in mempool"
)
.unwrap()
Expand All @@ -418,7 +418,7 @@ pub static CLIENT_CALLBACK_FAIL: Lazy<IntCounter> = Lazy::new(|| {
/// did not send
static INVALID_ACK_RECEIVED_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_mempool_unrecognized_ack_received_count",
"mempool_unrecognized_ack_received_count",
"Number of ACK messages received with an invalid request_id that this node's mempool did not send",
&["network", "type"]
)
Expand All @@ -434,7 +434,7 @@ pub fn invalid_ack_inc(network_id: NetworkId, label: &'static str) {
/// Counter for number of times a DB read resulted in error
pub static DB_ERROR: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"aptos_mempool_db_error_count",
"mempool_db_error_count",
"Number of times a DB read error was encountered in mempool"
)
.unwrap()
Expand All @@ -444,7 +444,7 @@ pub static DB_ERROR: Lazy<IntCounter> = Lazy::new(|| {
/// broadcast to, summed across each of its networks
static ACTIVE_UPSTREAM_PEERS_COUNT: Lazy<IntGaugeVec> = Lazy::new(|| {
register_int_gauge_vec!(
"aptos_mempool_active_upstream_peers_count",
"mempool_active_upstream_peers_count",
"Number of active upstream peers for the node of this mempool",
&["network"]
)
Expand All @@ -459,7 +459,7 @@ pub fn active_upstream_peers(network_id: &NetworkId) -> IntGauge {
pub static MAIN_LOOP: Lazy<DurationHistogram> = Lazy::new(|| {
DurationHistogram::new(
register_histogram!(
"aptos_mempool_main_loop",
"mempool_main_loop",
"Duration of the each run of the event loop"
)
.unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion mempool/src/shared_mempool/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ impl MempoolNetworkInterface {
// If the number of un-ACK'ed un-expired broadcasts reaches this threshold, we do not broadcast anymore
// and wait until an ACK is received or a sent broadcast expires.
// This helps rate-limit egress network bandwidth and not overload a remote peer or this
// node's Diem network sender.
// node's network sender.
if pending_broadcasts >= self.mempool_config.max_broadcasts_per_peer {
return Err(BroadcastError::TooManyPendingBroadcasts(peer));
}
Expand Down

0 comments on commit 6cde06d

Please sign in to comment.