|
|
@ -16,6 +16,7 @@ import (
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"sort"
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
@ -430,9 +431,16 @@ func (s *Store) Stats() (map[string]interface{}, error) {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
raftStats := s.raft.Stats()
|
|
|
|
|
|
|
|
ls, err := s.logSize()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
raftStats["log_size"] = strconv.FormatInt(ls, 10)
|
|
|
|
|
|
|
|
|
|
|
|
status := map[string]interface{}{
|
|
|
|
status := map[string]interface{}{
|
|
|
|
"node_id": s.raftID,
|
|
|
|
"node_id": s.raftID,
|
|
|
|
"raft": s.raft.Stats(),
|
|
|
|
"raft": raftStats,
|
|
|
|
"addr": s.Addr(),
|
|
|
|
"addr": s.Addr(),
|
|
|
|
"leader": map[string]string{
|
|
|
|
"leader": map[string]string{
|
|
|
|
"node_id": leaderID,
|
|
|
|
"node_id": leaderID,
|
|
|
|