From e83b53bbd5e775f9e521c8823f61270dc6f9a09d Mon Sep 17 00:00:00 2001 From: Rahul Date: Sat, 6 Apr 2024 01:12:16 +0530 Subject: [PATCH] fix: iops should not have decimals in dashboards (#2810) * fix: iops should not have decimals in dashboards --- cmd/tools/grafana/dashboard_test.go | 29 +++++++++++++++++++ grafana/dashboards/cmode/aggregate.json | 3 ++ grafana/dashboards/cmode/cdot.json | 5 ++++ grafana/dashboards/cmode/cluster.json | 3 ++ grafana/dashboards/cmode/datacenter.json | 1 + .../cmode/details/volumeDeepDive.json | 3 ++ grafana/dashboards/cmode/flexgroup.json | 4 +++ grafana/dashboards/cmode/headroom.json | 8 +++++ grafana/dashboards/cmode/lun.json | 6 ++++ grafana/dashboards/cmode/mcc_cluster.json | 8 +++++ grafana/dashboards/cmode/namespace.json | 2 ++ grafana/dashboards/cmode/node.json | 9 ++++++ grafana/dashboards/cmode/power.json | 1 + grafana/dashboards/cmode/qtree.json | 4 +++ grafana/dashboards/cmode/smb.json | 2 ++ grafana/dashboards/cmode/svm.json | 18 ++++++++++++ grafana/dashboards/cmode/volume.json | 10 +++++++ grafana/dashboards/cmode/workload.json | 4 +++ 18 files changed, 120 insertions(+) diff --git a/cmd/tools/grafana/dashboard_test.go b/cmd/tools/grafana/dashboard_test.go index 711e1fb8f..9b23e497e 100644 --- a/cmd/tools/grafana/dashboard_test.go +++ b/cmd/tools/grafana/dashboard_test.go @@ -1145,6 +1145,35 @@ func asTitle(id string) string { return replacer.Replace(path) } +func TestIOPS(t *testing.T) { + VisitDashboards( + dashboards, + func(path string, data []byte) { + checkIOPSDecimal(t, path, data) + }) +} + +func checkIOPSDecimal(t *testing.T, path string, data []byte) { + dashPath := ShortPath(path) + + VisitAllPanels(data, func(path string, _, value gjson.Result) { + panelType := value.Get("type").String() + if panelType != "timeseries" { + return + } + defaultUnit := value.Get("fieldConfig.defaults.unit").String() + if defaultUnit != "iops" { + return + } + decimals := value.Get("fieldConfig.defaults.decimals").String() + + if decimals != "0" { + t.Errorf(`dashboard=%s path=%s panel="%s", decimals should be 0 got=%s`, + dashPath, path, value.Get("title").String(), decimals) + } + }) +} + func TestPercentHasMinMax(t *testing.T) { VisitDashboards( dashboards, diff --git a/grafana/dashboards/cmode/aggregate.json b/grafana/dashboards/cmode/aggregate.json index 29f84d8f3..b671faca3 100644 --- a/grafana/dashboards/cmode/aggregate.json +++ b/grafana/dashboards/cmode/aggregate.json @@ -5287,6 +5287,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -5557,6 +5558,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -5824,6 +5826,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/cdot.json b/grafana/dashboards/cmode/cdot.json index 0c583f1da..38a2c8d69 100644 --- a/grafana/dashboards/cmode/cdot.json +++ b/grafana/dashboards/cmode/cdot.json @@ -124,6 +124,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -214,6 +215,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -304,6 +306,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1566,6 +1569,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1849,6 +1853,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/cluster.json b/grafana/dashboards/cmode/cluster.json index 9bbd08431..ffd7c61f2 100644 --- a/grafana/dashboards/cmode/cluster.json +++ b/grafana/dashboards/cmode/cluster.json @@ -1246,6 +1246,7 @@ "mode": "off" } }, + "decimals": 0, "links": [], "mappings": [], "min": 0, @@ -2829,6 +2830,7 @@ "mode": "off" } }, + "decimals": 0, "links": [], "mappings": [], "min": 0, @@ -4175,6 +4177,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/datacenter.json b/grafana/dashboards/cmode/datacenter.json index 5ceb77f41..25bca98dc 100644 --- a/grafana/dashboards/cmode/datacenter.json +++ b/grafana/dashboards/cmode/datacenter.json @@ -1865,6 +1865,7 @@ "mode": "off" } }, + "decimals": 0, "links": [], "mappings": [], "min": 0, diff --git a/grafana/dashboards/cmode/details/volumeDeepDive.json b/grafana/dashboards/cmode/details/volumeDeepDive.json index 0979d99c6..8fe2c5bce 100644 --- a/grafana/dashboards/cmode/details/volumeDeepDive.json +++ b/grafana/dashboards/cmode/details/volumeDeepDive.json @@ -627,6 +627,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -793,6 +794,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1133,6 +1135,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/flexgroup.json b/grafana/dashboards/cmode/flexgroup.json index 4fd953587..873f893c8 100644 --- a/grafana/dashboards/cmode/flexgroup.json +++ b/grafana/dashboards/cmode/flexgroup.json @@ -332,6 +332,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2088,6 +2089,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2179,6 +2181,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2270,6 +2273,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/headroom.json b/grafana/dashboards/cmode/headroom.json index 89cc0137e..a16cef43e 100644 --- a/grafana/dashboards/cmode/headroom.json +++ b/grafana/dashboards/cmode/headroom.json @@ -121,6 +121,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -204,6 +205,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -653,6 +655,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -920,6 +923,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1187,6 +1191,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1736,6 +1741,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2003,6 +2009,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2270,6 +2277,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/lun.json b/grafana/dashboards/cmode/lun.json index fc0305862..0165fc9b0 100644 --- a/grafana/dashboards/cmode/lun.json +++ b/grafana/dashboards/cmode/lun.json @@ -348,6 +348,7 @@ "description": "IOPs of top $TopResources volumes.", "fieldConfig": { "defaults": { + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -404,6 +405,7 @@ "description": "IOPs of top $TopResources volumes.", "fieldConfig": { "defaults": { + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1654,6 +1656,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1928,6 +1931,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2240,6 +2244,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -4149,6 +4154,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/mcc_cluster.json b/grafana/dashboards/cmode/mcc_cluster.json index 9bb0d61f2..32b6134d2 100644 --- a/grafana/dashboards/cmode/mcc_cluster.json +++ b/grafana/dashboards/cmode/mcc_cluster.json @@ -811,6 +811,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -1664,6 +1665,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -1757,6 +1759,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -1850,6 +1853,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -2295,6 +2299,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2391,6 +2396,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -3074,6 +3080,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -3353,6 +3360,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { diff --git a/grafana/dashboards/cmode/namespace.json b/grafana/dashboards/cmode/namespace.json index 868e047a3..857132e50 100644 --- a/grafana/dashboards/cmode/namespace.json +++ b/grafana/dashboards/cmode/namespace.json @@ -310,6 +310,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -584,6 +585,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/node.json b/grafana/dashboards/cmode/node.json index 6a905368a..78cb6367c 100644 --- a/grafana/dashboards/cmode/node.json +++ b/grafana/dashboards/cmode/node.json @@ -706,6 +706,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1384,6 +1385,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2305,6 +2307,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2653,6 +2656,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -3428,6 +3432,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -3673,6 +3678,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -4198,6 +4204,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -4614,6 +4621,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -5028,6 +5036,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/power.json b/grafana/dashboards/cmode/power.json index aee538253..5ed217c05 100644 --- a/grafana/dashboards/cmode/power.json +++ b/grafana/dashboards/cmode/power.json @@ -1310,6 +1310,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/qtree.json b/grafana/dashboards/cmode/qtree.json index d4468d177..a44a15173 100644 --- a/grafana/dashboards/cmode/qtree.json +++ b/grafana/dashboards/cmode/qtree.json @@ -122,6 +122,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -211,6 +212,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -302,6 +304,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -393,6 +396,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/smb.json b/grafana/dashboards/cmode/smb.json index d068bc1b3..944909ae9 100644 --- a/grafana/dashboards/cmode/smb.json +++ b/grafana/dashboards/cmode/smb.json @@ -551,6 +551,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -739,6 +740,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", diff --git a/grafana/dashboards/cmode/svm.json b/grafana/dashboards/cmode/svm.json index 3fc891e7f..217c6eb24 100644 --- a/grafana/dashboards/cmode/svm.json +++ b/grafana/dashboards/cmode/svm.json @@ -235,6 +235,7 @@ "color": { "mode": "thresholds" }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -889,6 +890,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1186,6 +1188,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1456,6 +1459,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -3991,6 +3995,7 @@ "color": { "mode": "thresholds" }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -4532,6 +4537,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -4631,6 +4637,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -5111,6 +5118,7 @@ "color": { "mode": "thresholds" }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -5774,6 +5782,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -8016,6 +8025,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -8212,6 +8222,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -9314,6 +9325,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -9512,6 +9524,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -10623,6 +10636,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -10829,6 +10843,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -11041,6 +11056,7 @@ "color": { "mode": "thresholds" }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -11705,6 +11721,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -12998,6 +13015,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { diff --git a/grafana/dashboards/cmode/volume.json b/grafana/dashboards/cmode/volume.json index 1cd338db1..4b9a3feef 100644 --- a/grafana/dashboards/cmode/volume.json +++ b/grafana/dashboards/cmode/volume.json @@ -230,6 +230,7 @@ "description": "IOPs of top $TopResources volumes.", "fieldConfig": { "defaults": { + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -499,6 +500,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1249,6 +1251,7 @@ "displayMode": "auto", "filterable": true }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -1616,6 +1619,7 @@ "displayMode": "auto", "filterable": true }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2038,6 +2042,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2129,6 +2134,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2220,6 +2226,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2591,6 +2598,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", @@ -2899,6 +2907,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -2990,6 +2999,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { diff --git a/grafana/dashboards/cmode/workload.json b/grafana/dashboards/cmode/workload.json index 4470f25b2..1a818d0cf 100644 --- a/grafana/dashboards/cmode/workload.json +++ b/grafana/dashboards/cmode/workload.json @@ -163,6 +163,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -250,6 +251,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -337,6 +339,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": { @@ -424,6 +427,7 @@ "mode": "off" } }, + "decimals": 0, "mappings": [], "min": 0, "thresholds": {