Browse Source

Merge pull request #2591 from kelseyhightower/cleanup-etcdserver-stats

etcdserver: add stats.FollowerLatencyStats and stats.FollowerCountsStats...
Kelsey Hightower 10 years ago
parent
commit
a16d15aafc
1 changed files with 18 additions and 13 deletions
  1. 18 13
      etcdserver/stats/leader.go

+ 18 - 13
etcdserver/stats/leader.go

@@ -66,23 +66,28 @@ func (ls *LeaderStats) Follower(name string) *FollowerStats {
 
 // FollowerStats encapsulates various statistics about a follower in an etcd cluster
 type FollowerStats struct {
-	Latency struct {
-		Current           float64 `json:"current"`
-		Average           float64 `json:"average"`
-		averageSquare     float64
-		StandardDeviation float64 `json:"standardDeviation"`
-		Minimum           float64 `json:"minimum"`
-		Maximum           float64 `json:"maximum"`
-	} `json:"latency"`
-
-	Counts struct {
-		Fail    uint64 `json:"fail"`
-		Success uint64 `json:"success"`
-	} `json:"counts"`
+	Latency LatencyStats `json:"latency"`
+	Counts  CountsStats  `json:"counts"`
 
 	sync.Mutex
 }
 
+// LatencyStats encapsulates latency statistics.
+type LatencyStats struct {
+	Current           float64 `json:"current"`
+	Average           float64 `json:"average"`
+	averageSquare     float64
+	StandardDeviation float64 `json:"standardDeviation"`
+	Minimum           float64 `json:"minimum"`
+	Maximum           float64 `json:"maximum"`
+}
+
+// CountsStats encapsulates raft statistics.
+type CountsStats struct {
+	Fail    uint64 `json:"fail"`
+	Success uint64 `json:"success"`
+}
+
 // Succ updates the FollowerStats with a successful send
 func (fs *FollowerStats) Succ(d time.Duration) {
 	fs.Lock()