Skip to content

Commit

Permalink
Consolidate handle_transaction metrics (MystenLabs#7644)
Browse files Browse the repository at this point in the history
handle_transaction does not care if the tx requires consensus or not.
  • Loading branch information
mystenmark authored Jan 24, 2023
1 parent 40f8462 commit 98e4fd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
26 changes: 5 additions & 21 deletions crates/sui-core/src/authority_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ pub struct ValidatorServiceMetrics {
pub tx_verification_latency: Histogram,
pub cert_verification_latency: Histogram,
pub consensus_latency: Histogram,
pub handle_transaction_consensus_latency: Histogram,
pub handle_transaction_non_consensus_latency: Histogram,
pub handle_transaction_latency: Histogram,
pub handle_certificate_consensus_latency: Histogram,
pub handle_certificate_non_consensus_latency: Histogram,

Expand Down Expand Up @@ -177,16 +176,9 @@ impl ValidatorServiceMetrics {
registry,
)
.unwrap(),
handle_transaction_consensus_latency: register_histogram_with_registry!(
"validator_service_handle_transaction_consensus_latency",
"Latency of handling a consensus transaction",
LATENCY_SEC_BUCKETS.to_vec(),
registry,
)
.unwrap(),
handle_transaction_non_consensus_latency: register_histogram_with_registry!(
"validator_service_handle_transaction_non_consensus_latency",
"Latency of handling a non-consensus transaction",
handle_transaction_latency: register_histogram_with_registry!(
"validator_service_handle_transaction_latency",
"Latency of handling a transaction",
LATENCY_SEC_BUCKETS.to_vec(),
registry,
)
Expand Down Expand Up @@ -252,15 +244,7 @@ impl ValidatorService {
) -> Result<tonic::Response<TransactionInfoResponse>, tonic::Status> {
let transaction = request.into_inner();

let is_consensus_tx = transaction.contains_shared_object();

let _metrics_guard = if is_consensus_tx {
metrics.handle_transaction_consensus_latency.start_timer()
} else {
metrics
.handle_transaction_non_consensus_latency
.start_timer()
};
let _metrics_guard = metrics.handle_transaction_latency.start_timer();
let tx_verif_metrics_guard = metrics.tx_verification_latency.start_timer();

let transaction = transaction.verify().tap_err(|_| {
Expand Down
4 changes: 3 additions & 1 deletion crates/sui/tests/transaction_orchestrator_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ async fn test_tx_across_epoch_boundaries() {
info!("All nodes including fullnode finished");

// The transaction must finalize in epoch 1
match tokio::time::timeout(tokio::time::Duration::from_secs(10), result_rx.recv()).await {
let start = std::time::Instant::now();
match tokio::time::timeout(tokio::time::Duration::from_secs(15), result_rx.recv()).await {
Ok(Some(tx_cert)) if tx_cert.auth_sig().epoch == 1 => (),
other => panic!("unexpected error: {:?}", other),
}
info!("test completed in {:?}", start.elapsed());
}

async fn execute_with_orchestrator(
Expand Down

0 comments on commit 98e4fd0

Please sign in to comment.