Skip to content

Commit

Permalink
fix: iops should not have decimals in dashboards (#2810)
Browse files Browse the repository at this point in the history
* fix: iops should not have decimals in dashboards
  • Loading branch information
rahulguptajss committed Apr 5, 2024
1 parent 8db502a commit e83b53b
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 0 deletions.
29 changes: 29 additions & 0 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions grafana/dashboards/cmode/aggregate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5287,6 +5287,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -5557,6 +5558,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -5824,6 +5826,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
5 changes: 5 additions & 0 deletions grafana/dashboards/cmode/cdot.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -214,6 +215,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -304,6 +306,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1566,6 +1569,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1849,6 +1853,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
3 changes: 3 additions & 0 deletions grafana/dashboards/cmode/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@
"mode": "off"
}
},
"decimals": 0,
"links": [],
"mappings": [],
"min": 0,
Expand Down Expand Up @@ -2829,6 +2830,7 @@
"mode": "off"
}
},
"decimals": 0,
"links": [],
"mappings": [],
"min": 0,
Expand Down Expand Up @@ -4175,6 +4177,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
1 change: 1 addition & 0 deletions grafana/dashboards/cmode/datacenter.json
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,7 @@
"mode": "off"
}
},
"decimals": 0,
"links": [],
"mappings": [],
"min": 0,
Expand Down
3 changes: 3 additions & 0 deletions grafana/dashboards/cmode/details/volumeDeepDive.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -793,6 +794,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1133,6 +1135,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
4 changes: 4 additions & 0 deletions grafana/dashboards/cmode/flexgroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2088,6 +2089,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2179,6 +2181,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2270,6 +2273,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
8 changes: 8 additions & 0 deletions grafana/dashboards/cmode/headroom.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -204,6 +205,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -653,6 +655,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -920,6 +923,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1187,6 +1191,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1736,6 +1741,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2003,6 +2009,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2270,6 +2277,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
6 changes: 6 additions & 0 deletions grafana/dashboards/cmode/lun.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
"description": "IOPs of top $TopResources volumes.",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -404,6 +405,7 @@
"description": "IOPs of top $TopResources volumes.",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1654,6 +1656,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -1928,6 +1931,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2240,6 +2244,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -4149,6 +4154,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
8 changes: 8 additions & 0 deletions grafana/dashboards/cmode/mcc_cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
Expand Down Expand Up @@ -1664,6 +1665,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
Expand Down Expand Up @@ -1757,6 +1759,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
Expand Down Expand Up @@ -1850,6 +1853,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
Expand Down Expand Up @@ -2295,6 +2299,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -2391,6 +2396,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -3074,6 +3080,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
Expand Down Expand Up @@ -3353,6 +3360,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
Expand Down
2 changes: 2 additions & 0 deletions grafana/dashboards/cmode/namespace.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down Expand Up @@ -584,6 +585,7 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
Expand Down
Loading

0 comments on commit e83b53b

Please sign in to comment.