Skip to content

Commit

Permalink
fix: update datacenter and cluster variables in dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulguptajss authored and cgrinds committed Oct 24, 2024
1 parent 995c381 commit 607db7c
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 92 deletions.
30 changes: 22 additions & 8 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ var dashboards = []string{
"../../../grafana/dashboards/storagegrid",
}

var cDotDashboards = []string{
"../../../grafana/dashboards/cmode",
"../../../grafana/dashboards/cmode-details",
}

var throughputPattern = regexp.MustCompile(`(throughput|read_data|write_data|total_data)`)
var aggregationThroughputPattern = regexp.MustCompile(`(?i)(\w+)\(`)

Expand Down Expand Up @@ -1631,13 +1636,19 @@ func checkDescription(t *testing.T, path string, data []byte, count *int) {
}

func TestFSxFriendlyVariables(t *testing.T) {
VisitDashboards(dashboards,
VisitDashboards(cDotDashboards,
func(path string, data []byte) {
checkVariablesAreFSxFriendly(t, path, data)
})
}

func checkVariablesAreFSxFriendly(t *testing.T, path string, data []byte) {

exceptionValues := map[string]bool{
"cmode/metadata.json": true,
"cmode/snapmirror_destinations.json": true,
}

gjson.GetBytes(data, "templating.list").ForEach(func(key, value gjson.Result) bool {
// Only consider query variables
if value.Get("type").String() != "query" {
Expand All @@ -1648,18 +1659,21 @@ func checkVariablesAreFSxFriendly(t *testing.T, path string, data []byte) {
definition := value.Get("definition").String()
varName := value.Get("name").String()

if varName != "Cluster" && varName != "Datacenter" {
sPath := ShortPath(path)
isExceptionPath := exceptionValues[sPath]

if isExceptionPath || (varName != "Cluster" && varName != "Datacenter") {
return true
}

if strings.Contains(query, "node_labels") {
t.Errorf(`dashboard=%s path=templating.list[%s] variable="%s" has "node_labels" in query. Use "cluster_new_status" instead.`,
ShortPath(path), key.String(), varName)
if !strings.Contains(query, "cluster_new_status") {
t.Errorf(`dashboard=%s path=templating.list[%s] variable="%s" does not have "cluster_new_status" in query. Found "%s" instead.`,
sPath, key.String(), varName, definition)
}

if strings.Contains(definition, "node_labels") {
t.Errorf(`dashboard=%s path=templating.list[%s] variable="%s" has "node_labels" in definition. Use "cluster_new_status" instead.`,
ShortPath(path), key.String(), varName)
if !strings.Contains(definition, "cluster_new_status") {
t.Errorf(`dashboard=%s path=templating.list[%s] variable="%s" does not have "cluster_new_status" in definition. Found "%s" instead.`,
sPath, key.String(), varName, definition)
}
return true
})
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode-details/volumeBySVM.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -456,7 +456,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -469,7 +469,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -479,7 +479,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode-details/volumeDeepDive.json
Original file line number Diff line number Diff line change
Expand Up @@ -3687,7 +3687,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -3697,7 +3697,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -3713,7 +3713,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -3723,7 +3723,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/aggregate.json
Original file line number Diff line number Diff line change
Expand Up @@ -6601,7 +6601,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(aggr_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -6611,7 +6611,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(aggr_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode/data_protection_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@
"value": "DC-01"
},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\"},datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"},datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -1613,7 +1613,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\"},datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"},datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -1629,7 +1629,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -1639,7 +1639,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/disk.json
Original file line number Diff line number Diff line change
Expand Up @@ -3012,7 +3012,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(disk_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -3022,7 +3022,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(disk_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"},cluster)",
"refId": "Prometheus-Cluster-Variable-Query"
},
"refresh": 2,
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode/external_service_op.json
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(external_service_op_request_latency{system_type!=\"7mode\"}, datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -833,7 +833,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(external_service_op_request_latency{system_type!=\"7mode\"}, datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -849,7 +849,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(external_service_op_request_latency{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -859,7 +859,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(external_service_op_request_latency{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode/flexgroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -2871,7 +2871,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -2881,7 +2881,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -2897,7 +2897,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -2907,7 +2907,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode/fsa.json
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -1533,7 +1533,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -1549,7 +1549,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -1559,7 +1559,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
8 changes: 4 additions & 4 deletions grafana/dashboards/cmode/headroom.json
Original file line number Diff line number Diff line change
Expand Up @@ -2460,7 +2460,7 @@
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -2470,7 +2470,7 @@
"name": "Datacenter",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\"}, datacenter)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\"}, datacenter)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -2483,7 +2483,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -2493,7 +2493,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(volume_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/lun.json
Original file line number Diff line number Diff line change
Expand Up @@ -5111,7 +5111,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(lun_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -5121,7 +5121,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(lun_labels{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/cmode/mcc_cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -4152,7 +4152,7 @@
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(aggr_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"definition": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"description": null,
"error": null,
"hide": 0,
Expand All @@ -4163,7 +4163,7 @@
"name": "Cluster",
"options": [],
"query": {
"query": "label_values(aggr_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"query": "label_values(cluster_new_status{system_type!=\"7mode\",datacenter=~\"$Datacenter\"}, cluster)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand Down
Loading

0 comments on commit 607db7c

Please sign in to comment.