Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into rg2-health-resolution
Browse files Browse the repository at this point in the history
# Conflicts:
#	grafana/dashboards/cmode/datacenter.json
  • Loading branch information
rahulguptajss committed Jun 12, 2024
2 parents 9a92863 + d6d0f54 commit 8e770bf
Show file tree
Hide file tree
Showing 30 changed files with 3,750 additions and 392 deletions.
18 changes: 3 additions & 15 deletions cmd/collectors/restperf/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util

fgAggrMap := make(map[string]*set.Set)
flexgroupAggrsMap := make(map[string]*set.Set)
nonExportedInstanceMap := make(map[string]bool)

// volume_aggr_labels metric is deprecated now and will be removed later.
metricName := "labels"
Expand All @@ -69,11 +68,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
cache.UUID += ".Volume"

// create flexgroup instance cache
for iKey, i := range data.GetInstances() {
if !i.IsExportable() {
nonExportedInstanceMap[iKey] = true
continue
}
for _, i := range data.GetInstances() {
if match := re.FindStringSubmatch(i.GetLabel("volume")); len(match) == 3 {
// instance key is svm.flexgroup-volume
key := i.GetLabel("svm") + "." + match[1]
Expand Down Expand Up @@ -102,10 +97,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
fgAggrMap[key].Add(i.GetLabel("aggr"))
flexgroupAggrsMap[key].Add(i.GetLabel("aggr"))
i.SetLabel(style, "flexgroup_constituent")
if !v.includeConstituents {
i.SetExportable(false)
nonExportedInstanceMap[iKey] = true
}
i.SetExportable(v.includeConstituents)
} else {
i.SetLabel(style, "flexvol")
key := i.GetLabel("svm") + "." + i.GetLabel("volume")
Expand All @@ -127,11 +119,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
// cache.Reset()

// create summary
for iKey, i := range data.GetInstances() {
if nonExportedInstanceMap[iKey] {
continue
}

for _, i := range data.GetInstances() {
match := re.FindStringSubmatch(i.GetLabel("volume"))
if len(match) != 3 {
continue
Expand Down
19 changes: 3 additions & 16 deletions cmd/collectors/zapiperf/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util

fgAggrMap := make(map[string]*set.Set)
flexgroupAggrsMap := make(map[string]*set.Set)
nonExportedInstanceMap := make(map[string]bool)

// volume_aggr_labels metric is deprecated now and will be removed later.
metricName := "labels"
Expand All @@ -77,11 +76,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
cache.UUID += ".Volume"

// create flexgroup instance cache
for iKey, i := range data.GetInstances() {
if !i.IsExportable() {
nonExportedInstanceMap[iKey] = true
continue
}
for _, i := range data.GetInstances() {
if match := re.FindStringSubmatch(i.GetLabel("volume")); len(match) == 3 {
// instance key is svm.flexgroup-volume
key := i.GetLabel("svm") + "." + match[1]
Expand Down Expand Up @@ -110,10 +105,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
fgAggrMap[key].Add(i.GetLabel("aggr"))
flexgroupAggrsMap[key].Add(i.GetLabel("aggr"))
i.SetLabel(style, "flexgroup_constituent")
if !v.includeConstituents {
i.SetExportable(false)
nonExportedInstanceMap[iKey] = true
}
i.SetExportable(v.includeConstituents)
} else {
i.SetLabel(style, "flexvol")
key := i.GetLabel("svm") + "." + i.GetLabel("volume")
Expand All @@ -128,19 +120,14 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
v.Logger.Error().Err(err).Str("metric", metricName).Msg("Unable to set value on metric")
}
}

}

v.Logger.Debug().Msgf("extracted %d flexgroup volumes", len(cache.GetInstances()))

// cache.Reset()

// create summary
for iKey, i := range data.GetInstances() {
if nonExportedInstanceMap[iKey] {
continue
}

for _, i := range data.GetInstances() {
match := re.FindStringSubmatch(i.GetLabel("volume"))
if len(match) != 3 {
continue
Expand Down
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
Loading

0 comments on commit 8e770bf

Please sign in to comment.