From cac53867acbce303e686a1aec1d7d3586b18f98d Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 20 May 2020 10:55:43 -0700 Subject: [PATCH] rafthttp: log snapshot download Signed-off-by: Gyuho Lee --- etcdserver/api/rafthttp/http.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etcdserver/api/rafthttp/http.go b/etcdserver/api/rafthttp/http.go index 2e394944f..98afdc698 100644 --- a/etcdserver/api/rafthttp/http.go +++ b/etcdserver/api/rafthttp/http.go @@ -264,6 +264,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ) // save incoming database snapshot. + n, err := h.snapshotter.SaveDBFrom(r.Body, m.Snapshot.Metadata.Index) if err != nil { msg := fmt.Sprintf("failed to save KV snapshot (%v)", err) @@ -281,6 +282,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { receivedBytes.WithLabelValues(from).Add(float64(n)) + downloadTook := time.Since(start) h.lg.Info( "received and saved database snapshot", zap.String("local-member-id", h.localID.String()), @@ -288,6 +290,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { zap.Uint64("incoming-snapshot-index", m.Snapshot.Metadata.Index), zap.Int64("incoming-snapshot-size-bytes", n), zap.String("incoming-snapshot-size", humanize.Bytes(uint64(n))), + zap.String("download-took", downloadTook.String()), ) if err := h.r.Process(context.TODO(), m); err != nil {