CometBFT 可以报告并提供 Prometheus 指标,Prometheus 收集器可以消费这些指标。 此功能默认禁用。 要启用 Prometheus 指标,请在配置文件中设置 instrumentation.prometheus=true。默认情况下,指标会通过 26660 端口下的 /metrics 提供服务。监听地址可以在配置文件中更改(见 instrumentation.prometheus_listen_addr)。

可用指标列表

以下指标可用:
名称类型标签描述
abci_connection_method_timing_secondsHistogrammethod, type各个 ABCI 方法的耗时
blocksync_syncingGauge0(未进行区块同步)或 1(正在同步)
consensus_heightGauge链高度
consensus_validatorsGauge验证者数量
consensus_validators_powerGauge所有验证者的总投票权
consensus_validator_powerGauge如果节点在验证者集合中,则为该节点的投票权
consensus_validator_last_signed_heightGauge如果节点是验证者,则为该节点上次签署区块的高度
consensus_validator_missed_blocksGauge如果节点是验证者,则为该节点错过的区块总数
consensus_missing_validatorsGauge未签名的验证者数量
consensus_missing_validators_powerGauge缺失验证者的总投票权
consensus_byzantine_validatorsGauge尝试双重签名的验证者数量
consensus_byzantine_validators_powerGauge拜占庭验证者的总投票权
consensus_block_interval_secondsHistogram当前区块与上一个区块之间的时间(Block.Header.Time),单位为秒
consensus_roundsGauge轮次数量
consensus_num_txsGauge交易数量
consensus_total_txsGauge已提交交易总数
consensus_block_partsCounterpeer_id每个对等节点传输的区块分片数量
consensus_latest_block_heightGauge/status sync_info 中的编号
consensus_block_size_bytesGauge区块大小(字节)
consensus_step_durationHistogramstep共识协议中每个步骤耗时的直方图
consensus_round_durationHistogram进程启动以来发生的所有轮次耗时的直方图
consensus_block_gossip_parts_receivedCountermatches_current节点收到的区块分片数量
consensus_quorum_prevote_delayGauge提案时间戳与最早达到法定人数的 prevote 时间戳之间的秒数间隔
consensus_full_prevote_delayGauge提案时间戳与所有验证者都投票的某一轮中最新 prevote 时间戳之间的秒数间隔
consensus_vote_extension_receive_countCounterstatus接收到的投票扩展数量
consensus_proposal_receive_countCounterstatus进程启动以来节点接收到的提案总数
consensus_proposal_create_countCounter进程启动以来节点创建的提案总数
consensus_round_voting_power_percentGaugevote_type介于 0 和 1.0 之间的值,表示某一轮中按投票类型接收的总投票权百分比
consensus_late_votesCountervote_type进程启动以来节点收到的、对应于比当前所在高度和轮次更早的高度和轮次的投票数量
p2p_message_send_bytes_totalCountermessage_type按消息类型发送给所有对等节点的字节数
p2p_message_receive_bytes_totalCountermessage_type按消息类型从所有对等节点接收的字节数
p2p_peersGauge节点已连接的对等节点数量
p2p_peer_receive_bytes_totalCounterpeer_id, chID从给定对等节点按通道接收的字节数
p2p_peer_send_bytes_totalCounterpeer_id, chID发送给给定对等节点的按通道字节数
p2p_peer_pending_send_bytesGaugepeer_id待发送给给定对等节点的字节数
p2p_num_txsGaugepeer_id每个 peer_id 提交的交易数量
p2p_pending_send_bytesGaugepeer_id待发送给对等节点的数据量
mempool_sizeGauge未提交交易数量
mempool_tx_size_bytesHistogram交易大小(字节)
mempool_failed_txsCounter失败交易数量
mempool_recheck_timesCounter在 mempool 中重新检查的交易数量
state_block_processing_timeHistogram处理 FinalizeBlock 所花费的时间,单位为毫秒
state_consensus_param_updatesCounter进程启动以来应用返回的共识参数更新数量
state_validator_set_updatesCounter进程启动以来应用返回的验证者集合更新数量
statesync_syncingGauge0(未进行状态同步)或 1(正在同步)

有用的查询

缺失 + 拜占庭验证者的百分比:
((consensus\_byzantine\_validators\_power + consensus\_missing\_validators\_power) / consensus\_validators\_power) * 100

CometBFT can report and serve Prometheus metrics, which in turn can be consumed by Prometheus collector(s). This functionality is disabled by default. To enable Prometheus metrics, set instrumentation.prometheus=true in your config file. Metrics will be served under /metrics on port 26660 by default. The listen address can be changed in the config file (see instrumentation.prometheus\_listen\_addr).

List of available metrics

The following metrics are available:
NameTypeTagsDescription
abci_connection_method_timing_secondsHistogrammethod, typeTimings for each of the ABCI methods
blocksync_syncingGaugeEither 0 (not block syncing) or 1 (syncing)
consensus_heightGaugeHeight of the chain
consensus_validatorsGaugeNumber of validators
consensus_validators_powerGaugeTotal voting power of all validators
consensus_validator_powerGaugeVoting power of the node if in the validator set
consensus_validator_last_signed_heightGaugeLast height the node signed a block, if the node is a validator
consensus_validator_missed_blocksGaugeTotal number of blocks missed for the node, if the node is a validator
consensus_missing_validatorsGaugeNumber of validators who did not sign
consensus_missing_validators_powerGaugeTotal voting power of the missing validators
consensus_byzantine_validatorsGaugeNumber of validators who tried to double sign
consensus_byzantine_validators_powerGaugeTotal voting power of the byzantine validators
consensus_block_interval_secondsHistogramTime between this and the last block (Block.Header.Time) in seconds
consensus_roundsGaugeNumber of rounds
consensus_num_txsGaugeNumber of transactions
consensus_total_txsGaugeTotal number of transactions committed
consensus_block_partsCounterpeer_idNumber of block parts transmitted by peer
consensus_latest_block_heightGauge/status sync_info number
consensus_block_size_bytesGaugeBlock size in bytes
consensus_step_durationHistogramstepHistogram of durations for each step in the consensus protocol
consensus_round_durationHistogramHistogram of durations for all the rounds that have occurred since the process started
consensus_block_gossip_parts_receivedCountermatches_currentNumber of block parts received by the node
consensus_quorum_prevote_delayGaugeInterval in seconds between the proposal timestamp and the timestamp of the earliest prevote that achieved a quorum
consensus_full_prevote_delayGaugeInterval in seconds between the proposal timestamp and the timestamp of the latest prevote in a round where all validators voted
consensus_vote_extension_receive_countCounterstatusNumber of vote extensions received
consensus_proposal_receive_countCounterstatusTotal number of proposals received by the node since process start
consensus_proposal_create_countCounterTotal number of proposals created by the node since process start
consensus_round_voting_power_percentGaugevote_typeA value between 0 and 1.0 representing the percentage of the total voting power per vote type received within a round
consensus_late_votesCountervote_typeNumber of votes received by the node since process start that correspond to earlier heights and rounds than this node is currently in
p2p_message_send_bytes_totalCountermessage_typeNumber of bytes sent to all peers per message type
p2p_message_receive_bytes_totalCountermessage_typeNumber of bytes received from all peers per message type
p2p_peersGaugeNumber of peers the node is connected to
p2p_peer_receive_bytes_totalCounterpeer_id, chIDNumber of bytes per channel received from a given peer
p2p_peer_send_bytes_totalCounterpeer_id, chIDNumber of bytes per channel sent to a given peer
p2p_peer_pending_send_bytesGaugepeer_idNumber of pending bytes to be sent to a given peer
p2p_num_txsGaugepeer_idNumber of transactions submitted by each peer_id
p2p_pending_send_bytesGaugepeer_idAmount of data pending to be sent to peer
mempool_sizeGaugeNumber of uncommitted transactions
mempool_tx_size_bytesHistogramTransaction sizes in bytes
mempool_failed_txsCounterNumber of failed transactions
mempool_recheck_timesCounterNumber of transactions rechecked in the mempool
state_block_processing_timeHistogramTime spent processing FinalizeBlock in ms
state_consensus_param_updatesCounterNumber of consensus parameter updates returned by the application since process start
state_validator_set_updatesCounterNumber of validator set updates returned by the application since process start
statesync_syncingGaugeEither 0 (not state syncing) or 1 (syncing)

Useful queries

Percentage of missing + byzantine validators:
((consensus\_byzantine\_validators\_power + consensus\_missing\_validators\_power) / consensus\_validators\_power) * 100