Skip to content

Commit

Permalink
storepool: limit storelist string to 2 decimals
Browse files Browse the repository at this point in the history
The store list string returned the mean leases, ranges and
queries-per-second float values without limiting the number of decimal
places. This led to log lines with needlessly long decimals:

`avg-ranges=40.66666666666667... avg-leases=10.166666666666666...`

This commit updates the store list string formatting to 2 decimal
places for float values.

Release note: None
  • Loading branch information
kvoli committed May 30, 2023
1 parent d56c6ee commit 79d9008
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/allocator/storepool/store_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ func MakeStoreList(descriptors []roachpb.StoreDescriptor) StoreList {
func (sl StoreList) String() string {
var buf bytes.Buffer
fmt.Fprintf(&buf,
" candidate: avg-ranges=%v avg-leases=%v avg-disk-usage=%v avg-queries-per-second=%v avg-store-cpu-per-second=%v",
" candidate: avg-ranges=%.2f avg-leases=%.2f avg-disk-usage=%s avg-queries-per-second=%.2f avg-store-cpu-per-second=%s",
sl.CandidateRanges.Mean,
sl.CandidateLeases.Mean,
humanizeutil.IBytes(int64(sl.candidateLogicalBytes.Mean)),
Expand Down

0 comments on commit 79d9008

Please sign in to comment.