mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: log snapshot download
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
This commit is contained in:
parent
188c66ada8
commit
cac53867ac
@ -264,6 +264,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// save incoming database snapshot.
|
// save incoming database snapshot.
|
||||||
|
|
||||||
n, err := h.snapshotter.SaveDBFrom(r.Body, m.Snapshot.Metadata.Index)
|
n, err := h.snapshotter.SaveDBFrom(r.Body, m.Snapshot.Metadata.Index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := fmt.Sprintf("failed to save KV snapshot (%v)", err)
|
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))
|
receivedBytes.WithLabelValues(from).Add(float64(n))
|
||||||
|
|
||||||
|
downloadTook := time.Since(start)
|
||||||
h.lg.Info(
|
h.lg.Info(
|
||||||
"received and saved database snapshot",
|
"received and saved database snapshot",
|
||||||
zap.String("local-member-id", h.localID.String()),
|
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.Uint64("incoming-snapshot-index", m.Snapshot.Metadata.Index),
|
||||||
zap.Int64("incoming-snapshot-size-bytes", n),
|
zap.Int64("incoming-snapshot-size-bytes", n),
|
||||||
zap.String("incoming-snapshot-size", humanize.Bytes(uint64(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 {
|
if err := h.r.Process(context.TODO(), m); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user