From 713c767968445e9e866ffaac358c30a405b78c60 Mon Sep 17 00:00:00 2001 From: longbowlu Date: Fri, 9 Sep 2022 11:04:10 -0700 Subject: [PATCH] add buckets for timers --- crates/sui-benchmark/src/drivers/bench_driver.rs | 3 +++ crates/sui-core/src/authority.rs | 7 +++++++ crates/sui-core/src/authority_server.rs | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/crates/sui-benchmark/src/drivers/bench_driver.rs b/crates/sui-benchmark/src/drivers/bench_driver.rs index e4bd18e1d6a97..fbcda899e55aa 100644 --- a/crates/sui-benchmark/src/drivers/bench_driver.rs +++ b/crates/sui-benchmark/src/drivers/bench_driver.rs @@ -43,6 +43,8 @@ pub struct BenchMetrics { pub latency_s: HistogramVec, } +const LATENCY_SEC_BUCKETS: &[f64] = &[0.01, 0.1, 1., 2., 3., 5., 10., 20., 30., 60., 180.]; + impl BenchMetrics { fn new(registry: &Registry) -> Self { BenchMetrics { @@ -78,6 +80,7 @@ impl BenchMetrics { "latency_s", "Total time in seconds to return a response", &["workload"], + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), diff --git a/crates/sui-core/src/authority.rs b/crates/sui-core/src/authority.rs index 7b6e8cf83bed9..f067d1cf076bf 100644 --- a/crates/sui-core/src/authority.rs +++ b/crates/sui-core/src/authority.rs @@ -162,6 +162,8 @@ const POSITIVE_INT_BUCKETS: &[f64] = &[ 1., 2., 5., 10., 20., 50., 100., 200., 500., 1000., 2000., 5000., 10000., 20000., 50000., ]; +const LATENCY_SEC_BUCKETS: &[f64] = &[0.001, 0.01, 0.1, 1., 2., 3., 5., 10., 20., 30., 60., 180.]; + impl AuthorityMetrics { pub fn new(registry: &prometheus::Registry) -> AuthorityMetrics { // buckets are: 100, 10k, 1M, 100M, 10B, 1T, 100T, 10Q @@ -241,30 +243,35 @@ impl AuthorityMetrics { prepare_certificate_latency: register_histogram_with_registry!( "validator_prepare_certificate_latency", "Latency of preparing certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), commit_certificate_latency: register_histogram_with_registry!( "validator_commit_certificate_latency", "Latency of committing certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), handle_transaction_latency: register_histogram_with_registry!( "validator_handle_transaction_latency", "Latency of committing certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), handle_certificate_latency: register_histogram_with_registry!( "validator_handle_certificate_latency", "Latency of handling certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), handle_node_sync_certificate_latency: register_histogram_with_registry!( "fullnode_handle_node_sync_certificate_latency", "Latency of fullnode handling certificate from node sync", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), diff --git a/crates/sui-core/src/authority_server.rs b/crates/sui-core/src/authority_server.rs index cf284b63da4e3..0b5d17437c003 100644 --- a/crates/sui-core/src/authority_server.rs +++ b/crates/sui-core/src/authority_server.rs @@ -169,48 +169,57 @@ pub struct ValidatorServiceMetrics { pub handle_certificate_non_consensus_latency: Histogram, } +const LATENCY_SEC_BUCKETS: &[f64] = &[0.001, 0.01, 0.1, 1., 2., 3., 5., 10., 20., 30., 60., 180.]; + impl ValidatorServiceMetrics { pub fn new(registry: &Registry) -> Self { Self { tx_verification_latency: register_histogram_with_registry!( "validator_service_tx_verification_latency", "Latency of verifying a transaction", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), cert_verification_latency: register_histogram_with_registry!( "validator_service_cert_verification_latency", "Latency of verifying a certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), consensus_latency: register_histogram_with_registry!( "validator_service_consensus_latency", "Time spent between submitting a shared obj txn to consensus and getting result", + LATENCY_SEC_BUCKETS.to_vec(), 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", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), handle_certificate_consensus_latency: register_histogram_with_registry!( "validator_service_handle_certificate_consensus_latency", "Latency of handling a consensus transaction certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(), handle_certificate_non_consensus_latency: register_histogram_with_registry!( "validator_service_handle_certificate_non_consensus_latency", "Latency of handling a non-consensus transaction certificate", + LATENCY_SEC_BUCKETS.to_vec(), registry, ) .unwrap(),