Skip to content

Commit

Permalink
fix: handling min-max in gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl committed Jun 5, 2024
1 parent ee50c0a commit 89d1beb
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,20 @@ func doPanel(t *testing.T, pathPrefix string, key gjson.Result, value gjson.Resu
// In case of gradient-gauge and percent(0.0-1.0), we must override min and max value
for _, properties := range propertiesMap {
displayMode := properties["custom.displayMode"]
if properties["unit"] == "percentunit" && (displayMode == "gradient-gauge" || displayMode == "lcd-gauge" || displayMode == "basic") {
if (properties["unit"] == "percentunit" || defaultUnit == "percentunit") && (displayMode == "gradient-gauge" || displayMode == "lcd-gauge" || displayMode == "basic") {
if maxVal, exist := properties["max"]; !exist || maxVal != "1" {
t.Errorf("dashboard=%s, title=%s should have max value 1", sPath, title)
}
if minVal, exist := properties["min"]; !exist || minVal != "0" {
t.Errorf("dashboard=%s, title=%s should have min value 0", sPath, title)
}
} else if (properties["unit"] == "percent" || defaultUnit == "percent") && (displayMode == "gradient-gauge" || displayMode == "lcd-gauge" || displayMode == "basic") {
if maxVal, exist := properties["max"]; !exist || maxVal != "100" {
t.Errorf("dashboard=%s, title=%s should have max value 100", sPath, title)
}
if minVal, exist := properties["min"]; !exist || minVal != "0" {
t.Errorf("dashboard=%s, title=%s should have min value 0", sPath, title)
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions grafana/dashboards/cmode-details/volumeDeepDive.json
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,10 @@
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions grafana/dashboards/cmode/aggregate.json
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "thresholds",
"value": {
Expand Down
13 changes: 12 additions & 1 deletion grafana/dashboards/cmode/disk.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@
},
"decimals": 2,
"mappings": [],
"max": 100,
"thresholds": {
"mode": "absolute",
"steps": [
Expand Down Expand Up @@ -519,6 +518,14 @@
{
"id": "displayName",
"value": "capacity used"
},
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down Expand Up @@ -822,6 +829,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "decimals",
"value": 3
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 @@ -496,6 +496,10 @@
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down
8 changes: 8 additions & 0 deletions grafana/dashboards/cmode/health.json
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,10 @@
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down Expand Up @@ -2459,6 +2463,10 @@
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down
20 changes: 20 additions & 0 deletions grafana/dashboards/cmode/volume.json
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,10 @@
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down Expand Up @@ -7985,6 +7989,14 @@
{
"id": "custom.displayMode",
"value": "gradient-gauge"
},
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down Expand Up @@ -8027,6 +8039,14 @@
{
"id": "custom.displayMode",
"value": "gradient-gauge"
},
{
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
}
]
},
Expand Down
16 changes: 16 additions & 0 deletions grafana/dashboards/cmode/workload.json
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "decimals",
"value": 2
Expand Down Expand Up @@ -1437,6 +1441,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "decimals",
"value": 2
Expand Down Expand Up @@ -1855,6 +1863,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "decimals",
"value": 2
Expand Down Expand Up @@ -2074,6 +2086,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "decimals",
"value": 2
Expand Down
4 changes: 4 additions & 0 deletions grafana/dashboards/storagegrid/fabricpool.json
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@
"id": "max",
"value": 100
},
{
"id": "min",
"value": 0
},
{
"id": "thresholds",
"value": {
Expand Down

0 comments on commit 89d1beb

Please sign in to comment.