Merge pull request #1925 from xiang90/stats

Stats
This commit is contained in:
Xiang Li 2014-12-12 10:17:12 -08:00
commit ae1f3d5640
4 changed files with 16 additions and 20 deletions

View File

@ -85,17 +85,11 @@ func (c *ServerConfig) WALDir() string { return path.Join(c.DataDir, "wal") }
func (c *ServerConfig) SnapDir() string { return path.Join(c.DataDir, "snap") }
func (c *ServerConfig) ShouldDiscover() bool {
return c.DiscoveryURL != ""
}
func (c *ServerConfig) ShouldDiscover() bool { return c.DiscoveryURL != "" }
func (c *ServerConfig) PrintWithInitial() {
c.print(true)
}
func (c *ServerConfig) PrintWithInitial() { c.print(true) }
func (c *ServerConfig) Print() {
c.print(false)
}
func (c *ServerConfig) Print() { c.print(false) }
func (c *ServerConfig) print(initial bool) {
log.Printf("etcdserver: name = %s", c.Name)

View File

@ -35,6 +35,7 @@ import (
"github.com/coreos/etcd/etcdserver"
"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
"github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/etcdserver/stats"
"github.com/coreos/etcd/pkg/types"
"github.com/coreos/etcd/store"
"github.com/coreos/etcd/version"
@ -236,7 +237,7 @@ func (h *membersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
type statsHandler struct {
stats etcdserver.Stats
stats stats.Stats
}
func (h *statsHandler) serveStore(w http.ResponseWriter, r *http.Request) {

View File

@ -135,16 +135,6 @@ type Server interface {
UpdateMember(ctx context.Context, updateMemb Member) error
}
type Stats interface {
// SelfStats returns the struct representing statistics of this server
SelfStats() []byte
// LeaderStats returns the statistics of all followers in the cluster
// if this server is leader. Otherwise, nil is returned.
LeaderStats() []byte
// StoreStats returns statistics of the store backing this EtcdServer
StoreStats() []byte
}
type RaftTimer interface {
Index() uint64
Term() uint64

11
etcdserver/stats/stats.go Normal file
View File

@ -0,0 +1,11 @@
package stats
type Stats interface {
// SelfStats returns the struct representing statistics of this server
SelfStats() []byte
// LeaderStats returns the statistics of all followers in the cluster
// if this server is leader. Otherwise, nil is returned.
LeaderStats() []byte
// StoreStats returns statistics of the store backing this EtcdServer
StoreStats() []byte
}