Skip to content

Commit

Permalink
feat: Remove topk vars from StorageGRID dashboards (#3002)
Browse files Browse the repository at this point in the history
* feat: Remove topk vars from StorageGRID dashboards
  • Loading branch information
Hardikl authored Jun 21, 2024
1 parent 0508dd8 commit 3588218
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 269 deletions.
7 changes: 5 additions & 2 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,18 @@ func ensureLookBack(text string) string {
space = 0
}
function := text[space:openIndex]

// Ignore special case where code filter has been applied as `code=~"[45].*"`, which cause the match[1] to be 45.
// This pattern is used in the StorageGRID Overview dashboard to check HTTP StatusCodes.
if strings.Contains(text, "code=~\"[45].*\"") {
continue
}
if strings.Contains(function, "rate") || strings.Contains(function, "deriv") {
if match[1] != "4m" {
return "rate/deriv want=[4m]"
}
} else if match[1] != "3h" {
return "range lookback want=[3h]"
}

}

return ""
Expand Down
77 changes: 4 additions & 73 deletions grafana/dashboards/storagegrid/fabricpool.json
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@
"targets": [
{
"exemplar": false,
"expr": "8 * sum by (cluster,policy)(rate(storagegrid_private_load_balancer_storage_rx_bytes{cluster=~\"$SGCluster\",policy=~\"$TopPolicyRx\"}[$__interval]))",
"expr": "8 * (sum by (cluster,policy)(rate(storagegrid_private_load_balancer_storage_rx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[4m])) and on (cluster, policy) topk($TopResources, sum by (cluster,policy) (avg_over_time(storagegrid_private_load_balancer_storage_rx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[3h]))))",
"hide": false,
"instant": false,
"interval": "3m",
Expand All @@ -1407,7 +1407,7 @@
},
{
"exemplar": false,
"expr": "8 * sum by (cluster,policy)(rate(storagegrid_private_load_balancer_storage_tx_bytes{cluster=~\"$SGCluster\",policy=~\"$TopPolicyTx\"}[$__interval]))",
"expr": "8 * (sum by (cluster,policy)(rate(storagegrid_private_load_balancer_storage_tx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[4m])) and on (cluster, policy) topk($TopResources, sum by (cluster,policy) (avg_over_time(storagegrid_private_load_balancer_storage_tx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[3h]))))",
"hide": false,
"interval": "3m",
"intervalFactor": 1,
Expand Down Expand Up @@ -1497,7 +1497,7 @@
"targets": [
{
"exemplar": false,
"expr": "sum by (cluster,policy)(rate(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$TopPolicyRequestCount\"}[$__interval])) > 0",
"expr": "sum by (cluster,policy)(rate(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[4m])) > 0 and on (cluster, policy) topk($TopResources, sum by (cluster,policy) (avg_over_time(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[3h])))",
"hide": false,
"instant": false,
"interval": "3m",
Expand All @@ -1507,7 +1507,7 @@
},
{
"exemplar": false,
"expr": "sum by (cluster,policy,method)(rate(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$TopPolicyRequestCount\"}[$__interval])) > 0",
"expr": "sum by (cluster,policy,method)(rate(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[4m])) > 0 and on (cluster, policy, method) topk($TopResources, sum by (cluster,policy,method) (avg_over_time(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[3h])))",
"hide": false,
"interval": "3m",
"intervalFactor": 1,
Expand Down Expand Up @@ -1936,75 +1936,6 @@
"sort": 1,
"type": "query"
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "query_result(topk($TopResources, avg_over_time(storagegrid_private_load_balancer_storage_rx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[${__range}])))",
"description": null,
"error": null,
"hide": 2,
"includeAll": true,
"label": null,
"multi": true,
"name": "TopPolicyRx",
"options": [],
"query": {
"query": "query_result(topk($TopResources, avg_over_time(storagegrid_private_load_balancer_storage_rx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[${__range}])))",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": ".*policy=\\\"(.*?)\\\".*",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "query_result(topk($TopResources, avg_over_time(storagegrid_private_load_balancer_storage_tx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[${__range}])))",
"description": null,
"error": null,
"hide": 2,
"includeAll": true,
"label": null,
"multi": true,
"name": "TopPolicyTx",
"options": [],
"query": {
"query": "query_result(topk($TopResources, avg_over_time(storagegrid_private_load_balancer_storage_tx_bytes{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[${__range}])))",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": ".*policy=\\\"(.*?)\\\".*",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "query_result(topk($TopResources, avg_over_time(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[${__range}])))",
"description": null,
"error": null,
"hide": 2,
"includeAll": true,
"label": null,
"multi": true,
"name": "TopPolicyRequestCount",
"options": [],
"query": {
"query": "query_result(topk($TopResources, avg_over_time(storagegrid_private_load_balancer_storage_request_count{cluster=~\"$SGCluster\",policy=~\"$Policy\"}[${__range}])))",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": ".*policy=\\\"(.*?)\\\".*",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": null,
"current": {},
Expand Down
Loading

0 comments on commit 3588218

Please sign in to comment.