From f7f7505f609176a02ece2bfc862ab0e338b37474 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 14 Sep 2026 22:14:31 -0700 Subject: [PATCH] admin: step down latency units instead of rounding to 0 ms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SeaweedFS latency quantiles are frequently sub-millisecond, so a fixed millisecond format rendered every axis tick as '0 ms'. Use µs below 1 ms and add decimals below 10 ms. --- weed/admin/dash/chart.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/weed/admin/dash/chart.go b/weed/admin/dash/chart.go index 922f92b82..219f760f1 100644 --- a/weed/admin/dash/chart.go +++ b/weed/admin/dash/chart.go @@ -186,10 +186,20 @@ func FormatChartValue(v float64, unit string) string { case UnitBytesPS: return formatChartBytes(v) + "/s" case UnitSeconds: - if v < 1 { - return fmt.Sprintf("%.0f ms", v*1000) + // Latency quantiles are often sub-millisecond, so step down the unit + // rather than rounding everything to "0 ms". + switch { + case v == 0: + return "0" + case v < 0.001: + return fmt.Sprintf("%.0f µs", v*1e6) + case v < 0.01: + return fmt.Sprintf("%.2f ms", v*1000) + case v < 1: + return fmt.Sprintf("%.1f ms", v*1000) + default: + return fmt.Sprintf("%.2f s", v) } - return fmt.Sprintf("%.2f s", v) case UnitPercent: return fmt.Sprintf("%.0f%%", v) default: