From 2a90198495f86d7a77ccc7ff3d5570dede4f0d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 Jul 2022 09:07:31 +0200 Subject: [PATCH] fix(stats): display memory as IEC size --- CHANGELOG.md | 1 + apps/stats.go | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 314b94a18..35ca56464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### To be Released +* fix(stats): display memory as IEC size [#742](https://github.com/Scalingo/cli/pull/742) * fix(autoscalers): min containers cannot be 1 [#741](https://github.com/Scalingo/cli/pull/741) * refactor(run_unix): replace github.com/heroku/hk/term with golang.org/x/term [#740](https://github.com/Scalingo/cli/pull/740) * build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.8.0 diff --git a/apps/stats.go b/apps/stats.go index 1fa146996..99a0dbc25 100644 --- a/apps/stats.go +++ b/apps/stats.go @@ -5,7 +5,7 @@ import ( "os" "time" - humanize "github.com/dustin/go-humanize" + "github.com/dustin/go-humanize" "github.com/olekukonko/tablewriter" "gopkg.in/errgo.v1" @@ -71,20 +71,20 @@ func displayStatsTable(stats []*scalingo.ContainerStat) error { fmt.Sprintf( "%2d%% %v/%v", int(float64(s.MemoryUsage)/float64(s.MemoryLimit)*100), - humanize.Bytes(uint64(s.MemoryUsage)), - humanize.Bytes(uint64(s.MemoryLimit)), + humanize.IBytes(uint64(s.MemoryUsage)), + humanize.IBytes(uint64(s.MemoryLimit)), ), fmt.Sprintf( "%2d%% %v/%v", int(float64(s.SwapUsage)/float64(s.SwapLimit)*100), - humanize.Bytes(uint64(s.SwapUsage)), - humanize.Bytes(uint64(s.SwapLimit)), + humanize.IBytes(uint64(s.SwapUsage)), + humanize.IBytes(uint64(s.SwapLimit)), ), }) t.Append([]string{ "", "", - fmt.Sprintf("Highest: %v", humanize.Bytes(uint64(s.HighestMemoryUsage))), - fmt.Sprintf("Highest: %v", humanize.Bytes(uint64(s.HighestSwapUsage))), + fmt.Sprintf("Highest: %v", humanize.IBytes(uint64(s.HighestMemoryUsage))), + fmt.Sprintf("Highest: %v", humanize.IBytes(uint64(s.HighestSwapUsage))), }) if i != len(stats)-1 { t.Append([]string{"", "", "", ""})