use prometheus::{exponential_buckets, linear_buckets}; use std::sync::LazyLock; pub static MPC_PENDING_CKDS_QUEUE_SIZE: LazyLock = LazyLock::new(|| { prometheus::register_int_gauge!( "mpc_pending_ckds_queue_size", "Number of pending ckd requests in the queue" ) .unwrap() }); pub static MPC_PENDING_VERIFY_FOREIGN_TX_QUEUE_SIZE_TOTAL: LazyLock = LazyLock::new(|| { prometheus::register_int_gauge!( "mpc_pending_verify_foreign_txs_queue_size_total", "Number of pending verify foreign tx requests in the queue" ) .unwrap() }); pub static MPC_PENDING_VERIFY_FOREIGN_TX_QUEUE_ATTEMPTS_GENERATED_TOTAL: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_verify_foreign_txs_queue_attempts_generated_total", "Number of attempts generated by the pending verify foreign tx queue to compute a signature as the leader" ) .unwrap() }); pub static MPC_PENDING_VERIFY_FOREIGN_TXS_QUEUE_REQUESTS_INDEXED_TOTAL: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_verify_foreign_txs_queue_requests_indexed_total", "Number of verify foreign tx requests indexed by the pending verify foreign tx queue" ) .unwrap() }); pub static MPC_PENDING_VERIFY_FOREIGN_TXS_QUEUE_RESPONSES_INDEXED_TOTAL: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_verify_foreign_txs_queue_responses_indexed_total", "Number of verify foreign tx responses indexed by the pending verify foreign tx queue. Note that not all of these may get finalized." ) .unwrap() }); pub static MPC_PENDING_VERIFY_FOREIGN_TXS_QUEUE_MATCHING_RESPONSES_INDEXED_TOTAL: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_verify_foreign_txs_queue_matching_responses_indexed_total", "Number of verify foreign tx responses that match previously indexed verify foreign tx requests, indexed by the pending verify foreign tx queue. Note that not all of these may get finalized." ) .unwrap() }); pub static MPC_PENDING_VERIFY_FOREIGN_TXS_QUEUE_FINALIZED_RESPONSES_INDEXED_TOTAL: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_verify_foreign_txs_queue_finalized_responses_indexed_total", "Number of verify foreign tx responses that have been finalized, indexed by the pending verify foreign tx queue." ) .unwrap() }); pub static VERIFY_FOREIGN_TXS_REQUEST_RESPONSE_LATENCY_BLOCKS: LazyLock = LazyLock::new(|| { // High resolution for 1-9 blocks let mut buckets = linear_buckets(1.0, 1.0, 9).unwrap(); // 10, 15, 22.5, 33.75, 50, ..., 256, 384 let exponential_buckets = exponential_buckets(10.0, 1.5, 91).unwrap(); buckets.extend(exponential_buckets); prometheus::register_histogram!( "mpc_verify_foreign_txs_request_response_latency_blocks", "The number of blocks between when a verify foreign tx request is seen and when the corresponding response is seen.", buckets). unwrap() }); pub static VERIFY_FOREIGN_TXS_REQUEST_RESPONSE_LATENCY_SECONDS: LazyLock = LazyLock::new(|| { prometheus::register_histogram!( "mpc_verify_foreign_txs_request_response_latency_seconds", "The duration, in seconds, between when a verify foreign tx request is seen and when the corresponding response is seen.", // 2s - 3s - 4.5s .... - 115s exponential_buckets(2.0, 1.5, 10).unwrap() ).unwrap() }); pub static MPC_PENDING_CKDS_QUEUE_FINALIZED_RESPONSES_INDEXED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_ckds_queue_finalized_responses_indexed", "Number of ckd responses that have been finalized, indexed by the pending ckds queue." ) .unwrap() }); pub static MPC_PENDING_CKDS_QUEUE_REQUESTS_INDEXED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_ckds_queue_requests_indexed", "Number of ckd requests indexed by the pending ckds queue" ) .unwrap() }); pub static MPC_PENDING_CKDS_QUEUE_RESPONSES_INDEXED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_ckds_queue_responses_indexed", "Number of ckd responses indexed by the pending ckds queue. Note that not all of these may get finalized." ) .unwrap() }); pub static MPC_PENDING_CKDS_QUEUE_MATCHING_RESPONSES_INDEXED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_ckds_queue_matching_responses_indexed", "Number of ckd responses that match previously indexed ckd requests, indexed by the pending ckds queue. Note that not all of these may get finalized." ) .unwrap() }); pub static MPC_PENDING_CKDS_QUEUE_ATTEMPTS_GENERATED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_ckds_queue_attempts_generated", "Number of attempts generated by the pending ckds queue to compute a ckd as the leader" ) .unwrap() }); pub static CKD_REQUEST_RESPONSE_LATENCY_BLOCKS: LazyLock = LazyLock::new( || { // High resolution for 1-9 blocks let mut buckets = linear_buckets(1.0, 1.0, 9).unwrap(); // 10, 15, 22.5, 33.75, 50, ..., 256, 384 let exponential_buckets = exponential_buckets(10.0, 1.5, 91).unwrap(); buckets.extend(exponential_buckets); prometheus::register_histogram!( "mpc_ckd_request_response_latency_blocks", "The number of blocks between when a ckd request is seen and when the corresponding response is seen.", buckets). unwrap() }, ); pub static CKD_REQUEST_RESPONSE_LATENCY_SECONDS: LazyLock = LazyLock::new( || { prometheus::register_histogram!( "mpc_ckd_request_response_latency_seconds", "The duration, in seconds, between when a ckd request is seen and when the corresponding response is seen.", // 2s - 3s - 4.5s .... - 115s exponential_buckets(2.0, 1.5, 10).unwrap() ).unwrap() }, ); pub static MPC_PENDING_SIGNATURES_QUEUE_SIZE: LazyLock = LazyLock::new(|| { prometheus::register_int_gauge!( "mpc_pending_signatures_queue_size", "Number of pending signature requests in the queue" ) .unwrap() }); pub static MPC_PENDING_SIGNATURES_QUEUE_FINALIZED_RESPONSES_INDEXED: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_signatures_queue_finalized_responses_indexed", "Number of signature responses that have been finalized, indexed by the pending signatures queue." ) .unwrap() }); pub static MPC_PENDING_SIGNATURES_QUEUE_REQUESTS_INDEXED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_signatures_queue_requests_indexed", "Number of signature requests indexed by the pending signatures queue" ) .unwrap() }); pub static MPC_PENDING_SIGNATURES_QUEUE_RESPONSES_INDEXED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_signatures_queue_responses_indexed", "Number of signature responses indexed by the pending signatures queue. Note that not all of these may get finalized." ) .unwrap() }); pub static MPC_PENDING_SIGNATURES_QUEUE_MATCHING_RESPONSES_INDEXED: LazyLock< prometheus::IntCounter, > = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_signatures_queue_matching_responses_indexed", "Number of signature responses that match previously indexed signature requests, indexed by the pending signatures queue. Note that not all of these may get finalized." ) .unwrap() }); pub static MPC_PENDING_SIGNATURES_QUEUE_ATTEMPTS_GENERATED: LazyLock = LazyLock::new(|| { prometheus::register_int_counter!( "mpc_pending_signatures_queue_attempts_generated", "Number of attempts generated by the pending signatures queue to compute a signature as the leader" ) .unwrap() }); pub static SIGNATURE_REQUEST_RESPONSE_LATENCY_BLOCKS: LazyLock = LazyLock::new(|| { // High resolution for 1-9 blocks let mut buckets = linear_buckets(1.0, 1.0, 9).unwrap(); // 10, 15, 22.5, 33.75, 50, ..., 256, 384 let exponential_buckets = exponential_buckets(10.0, 1.5, 91).unwrap(); buckets.extend(exponential_buckets); prometheus::register_histogram!( "mpc_signature_request_response_latency_blocks", "The number of blocks between when a signature request is seen and when the corresponding response is seen.", buckets). unwrap() }); pub static SIGNATURE_REQUEST_RESPONSE_LATENCY_SECONDS: LazyLock = LazyLock::new(|| { prometheus::register_histogram!( "mpc_signature_request_response_latency_seconds", "The duration, in seconds, between when a signature request is seen and when the corresponding response is seen.", // 2s - 3s - 4.5s .... - 115s exponential_buckets(2.0, 1.5, 10).unwrap() ).unwrap() }); pub static MPC_CLUSTER_FAILED_SIGNATURES_COUNT: LazyLock = LazyLock::new(|| { prometheus::register_int_counter_vec!( "mpc_cluster_failed_signatures_count", "Number of failed or severely delayed signatures in the cluster", &["reason"] ) .unwrap() });