Skip to content

Commit

Permalink
Merge pull request #2513 from buildkite/humanize-bytes-to-base-2-not-…
Browse files Browse the repository at this point in the history
…base-10

Humanize bytes to IEC (1024 → KiB etc) not SI (1000 → KB etc)
  • Loading branch information
pda authored Nov 23, 2023
2 parents 7599ab9 + 01ecc77 commit a0677de
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion agent/artifact_uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func (a *ArtifactUploader) upload(ctx context.Context, artifacts []*api.Artifact

p.Spawn(func() {
// Show a nice message that we're starting to upload the file
a.logger.Info("Uploading artifact %s %s (%s)", artifact.ID, artifact.Path, humanize.Bytes(uint64(artifact.FileSize)))
a.logger.Info("Uploading artifact %s %s (%s)", artifact.ID, artifact.Path, humanize.IBytes(uint64(artifact.FileSize)))

var state string

Expand Down
2 changes: 1 addition & 1 deletion agent/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (d Download) try(ctx context.Context) error {
return fmt.Errorf("Error when copying data %s (%T: %v)", d.conf.URL, err, err)
}

d.logger.Info("Successfully downloaded \"%s\" %s", d.conf.Path, humanize.Bytes(uint64(bytes)))
d.logger.Info("Successfully downloaded \"%s\" %s", d.conf.Path, humanize.IBytes(uint64(bytes)))

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion agent/log_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (ls *LogStreamer) Process(output []byte) {
"exceeded the maximum size (%s). Further logs may be dropped "+
"by the server, and a future version of the agent will stop "+
"sending logs at this point.",
humanize.Bytes(ls.bytes), humanize.Bytes(ls.conf.MaxSizeBytes))
humanize.IBytes(ls.bytes), humanize.IBytes(ls.conf.MaxSizeBytes))
ls.warnedAboutSize = true
// In a future version, this will error out, e.g.:
//return fmt.Errorf("job log has exceeded max job log size (%d > %d)", ls.bytes, ls.conf.MaxSizeBytes)
Expand Down

0 comments on commit a0677de

Please sign in to comment.