github.com/badrootd/nibiru-cometbft@v0.37.5-0.20240307173500-2a75559eee9b/consensus/metrics.gen.go (about) 1 // Code generated by metricsgen. DO NOT EDIT. 2 3 package consensus 4 5 import ( 6 "github.com/go-kit/kit/metrics/discard" 7 prometheus "github.com/go-kit/kit/metrics/prometheus" 8 stdprometheus "github.com/prometheus/client_golang/prometheus" 9 ) 10 11 func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { 12 labels := []string{} 13 for i := 0; i < len(labelsAndValues); i += 2 { 14 labels = append(labels, labelsAndValues[i]) 15 } 16 return &Metrics{ 17 Height: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 18 Namespace: namespace, 19 Subsystem: MetricsSubsystem, 20 Name: "height", 21 Help: "Height of the chain.", 22 }, labels).With(labelsAndValues...), 23 ValidatorLastSignedHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 24 Namespace: namespace, 25 Subsystem: MetricsSubsystem, 26 Name: "validator_last_signed_height", 27 Help: "Last height signed by this validator if the node is a validator.", 28 }, append(labels, "validator_address")).With(labelsAndValues...), 29 Rounds: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 30 Namespace: namespace, 31 Subsystem: MetricsSubsystem, 32 Name: "rounds", 33 Help: "Number of rounds.", 34 }, labels).With(labelsAndValues...), 35 RoundDurationSeconds: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{ 36 Namespace: namespace, 37 Subsystem: MetricsSubsystem, 38 Name: "round_duration_seconds", 39 Help: "Histogram of round duration.", 40 41 Buckets: stdprometheus.ExponentialBucketsRange(0.1, 100, 8), 42 }, labels).With(labelsAndValues...), 43 Validators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 44 Namespace: namespace, 45 Subsystem: MetricsSubsystem, 46 Name: "validators", 47 Help: "Number of validators.", 48 }, labels).With(labelsAndValues...), 49 ValidatorsPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 50 Namespace: namespace, 51 Subsystem: MetricsSubsystem, 52 Name: "validators_power", 53 Help: "Total power of all validators.", 54 }, labels).With(labelsAndValues...), 55 ValidatorPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 56 Namespace: namespace, 57 Subsystem: MetricsSubsystem, 58 Name: "validator_power", 59 Help: "Power of a validator.", 60 }, append(labels, "validator_address")).With(labelsAndValues...), 61 ValidatorMissedBlocks: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 62 Namespace: namespace, 63 Subsystem: MetricsSubsystem, 64 Name: "validator_missed_blocks", 65 Help: "Amount of blocks missed per validator.", 66 }, append(labels, "validator_address")).With(labelsAndValues...), 67 MissingValidators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 68 Namespace: namespace, 69 Subsystem: MetricsSubsystem, 70 Name: "missing_validators", 71 Help: "Number of validators who did not sign.", 72 }, labels).With(labelsAndValues...), 73 MissingValidatorsPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 74 Namespace: namespace, 75 Subsystem: MetricsSubsystem, 76 Name: "missing_validators_power", 77 Help: "Total power of the missing validators.", 78 }, labels).With(labelsAndValues...), 79 ByzantineValidators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 80 Namespace: namespace, 81 Subsystem: MetricsSubsystem, 82 Name: "byzantine_validators", 83 Help: "Number of validators who tried to double sign.", 84 }, labels).With(labelsAndValues...), 85 ByzantineValidatorsPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 86 Namespace: namespace, 87 Subsystem: MetricsSubsystem, 88 Name: "byzantine_validators_power", 89 Help: "Total power of the byzantine validators.", 90 }, labels).With(labelsAndValues...), 91 BlockIntervalSeconds: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{ 92 Namespace: namespace, 93 Subsystem: MetricsSubsystem, 94 Name: "block_interval_seconds", 95 Help: "Time between this and the last block.", 96 }, labels).With(labelsAndValues...), 97 NumTxs: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 98 Namespace: namespace, 99 Subsystem: MetricsSubsystem, 100 Name: "num_txs", 101 Help: "Number of transactions.", 102 }, labels).With(labelsAndValues...), 103 BlockSizeBytes: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 104 Namespace: namespace, 105 Subsystem: MetricsSubsystem, 106 Name: "block_size_bytes", 107 Help: "Size of the block.", 108 }, labels).With(labelsAndValues...), 109 TotalTxs: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 110 Namespace: namespace, 111 Subsystem: MetricsSubsystem, 112 Name: "total_txs", 113 Help: "Total number of transactions.", 114 }, labels).With(labelsAndValues...), 115 CommittedHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 116 Namespace: namespace, 117 Subsystem: MetricsSubsystem, 118 Name: "latest_block_height", 119 Help: "The latest block height.", 120 }, labels).With(labelsAndValues...), 121 BlockSyncing: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 122 Namespace: namespace, 123 Subsystem: MetricsSubsystem, 124 Name: "block_syncing", 125 Help: "Whether or not a node is block syncing. 1 if yes, 0 if no.", 126 }, labels).With(labelsAndValues...), 127 StateSyncing: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 128 Namespace: namespace, 129 Subsystem: MetricsSubsystem, 130 Name: "state_syncing", 131 Help: "Whether or not a node is state syncing. 1 if yes, 0 if no.", 132 }, labels).With(labelsAndValues...), 133 BlockParts: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ 134 Namespace: namespace, 135 Subsystem: MetricsSubsystem, 136 Name: "block_parts", 137 Help: "Number of block parts transmitted by each peer.", 138 }, append(labels, "peer_id")).With(labelsAndValues...), 139 StepDurationSeconds: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{ 140 Namespace: namespace, 141 Subsystem: MetricsSubsystem, 142 Name: "step_duration_seconds", 143 Help: "Histogram of durations for each step in the consensus protocol.", 144 145 Buckets: stdprometheus.ExponentialBucketsRange(0.1, 100, 8), 146 }, append(labels, "step")).With(labelsAndValues...), 147 BlockGossipPartsReceived: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ 148 Namespace: namespace, 149 Subsystem: MetricsSubsystem, 150 Name: "block_gossip_parts_received", 151 Help: "Number of block parts received by the node, separated by whether the part was relevant to the block the node is trying to gather or not.", 152 }, append(labels, "matches_current")).With(labelsAndValues...), 153 QuorumPrevoteDelay: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 154 Namespace: namespace, 155 Subsystem: MetricsSubsystem, 156 Name: "quorum_prevote_delay", 157 Help: "Interval in seconds between the proposal timestamp and the timestamp of the earliest prevote that achieved a quorum.", 158 }, append(labels, "proposer_address")).With(labelsAndValues...), 159 FullPrevoteDelay: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 160 Namespace: namespace, 161 Subsystem: MetricsSubsystem, 162 Name: "full_prevote_delay", 163 Help: "Interval in seconds between the proposal timestamp and the timestamp of the latest prevote in a round where all validators voted.", 164 }, append(labels, "proposer_address")).With(labelsAndValues...), 165 ProposalReceiveCount: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ 166 Namespace: namespace, 167 Subsystem: MetricsSubsystem, 168 Name: "proposal_receive_count", 169 Help: "ProposalReceiveCount is the total number of proposals received by this node since process start. The metric is annotated by the status of the proposal from the application, either 'accepted' or 'rejected'.", 170 }, append(labels, "status")).With(labelsAndValues...), 171 ProposalCreateCount: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ 172 Namespace: namespace, 173 Subsystem: MetricsSubsystem, 174 Name: "proposal_create_count", 175 Help: "ProposalCreationCount is the total number of proposals created by this node since process start.", 176 }, labels).With(labelsAndValues...), 177 RoundVotingPowerPercent: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ 178 Namespace: namespace, 179 Subsystem: MetricsSubsystem, 180 Name: "round_voting_power_percent", 181 Help: "RoundVotingPowerPercent is the percentage of the total voting power received with a round. The value begins at 0 for each round and approaches 1.0 as additional voting power is observed. The metric is labeled by vote type.", 182 }, append(labels, "vote_type")).With(labelsAndValues...), 183 LateVotes: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ 184 Namespace: namespace, 185 Subsystem: MetricsSubsystem, 186 Name: "late_votes", 187 Help: "LateVotes stores the number of votes that were received by this node that correspond to earlier heights and rounds than this node is currently in.", 188 }, append(labels, "vote_type")).With(labelsAndValues...), 189 } 190 } 191 192 func NopMetrics() *Metrics { 193 return &Metrics{ 194 Height: discard.NewGauge(), 195 ValidatorLastSignedHeight: discard.NewGauge(), 196 Rounds: discard.NewGauge(), 197 RoundDurationSeconds: discard.NewHistogram(), 198 Validators: discard.NewGauge(), 199 ValidatorsPower: discard.NewGauge(), 200 ValidatorPower: discard.NewGauge(), 201 ValidatorMissedBlocks: discard.NewGauge(), 202 MissingValidators: discard.NewGauge(), 203 MissingValidatorsPower: discard.NewGauge(), 204 ByzantineValidators: discard.NewGauge(), 205 ByzantineValidatorsPower: discard.NewGauge(), 206 BlockIntervalSeconds: discard.NewHistogram(), 207 NumTxs: discard.NewGauge(), 208 BlockSizeBytes: discard.NewGauge(), 209 TotalTxs: discard.NewGauge(), 210 CommittedHeight: discard.NewGauge(), 211 BlockSyncing: discard.NewGauge(), 212 StateSyncing: discard.NewGauge(), 213 BlockParts: discard.NewCounter(), 214 StepDurationSeconds: discard.NewHistogram(), 215 BlockGossipPartsReceived: discard.NewCounter(), 216 QuorumPrevoteDelay: discard.NewGauge(), 217 FullPrevoteDelay: discard.NewGauge(), 218 ProposalReceiveCount: discard.NewCounter(), 219 ProposalCreateCount: discard.NewCounter(), 220 RoundVotingPowerPercent: discard.NewGauge(), 221 LateVotes: discard.NewCounter(), 222 } 223 }