Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: linking dashboards part-3 #2976

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,17 @@ func checkVariablesAreFSxFriendly(t *testing.T, path string, data []byte) {
}

var linkPath = regexp.MustCompile(`/d/(.*?)/`)
var supportedLinkedObjects = []string{"cluster", "datacenter", "aggr", "svm", "volume", "node", "home_node"}
var supportedLinkedObjects = []string{"cluster", "datacenter", "aggr", "svm", "volume", "node", "qtree", "home_node", "tenant"}
var exceptionPathPanelObject = []string{
"cmode/s3ObjectStorage.json-Bucket Overview-volume", // bucket volumes starts with fg_oss_xx and volume dashboard don't support them
"storagegrid/fabricpool.json-Aggregates-cluster", // There is no datacenter var to be passed for linking to cluster dashboard
"storagegrid/fabricpool.json-Aggregates-aggr", // There is no datacenter var to be passed for linking to aggregate dashboard
"storagegrid/fabricpool.json-Buckets-cluster", // There is no storagegrid cluster dashboard available
"storagegrid/overview.json-Data space usage breakdown-cluster", // There is no storagegrid cluster dashboard available
"storagegrid/overview.json-Metadata allowed space usage breakdown-cluster", // There is no storagegrid cluster dashboard available
"storagegrid/tenant.json-Tenant Quota-cluster", // There is no storagegrid cluster dashboard available
"storagegrid/tenant.json-Buckets-cluster", // There is no storagegrid cluster dashboard available
}

func TestLinks(t *testing.T) {
hasLinks := map[string][]string{}
Expand Down Expand Up @@ -1705,16 +1715,10 @@ func checkLinks(t *testing.T, path string, data []byte, hasLinks map[string][]st
func checkPanelLinks(t *testing.T, value gjson.Result, path string, hasLinks map[string][]string) {
linkFound := false

// Testing only for these dashboards now, it will be covered for all later
supportedDashboards := []string{"cmode/aggregate.json", "cmode/cdot.json",
"cmode/cluster.json", "comde/compliance.json", "cmode/data_protection_snapshot.json", "cmode/datacenter.json",
"cmode/disk.json", "cmode/external_service_op.json", "cmode/fsa.json", "cmode/headroom.json",
"cmode/health.json", "cmode/lun.json", "cmode/metadata.json", "cmode/svm.json", "cmode/volume.json",
}

if slices.Contains(supportedDashboards, path) && value.Get("type").String() == "table" {
if value.Get("type").String() == "table" {
value.Get("fieldConfig.overrides").ForEach(func(_, anOverride gjson.Result) bool {
if name := anOverride.Get("matcher.options").String(); slices.Contains(supportedLinkedObjects, name) {
title := value.Get("title").String()
linkFound = false
anOverride.Get("properties").ForEach(func(_, propValue gjson.Result) bool {
propValue.Get("value").ForEach(func(_, value gjson.Result) bool {
Expand All @@ -1727,8 +1731,8 @@ func checkPanelLinks(t *testing.T, value gjson.Result, path string, hasLinks map
})
return true
})
if !linkFound {
t.Errorf(`dashboard=%s panel="%s" column=%s is missing the links`, path, value.Get("title").String(), name)
if !linkFound && !slices.Contains(exceptionPathPanelObject, path+"-"+title+"-"+name) {
t.Errorf(`dashboard=%s panel="%s" column=%s is missing the links`, path, title, name)
}
}
return true
Expand Down
79 changes: 72 additions & 7 deletions grafana/dashboards/cmode-details/volumeBySVM.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,79 @@
{
"matcher": {
"id": "byName",
"options": "Volume"
"options": "cluster"
},
"properties": [
{
"id": "displayName",
"value": "Cluster"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-cluster/ontap-cluster?orgId=1&${Datacenter:queryparam}&${__url_time_range}&var-Cluster=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "node"
},
"properties": [
{
"id": "displayName",
"value": "Node"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-node/ontap-node?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-Node=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "svm"
},
"properties": [
{
"id": "displayName",
"value": "SVM"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-svm/ontap-svm?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-SVM=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "volume"
},
"properties": [
{
"id": "displayName",
"value": "Volume"
},
{
"id": "links",
"value": [
Expand Down Expand Up @@ -301,12 +371,7 @@
"Value #D": "Write Ops",
"Value #E": "Write TPut",
"Value #F": "Other Ops",
"Value #G": "Read TPut",
"cluster": "Cluster",
"datacenter": "Datacenter",
"node": "Node",
"svm": "SVM",
"volume": "Volume"
"Value #G": "Read TPut"
}
}
},
Expand Down
153 changes: 148 additions & 5 deletions grafana/dashboards/cmode-details/volumeDeepDive.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,70 @@
{
"matcher": {
"id": "byName",
"options": "Volume"
"options": "node"
},
"properties": [
{
"id": "displayName",
"value": "Node"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-node/ontap-node?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-Node=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "svm"
},
"properties": [
{
"id": "displayName",
"value": "SVM"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-svm/ontap-svm?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-SVM=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "volume"
},
"properties": [
{
"id": "displayName",
"value": "Volume"
},
{
"id": "custom.width",
"value": null
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-volume/ontap-volume?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${SVM:queryparam}&${__url_time_range}&var-Volume=${__value.raw}"
}
]
}
]
}
Expand Down Expand Up @@ -308,10 +366,7 @@
"Value #E": "Write TPut",
"Value #F": "Other Ops",
"Value #G": "Read TPut",
"Value #H": "",
"node": "Node",
"svm": "SVM",
"volume": "Volume"
"Value #H": ""
}
}
},
Expand Down Expand Up @@ -1406,6 +1461,94 @@
"value": "bytes"
}
]
},
{
"matcher": {
"id": "byName",
"options": "node"
},
"properties": [
{
"id": "displayName",
"value": "Node"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-node/ontap-node?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-Node=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "aggr"
},
"properties": [
{
"id": "displayName",
"value": "Aggregate"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-aggregate/ontap-aggregate?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-Aggregate=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "svm"
},
"properties": [
{
"id": "displayName",
"value": "SVM"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-svm/ontap-svm?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${__url_time_range}&var-SVM=${__value.raw}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "volume"
},
"properties": [
{
"id": "displayName",
"value": "Volume"
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "/d/cdot-volume/ontap-volume?orgId=1&${Datacenter:queryparam}&${Cluster:queryparam}&${SVM:queryparam}&${__url_time_range}&var-Volume=${__value.raw}"
}
]
}
]
}
]
},
Expand Down
Loading