TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nubskr/walrus/llms.txt
Use this file to discover all available pages before exploring further.
METRICS command returns Raft consensus metrics for the node handling the request. Use this to monitor cluster health, leader election, and replication status.
Syntax
Wire Format
Request:OK followed by a space and the JSON payload (not just the JSON).
Error Response:
Response Format
The JSON response contains Raft metrics from the Octopii consensus engine:Response Fields
The ID of the node that generated these metrics
Current Raft state:
Leader, Follower, or CandidateCurrent election term number (increases with each leader election)
Index of the highest log entry known to be committed (replicated to quorum)
Index of the highest log entry applied to the metadata state machine
Node ID of the current Raft leader, or
null if unknownNode ID this node voted for in the current term, or
null if no vote castTotal number of entries in the Raft log
Number of nodes in the Raft cluster
Examples
Interactive Shell
One-off Command
Programmatic Usage (Rust)
Use Cases
Check Cluster Health
Monitor Replication Lag
Detect Leader Elections
Verify Quorum
Understanding Raft Metrics
Node States
Leader- One leader per cluster at a time
- Handles all metadata writes (topic creation, rollover)
- Replicates log entries to followers
- Has
peersarray with replication status
- Majority of nodes are followers
- Replicate log entries from leader
- Can become candidate if leader fails
- No
peersarray in metrics
- Temporary state during leader election
- Node is requesting votes from peers
- Quickly transitions to leader or follower
- Rare to observe (election is fast)
Indexes Explained
commit_index- Highest entry replicated to a quorum
- Safe to apply to state machine
- Increases as leader replicates entries
- Highest entry actually applied to metadata
- Should match or be slightly behind commit_index
- Gap indicates apply loop is processing
- What the leader knows about each follower
- Used to determine commit_index (quorum)
- Lag indicates slow or disconnected follower
- Next entry to send to follower
- Usually match_index + 1
- Rolls back on AppendEntries rejection
Cluster Health Indicators
Healthy Cluster
- All peers caught up (match_index == commit_index)
- last_applied == commit_index
- Clear leader elected
Replication Lag
- Node 3 is lagging (match_index 85 vs commit_index 100)
- May indicate network issues or slow node
- Leader will keep retrying replication
No Leader
- Cluster is in election
- No writes possible until leader elected
- Check for network partitions
Split Brain (Should Not Happen)
- Raft prevents this with term numbers
- If observed, indicates a serious bug
Monitoring and Alerting
Critical Alerts
- No leader for > 30 seconds
- Cluster size mismatch across nodes
- Replication lag > 1000 entries
- Frequent term changes (election storm)
Warning Alerts
- last_applied behind commit_index by > 100
- Peer match_index lagging by > 500 entries
- State is Candidate for > 5 seconds
Dashboards
Key metrics to graph:- current_term (leader elections)
- commit_index (write throughput)
- match_index per peer (replication health)
- State transitions (Leader/Follower/Candidate)
Metadata vs. Data
Important: METRICS shows metadata consensus only:- Topic registrations
- Segment rollovers
- Leader assignments
- Node membership
- Data write throughput
- Entry counts per topic (use STATE)
- Storage usage
- Client connection counts