mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: drop use of humanize.Time() in favour of time.Duration.String()
humanize.Time() drops precision resulting in some events reporting they took "now" time to complete. Using time.Duration.String() results in accurate duration being reported. Fixes #13905
This commit is contained in:
parent
3dce38085d
commit
4c8ef011e0
@ -65,7 +65,7 @@ func SaveWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, d
|
||||
}
|
||||
lg.Info("created temporary db file", zap.String("path", partpath))
|
||||
|
||||
now := time.Now()
|
||||
start := time.Now()
|
||||
resp, err := cli.SnapshotWithVersion(ctx)
|
||||
if err != nil {
|
||||
return resp.Version, err
|
||||
@ -89,7 +89,7 @@ func SaveWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, d
|
||||
lg.Info("fetched snapshot",
|
||||
zap.String("endpoint", cfg.Endpoints[0]),
|
||||
zap.String("size", humanize.Bytes(uint64(size))),
|
||||
zap.String("took", humanize.Time(now)),
|
||||
zap.String("took", time.Since(start).String()),
|
||||
zap.String("etcd-version", version),
|
||||
)
|
||||
|
||||
|
@ -184,7 +184,7 @@ func (ms *maintenanceServer) Snapshot(sr *pb.SnapshotRequest, srv pb.Maintenance
|
||||
ms.lg.Info("successfully sent database snapshot to client",
|
||||
zap.Int64("total-bytes", total),
|
||||
zap.String("size", size),
|
||||
zap.String("took", humanize.Time(start)),
|
||||
zap.String("took", time.Since(start).String()),
|
||||
zap.String("storage-version", storageVersion),
|
||||
)
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user