Skip to content

Commit

Permalink
[State Sync] Handle metric increases for consensus.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLind authored and aptos-bot committed Apr 20, 2022
1 parent 76746a0 commit 62b1c6d
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions state-sync/state-sync-v2/state-sync-driver/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ impl<
consensus_commit_notification.reconfiguration_events.len()
))
);
metrics::increment_counter(
&metrics::DRIVER_COUNTERS,
metrics::DRIVER_CONSENSUS_COMMIT_NOTIFICATION,
);
self.update_consensus_commit_metrics(&consensus_commit_notification);

// TODO(joshlind): can we get consensus to forward the events?

Expand Down Expand Up @@ -278,6 +275,30 @@ impl<
self.check_sync_request_progress().await
}

/// Updates the storage synchronizer metrics based on the consensus
/// commit notification.
fn update_consensus_commit_metrics(
&self,
consensus_commit_notification: &ConsensusCommitNotification,
) {
metrics::increment_counter(
&metrics::DRIVER_COUNTERS,
metrics::DRIVER_CONSENSUS_COMMIT_NOTIFICATION,
);

let operations = [
metrics::StorageSynchronizerOperations::ExecutedTransactions,
metrics::StorageSynchronizerOperations::SyncedTransactions,
];
for operation in operations {
metrics::increment_gauge(
&metrics::STORAGE_SYNCHRONIZER_OPERATIONS,
operation.get_label(),
consensus_commit_notification.transactions.len() as u64,
);
}
}

/// Handles a consensus notification to sync to a specified target
async fn handle_consensus_sync_notification(
&mut self,
Expand Down

0 comments on commit 62b1c6d

Please sign in to comment.