Skip to content

Commit 37b6e6f

Browse files
committed
phrase notification more intuitively
mixing % full and bytes free in one sentence is confusing 7% full - 1.8GB/2.0GB (free/total) The meaning of the usage number (free) is further away from the actual number. 7% full - 0.2GB/2.0GB (used/total) reads more intuitively
1 parent dda1f14 commit 37b6e6f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

slack/slack.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func formatMessage(r usage.Report, host string) []slack.Block {
5656
var sb strings.Builder
5757
for _, l := range r.Limits {
5858
perc := uint64((float64(l.Used) / float64(l.Total)) * 100)
59-
fmt.Fprintf(&sb, "• %q - *%d%% full* - %s/%s (free/total)\n", l.Path, perc, humanize.Bytes(l.Free), humanize.Bytes(l.Total))
59+
fmt.Fprintf(&sb, "• %q - *%d%% full* - %s/%s (used/total)\n", l.Path, perc, humanize.Bytes(l.Used), humanize.Bytes(l.Total))
6060
}
6161
limits := slack.NewTextBlockObject("mrkdwn", sb.String(), false, false)
6262
limitSection := slack.NewContextBlock("limits", limitHeader, limits)

slack/testdata/slack-message.snapshot

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"type": "mrkdwn",
23-
"text": "• \"/mnt/volume1\" - *50% full* - 2.5 GB/5.0 GB (free/total)\n• \"/mnt/volume2\" - *90% full* - 500 MB/5.0 GB (free/total)\n"
23+
"text": "• \"/mnt/volume1\" - *50% full* - 2.5 GB/5.0 GB (used/total)\n• \"/mnt/volume2\" - *90% full* - 4.5 GB/5.0 GB (used/total)\n"
2424
}
2525
]
2626
},

0 commit comments

Comments
 (0)