class Raft::Metrics

Overview

Observable counters and state for a Raft node.

Access via Node#metrics. Counters are incremented internally as the node operates. All fields are readable and can be scraped for monitoring.

Defined in:

raft/metrics.cr

Instance Method Summary

Instance Method Detail

def batches_processed : UInt64 #

Number of times a client-request batch was processed by the leader. Each batch may contain one or more proposals. For concurrent workloads, this should be less than #proposals_committed when batching is active.


[View source]
def batches_processed=(batches_processed : UInt64) #

Number of times a client-request batch was processed by the leader. Each batch may contain one or more proposals. For concurrent workloads, this should be less than #proposals_committed when batching is active.


[View source]
def commit_index : UInt64 #

Index of the highest committed log entry.


[View source]
def commit_index=(commit_index : UInt64) #

Index of the highest committed log entry.


[View source]
def elections_started : UInt64 #

Number of elections this node has initiated.


[View source]
def elections_started=(elections_started : UInt64) #

Number of elections this node has initiated.


[View source]
def elections_won : UInt64 #

Number of elections this node has won (became leader).


[View source]
def elections_won=(elections_won : UInt64) #

Number of elections this node has won (became leader).


[View source]
def entries_applied : UInt64 #

Total number of log entries applied to the state machine.


[View source]
def entries_applied=(entries_applied : UInt64) #

Total number of log entries applied to the state machine.


[View source]
def proposals_committed : UInt64 #

Number of client proposals that were committed and applied.


[View source]
def proposals_committed=(proposals_committed : UInt64) #

Number of client proposals that were committed and applied.


[View source]
def role : String #

Current role as a string: "follower", "candidate", or "leader".


[View source]
def role=(role : String) #

Current role as a string: "follower", "candidate", or "leader".


[View source]
def snapshots_installed : UInt64 #

Number of snapshots installed from a leader.


[View source]
def snapshots_installed=(snapshots_installed : UInt64) #

Number of snapshots installed from a leader.


[View source]
def term : UInt64 #

Current Raft term.


[View source]
def term=(term : UInt64) #

Current Raft term.


[View source]
def to_h : Hash(String, UInt64 | String) #

Returns all metrics as a flat hash.


[View source]