Skip to content

Commit

Permalink
feat: qtree dashboard should include topK qtrees by disk used growth (#…
Browse files Browse the repository at this point in the history
…1792)

* feat: qtree dashboard should include topK qtrees by disk used growth

Thanks to Watson9121 for raising
  • Loading branch information
cgrinds committed Mar 2, 2023
1 parent dfa660b commit c7b9af4
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 3 deletions.
21 changes: 20 additions & 1 deletion cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func TestUnitsAndExprMatch(t *testing.T) {
"_lag_time": {"", "s", "short"},
}

// Normalize rates to their base unit
rates := map[string]string{
"KiBs": "kbytes",
}

metricNames := make([]string, 0, len(mt.metricsByUnit))
for m := range mt.metricsByUnit {
metricNames = append(metricNames, m)
Expand All @@ -73,6 +78,20 @@ func TestUnitsAndExprMatch(t *testing.T) {
u := mt.metricsByUnit[metric]

failText := strings.Builder{}
// Normalize units if there are rates
for unit, listMetricLoc := range u.units {
normal, ok := rates[unit]
if !ok {
continue
}
list, ok := u.units[normal]
if !ok {
continue
}
delete(u.units, unit)
list = append(list, listMetricLoc...)
u.units[normal] = list
}
numUnits := len(u.units)
for unit, location := range u.units {
if unit == "" || unit == "none" {
Expand Down Expand Up @@ -740,7 +759,7 @@ func checkRate1m(t *testing.T, path string, data []byte) {
expressions := allExpressions(data)
for _, expr := range expressions {
if strings.Contains(expr.metric, "[1m]") {
t.Errorf("dashboard=%s, expr should not use rate of [1m] expr=%s", path, expr)
t.Errorf("dashboard=%s, expr should not use rate of [1m] expr=%s", path, expr.metric)
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion cmd/tools/grafana/units.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,10 @@
ontapUnit: per_sec
grafanaJson: ops
grafanaDisplay: Blocks/sec(ops)
comment: Number of block free per second
comment: Number of block free per second

- metric: quota_disk_used
ontapUnit: kilobytes
grafanaJson: kbytes
grafanaDisplay: kbytes
comment: Current amount of disk space, in kilobytes, used by the quota target.
113 changes: 112 additions & 1 deletion grafana/dashboards/cmode/qtree.json
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,94 @@
],
"title": "Top $TopResources Qtrees by Files Used",
"type": "timeseries"
},
{
"datasource": "${DS_PROMETHEUS}",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "KiBs"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 30
},
"id": 129,
"options": {
"legend": {
"calcs": [
"min",
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "rate(quota_disk_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", svm=~\"$SVM\", volume=~\"$Volume\", qtree=~\"$TopQtreeDiskUsedGrowth\"}[5m])",
"interval": "",
"legendFormat": "{{svm}} - {{volume}} - {{qtree}}",
"refId": "A"
}
],
"title": "Top $TopResources Qtrees by Disk Used Growth",
"type": "timeseries"
}
],
"title": "Usage",
Expand Down Expand Up @@ -1004,6 +1092,29 @@
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "query_result(topk($TopResources, rate(quota_disk_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", svm=~\"$SVM\", volume=~\"$Volume\", qtree=~\"$Qtree\"}[${__range}])))",
"description": null,
"error": null,
"hide": 2,
"includeAll": true,
"label": null,
"multi": true,
"name": "TopQtreeDiskUsedGrowth",
"options": [],
"query": {
"query": "query_result(topk($TopResources, rate(quota_disk_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", svm=~\"$SVM\", volume=~\"$Volume\", qtree=~\"$Qtree\"}[${__range}])))",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": ".*qtree=\\\"(.*?)\\\".*",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
Expand All @@ -1027,5 +1138,5 @@
"timezone": "",
"title": "ONTAP: Qtree",
"uid": "",
"version": 6
"version": 7
}

0 comments on commit c7b9af4

Please sign in to comment.