mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
feat(metrics): enable some metrics; push to graphite
* -trace flag controls whether or not to enable metrics-gathering and the /debug/* HTTP endpoints * -graphite-host flag controls where metrics should be sent * timer.ae.handle metric tracks execution time of AppendEntriesRequest
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
etcdErr "github.com/coreos/etcd/error"
|
||||
"github.com/coreos/etcd/log"
|
||||
@@ -49,6 +50,7 @@ func (ps *PeerServer) VoteHttpHandler(w http.ResponseWriter, req *http.Request)
|
||||
|
||||
// Response to append entries request
|
||||
func (ps *PeerServer) AppendEntriesHttpHandler(w http.ResponseWriter, req *http.Request) {
|
||||
start := time.Now()
|
||||
aereq := &raft.AppendEntriesRequest{}
|
||||
|
||||
if _, err := aereq.Decode(req.Body); err != nil {
|
||||
@@ -78,6 +80,8 @@ func (ps *PeerServer) AppendEntriesHttpHandler(w http.ResponseWriter, req *http.
|
||||
http.Error(w, "", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
(*ps.metrics).Timer("timer.appendentries.handle").UpdateSince(start)
|
||||
}
|
||||
|
||||
// Response to recover from snapshot request
|
||||
|
||||
Reference in New Issue
Block a user