mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #17204 from rahulbapumore/branch1
mvcc: Printing etcd backend database related metrics inside scheduleCompaction function
This commit is contained in:
commit
4bc55e5208
@ -19,6 +19,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
humanize "github.com/dustin/go-humanize"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"go.etcd.io/etcd/server/v3/storage/schema"
|
"go.etcd.io/etcd/server/v3/storage/schema"
|
||||||
@ -66,11 +67,16 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal
|
|||||||
tx.Unlock()
|
tx.Unlock()
|
||||||
// gofail: var compactAfterSetFinishedCompact struct{}
|
// gofail: var compactAfterSetFinishedCompact struct{}
|
||||||
hash := h.Hash()
|
hash := h.Hash()
|
||||||
|
size, sizeInUse := s.b.Size(), s.b.SizeInUse()
|
||||||
s.lg.Info(
|
s.lg.Info(
|
||||||
"finished scheduled compaction",
|
"finished scheduled compaction",
|
||||||
zap.Int64("compact-revision", compactMainRev),
|
zap.Int64("compact-revision", compactMainRev),
|
||||||
zap.Duration("took", time.Since(totalStart)),
|
zap.Duration("took", time.Since(totalStart)),
|
||||||
zap.Uint32("hash", hash.Hash),
|
zap.Uint32("hash", hash.Hash),
|
||||||
|
zap.Int64("current-db-size-bytes", size),
|
||||||
|
zap.String("current-db-size", humanize.Bytes(uint64(size))),
|
||||||
|
zap.Int64("current-db-size-in-use-bytes", sizeInUse),
|
||||||
|
zap.String("current-db-size-in-use", humanize.Bytes(uint64(sizeInUse))),
|
||||||
)
|
)
|
||||||
return hash, nil
|
return hash, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user