mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
commit
ae1f3d5640
@ -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) SnapDir() string { return path.Join(c.DataDir, "snap") }
|
||||||
|
|
||||||
func (c *ServerConfig) ShouldDiscover() bool {
|
func (c *ServerConfig) ShouldDiscover() bool { return c.DiscoveryURL != "" }
|
||||||
return c.DiscoveryURL != ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ServerConfig) PrintWithInitial() {
|
func (c *ServerConfig) PrintWithInitial() { c.print(true) }
|
||||||
c.print(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ServerConfig) Print() {
|
func (c *ServerConfig) Print() { c.print(false) }
|
||||||
c.print(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ServerConfig) print(initial bool) {
|
func (c *ServerConfig) print(initial bool) {
|
||||||
log.Printf("etcdserver: name = %s", c.Name)
|
log.Printf("etcdserver: name = %s", c.Name)
|
||||||
|
@ -35,6 +35,7 @@ import (
|
|||||||
"github.com/coreos/etcd/etcdserver"
|
"github.com/coreos/etcd/etcdserver"
|
||||||
"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
|
"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
|
||||||
"github.com/coreos/etcd/etcdserver/etcdserverpb"
|
"github.com/coreos/etcd/etcdserver/etcdserverpb"
|
||||||
|
"github.com/coreos/etcd/etcdserver/stats"
|
||||||
"github.com/coreos/etcd/pkg/types"
|
"github.com/coreos/etcd/pkg/types"
|
||||||
"github.com/coreos/etcd/store"
|
"github.com/coreos/etcd/store"
|
||||||
"github.com/coreos/etcd/version"
|
"github.com/coreos/etcd/version"
|
||||||
@ -236,7 +237,7 @@ func (h *membersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type statsHandler struct {
|
type statsHandler struct {
|
||||||
stats etcdserver.Stats
|
stats stats.Stats
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *statsHandler) serveStore(w http.ResponseWriter, r *http.Request) {
|
func (h *statsHandler) serveStore(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -135,16 +135,6 @@ type Server interface {
|
|||||||
UpdateMember(ctx context.Context, updateMemb Member) error
|
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 {
|
type RaftTimer interface {
|
||||||
Index() uint64
|
Index() uint64
|
||||||
Term() uint64
|
Term() uint64
|
||||||
|
11
etcdserver/stats/stats.go
Normal file
11
etcdserver/stats/stats.go
Normal 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
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user