Skip to content

Commit

Permalink
fix(stats): display memory as IEC size
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneM committed Jul 22, 2022
1 parent a9b0fb6 commit 2a90198
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions apps/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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{"", "", "", ""})
Expand Down

0 comments on commit 2a90198

Please sign in to comment.