|
| 1 | +use rivet_metrics::{BUCKETS, REGISTRY, prometheus::*}; |
| 2 | + |
| 3 | +lazy_static::lazy_static! { |
| 4 | + // MARK: Consensus Operations |
| 5 | + pub static ref PROPOSALS_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 6 | + "epoxy_proposals_total", |
| 7 | + "Total number of proposals.", |
| 8 | + &["status"], |
| 9 | + *REGISTRY |
| 10 | + ).unwrap(); |
| 11 | + |
| 12 | + pub static ref PRE_ACCEPT_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 13 | + "epoxy_pre_accept_total", |
| 14 | + "Total number of pre-accept operations.", |
| 15 | + &["result"], |
| 16 | + *REGISTRY |
| 17 | + ).unwrap(); |
| 18 | + |
| 19 | + pub static ref ACCEPT_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 20 | + "epoxy_accept_total", |
| 21 | + "Total number of accept operations.", |
| 22 | + &["result"], |
| 23 | + *REGISTRY |
| 24 | + ).unwrap(); |
| 25 | + |
| 26 | + pub static ref COMMIT_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 27 | + "epoxy_commit_total", |
| 28 | + "Total number of commit operations.", |
| 29 | + &["result"], |
| 30 | + *REGISTRY |
| 31 | + ).unwrap(); |
| 32 | + |
| 33 | + pub static ref PROPOSAL_DURATION: Histogram = register_histogram_with_registry!( |
| 34 | + "epoxy_proposal_duration", |
| 35 | + "Duration from propose to commit in seconds.", |
| 36 | + BUCKETS.to_vec(), |
| 37 | + *REGISTRY |
| 38 | + ).unwrap(); |
| 39 | + |
| 40 | + // MARK: Message Handling |
| 41 | + pub static ref REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 42 | + "epoxy_requests_total", |
| 43 | + "Total number of requests.", |
| 44 | + &["request_type", "result"], |
| 45 | + *REGISTRY |
| 46 | + ).unwrap(); |
| 47 | + |
| 48 | + pub static ref REQUEST_DURATION: HistogramVec = register_histogram_vec_with_registry!( |
| 49 | + "epoxy_request_duration", |
| 50 | + "Duration of request handling in seconds.", |
| 51 | + &["request_type"], |
| 52 | + BUCKETS.to_vec(), |
| 53 | + *REGISTRY |
| 54 | + ).unwrap(); |
| 55 | + |
| 56 | + // MARK: Quorum |
| 57 | + pub static ref QUORUM_ATTEMPTS_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 58 | + "epoxy_quorum_attempts_total", |
| 59 | + "Total number of quorum attempts.", |
| 60 | + &["quorum_type", "result"], |
| 61 | + *REGISTRY |
| 62 | + ).unwrap(); |
| 63 | + |
| 64 | + pub static ref QUORUM_SIZE: IntGaugeVec = register_int_gauge_vec_with_registry!( |
| 65 | + "epoxy_quorum_size", |
| 66 | + "Current quorum size.", |
| 67 | + &["quorum_type"], |
| 68 | + *REGISTRY |
| 69 | + ).unwrap(); |
| 70 | + |
| 71 | + // MARK: Replica State |
| 72 | + pub static ref BALLOT_EPOCH: IntGauge = register_int_gauge_with_registry!( |
| 73 | + "epoxy_ballot_epoch", |
| 74 | + "Current ballot epoch.", |
| 75 | + *REGISTRY |
| 76 | + ).unwrap(); |
| 77 | + |
| 78 | + pub static ref BALLOT_NUMBER: IntGauge = register_int_gauge_with_registry!( |
| 79 | + "epoxy_ballot_number", |
| 80 | + "Current ballot number.", |
| 81 | + *REGISTRY |
| 82 | + ).unwrap(); |
| 83 | + |
| 84 | + pub static ref INSTANCE_NUMBER: IntGauge = register_int_gauge_with_registry!( |
| 85 | + "epoxy_instance_number", |
| 86 | + "Current instance/slot number.", |
| 87 | + *REGISTRY |
| 88 | + ).unwrap(); |
| 89 | + |
| 90 | + // MARK: Cluster Health |
| 91 | + pub static ref REPLICAS_TOTAL: IntGaugeVec = register_int_gauge_vec_with_registry!( |
| 92 | + "epoxy_replicas_total", |
| 93 | + "Total number of replicas.", |
| 94 | + &["status"], |
| 95 | + *REGISTRY |
| 96 | + ).unwrap(); |
| 97 | + |
| 98 | + // MARK: Errors |
| 99 | + pub static ref BALLOT_REJECTIONS_TOTAL: IntCounter = register_int_counter_with_registry!( |
| 100 | + "epoxy_ballot_rejections_total", |
| 101 | + "Total number of ballot rejections due to stale ballot.", |
| 102 | + *REGISTRY |
| 103 | + ).unwrap(); |
| 104 | + |
| 105 | + pub static ref INTERFERENCE_DETECTED_TOTAL: IntCounter = register_int_counter_with_registry!( |
| 106 | + "epoxy_interference_detected_total", |
| 107 | + "Total number of key conflict interferences detected.", |
| 108 | + *REGISTRY |
| 109 | + ).unwrap(); |
| 110 | +} |
0 commit comments