fix: adding monitoring

This commit is contained in:
2026-03-02 19:57:35 +07:00
parent c00df926a0
commit a9e36708e8
6 changed files with 301 additions and 60 deletions

16
internal/format.go Normal file
View File

@@ -0,0 +1,16 @@
package internal
import "fmt"
func FormatBytes(b uint64) string {
const unit = 1024
if b < unit {
return fmt.Sprintf("%d B", b)
}
div, exp := uint64(unit), 0
for n := b / unit; n >= unit; n /= unit {
div *= unit
exp++
}
return fmt.Sprintf("%.2f %cB", float64(b)/float64(div), "KMGTPE"[exp])
}