Skip to content

Commit

Permalink
throughput metric: remove residual "mbps"; fix python lint
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Aizman <[email protected]>
VirrageS authored and alex-aizman committed Jan 29, 2025
1 parent 30f84fe commit 7fa4c06
Showing 7 changed files with 10 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bench/tools/aisloader-composer/consolidate_results.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Python script designed to analyze and amalgamate the data from
Python script designed to analyze and amalgamate the data from
AIS Loader-generated files into a cohesive report
Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
2 changes: 1 addition & 1 deletion python/pyaisloader/pyaisloader/benchmark.py
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ def __prepopulate_h(self, objs_created, prefix, suffix):

def clean_up(self, new=True):
if new:
print_in_progress("Cleaning up", "\U0001F9F9")
print_in_progress("Cleaning up", "\U0001f9f9")

if not self.bck_created and not self.objs_created:
print_caution("Nothing to delete! Skipping clean-up...")
2 changes: 1 addition & 1 deletion python/pyaisloader/pyaisloader/utils/cli_utils.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ def print_sep():
print("\n" + "=" * 101 + "\n")


def print_in_progress(msg, icon="\U0001F552"):
def print_in_progress(msg, icon="\U0001f552"):
print(
"\n"
+ Back.LIGHTBLACK_EX
2 changes: 1 addition & 1 deletion python/pyaisloader/pyaisloader/utils/print_utils.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ def confirm_continue():
confirm_continue()


def print_in_progress(msg, icon="\U0001F552"):
def print_in_progress(msg, icon="\U0001f552"):
print(
"\n"
+ Back.LIGHTBLACK_EX
2 changes: 1 addition & 1 deletion stats/common_prom.go
Original file line number Diff line number Diff line change
@@ -198,7 +198,7 @@ func (r *runner) reg(snode *meta.Snode, name, kind string, extra *Extra) {
metricName = strings.TrimSuffix(name, ".ns") + "_ms"
case KindThroughput, KindComputedThroughput:
debug.Assert(strings.HasSuffix(name, ".bps"), name)
metricName = strings.TrimSuffix(name, ".bps") + "_mbps"
metricName = strings.TrimSuffix(name, ".bps") + "_bps"
default:
metricName = name
}
19 changes: 3 additions & 16 deletions stats/common_statsd.go
Original file line number Diff line number Diff line change
@@ -150,15 +150,13 @@ func (s *coreStats) copyT(out copyTracker, diskLowUtil ...int64) bool {
}
out[name] = copyValue{throughput}
if !s.statsdDisabled() && throughput > 0 {
fv := roundMBs(throughput)
s.statsdC.AppMetric(metric{Type: statsd.Gauge, Name: v.label.stpr, Value: fv}, s.sgl)
s.statsdC.AppMetric(metric{Type: statsd.Gauge, Name: v.label.stpr, Value: throughput}, s.sgl)
}
case KindComputedThroughput:
if throughput := ratomic.SwapInt64(&v.Value, 0); throughput > 0 {
out[name] = copyValue{throughput}
if !s.statsdDisabled() {
fv := roundMBs(throughput)
s.statsdC.AppMetric(metric{Type: statsd.Gauge, Name: v.label.stpr, Value: fv}, s.sgl)
s.statsdC.AppMetric(metric{Type: statsd.Gauge, Name: v.label.stpr, Value: throughput}, s.sgl)
}
}
case KindCounter, KindSize, KindTotal:
@@ -292,7 +290,7 @@ func (r *runner) reg(snode *meta.Snode, name, kind string, _ *Extra) {
case KindThroughput, KindComputedThroughput:
debug.Assert(strings.HasSuffix(name, ".bps"), name)
v.label.comm = strings.TrimSuffix(name, ".bps")
v.label.stpr = f("mbps")
v.label.stpr = f("bps")
default:
debug.Assert(kind == KindGauge || kind == KindSpecial)
v.label.comm = name
@@ -310,14 +308,3 @@ func (r *runner) reg(snode *meta.Snode, name, kind string, _ *Extra) {
func (*runner) PromHandler() http.Handler { return nil }

func (r *runner) closeStatsD() { r.core.statsdC.Close() }

// convert bytes to meGabytes with a fixed rounding precision = 2 digits
// - KindThroughput and KindComputedThroughput only
// - MB, not MiB
// - math.Ceil wouldn't produce two decimals
func roundMBs(val int64) (mbs float64) {
mbs = float64(val) / 1000 / 10
num := int(mbs + 0.5)
mbs = float64(num) / 100
return
}
4 changes: 2 additions & 2 deletions stats/target_stats.go
Original file line number Diff line number Diff line change
@@ -489,13 +489,13 @@ func (r *Trunner) RegDiskMetrics(snode *meta.Snode, disk string) {

// "disk.<DISK>.<METRIC> (e.g.: "disk.nvme0n1.read.bps")
r.reg(snode, name, KindComputedThroughput,
&Extra{Help: "read bandwidth (MB/s)", StrName: "disk_read_mbps", Labels: cos.StrKVs{"disk": disk}},
&Extra{Help: "read bandwidth (B/s)", StrName: "disk_read_bps", Labels: cos.StrKVs{"disk": disk}},
)
r.reg(snode, r.nameRavg(disk), KindGauge,
&Extra{Help: "average read size (bytes)", StrName: "disk_avg_rsize", Labels: cos.StrKVs{"disk": disk}},
)
r.reg(snode, r.nameWbps(disk), KindComputedThroughput,
&Extra{Help: "write bandwidth (MB/s)", StrName: "disk_write_mbps", Labels: cos.StrKVs{"disk": disk}},
&Extra{Help: "write bandwidth (B/s)", StrName: "disk_write_bps", Labels: cos.StrKVs{"disk": disk}},
)
r.reg(snode, r.nameWavg(disk), KindGauge,
&Extra{Help: "average write size (bytes)", StrName: "disk_avg_wsize", Labels: cos.StrKVs{"disk": disk}},

0 comments on commit 7fa4c06

Please sign in to comment.