From bd3ba2bd46aaad72e5031ed6a7dce64031774a7e Mon Sep 17 00:00:00 2001 From: Beau West Date: Thu, 12 Dec 2024 02:16:51 -0600 Subject: [PATCH] Support separating by namespace on the Grafana dashboard (#271) Resolves #270 --- monitoring/grafana-dashboard.json | 145 ++++++++++++++++++------------ 1 file changed, 87 insertions(+), 58 deletions(-) diff --git a/monitoring/grafana-dashboard.json b/monitoring/grafana-dashboard.json index 6c33de4..1ec51c2 100644 --- a/monitoring/grafana-dashboard.json +++ b/monitoring/grafana-dashboard.json @@ -162,7 +162,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "max(max_over_time(dragonfly_uptime_in_seconds{pod=~\"$instance\"}[$__interval]))", + "expr": "max(max_over_time(dragonfly_uptime_in_seconds{namespace=\"$namespace\",pod=~\"$instance\"}[$__interval]))", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -248,7 +248,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "dragonfly_connected_clients{pod=~\"$instance\"}", + "expr": "dragonfly_connected_clients{namespace=\"$namespace\",pod=~\"$instance\"}", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -339,7 +339,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "100 * (dragonfly_memory_used_bytes{pod=~\"$instance\"} / dragonfly_memory_max_bytes{pod=~\"$instance\"} )", + "expr": "100 * (dragonfly_memory_used_bytes{namespace=\"$namespace\",pod=~\"$instance\"} / dragonfly_memory_max_bytes{namespace=\"$namespace\",pod=~\"$instance\"} )", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -411,7 +411,7 @@ "disableTextWrap": false, "editorMode": "code", "exemplar": false, - "expr": "dragonfly_master{pod=\"$instance\"}", + "expr": "dragonfly_master{namespace=\"$namespace\",pod=\"$instance\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": true, @@ -486,7 +486,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(dragonfly_commands_processed_total{pod=~\"$instance\"}[5m])", + "expr": "rate(dragonfly_commands_processed_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -595,7 +595,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "dragonfly_memory_used_bytes{pod=~\"$instance\"} ", + "expr": "dragonfly_memory_used_bytes{namespace=\"$namespace\",pod=~\"$instance\"} ", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -611,7 +611,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "dragonfly_memory_max_bytes{pod=~\"$instance\"} ", + "expr": "dragonfly_memory_max_bytes{namespace=\"$namespace\",pod=~\"$instance\"} ", "format": "time_series", "hide": false, "interval": "", @@ -713,7 +713,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "rate(dragonfly_net_input_bytes_total{pod=~\"$instance\"}[5m])", + "expr": "rate(dragonfly_net_input_bytes_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -727,7 +727,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "rate(dragonfly_net_output_bytes_total{pod=~\"$instance\"}[5m])", + "expr": "rate(dragonfly_net_output_bytes_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -829,7 +829,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "sum (dragonfly_db_keys{pod=~\"$instance\"}) by (db)", + "expr": "sum (dragonfly_db_keys{namespace=\"$namespace\",pod=~\"$instance\"}) by (db)", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -930,7 +930,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "sum (dragonfly_db_keys{pod=~\"$instance\"}) - sum (dragonfly_db_keys_expiring{pod=~\"$instance\"}) ", + "expr": "sum (dragonfly_db_keys{namespace=\"$namespace\",pod=~\"$instance\"}) - sum (dragonfly_db_keys_expiring{namespace=\"$namespace\",pod=~\"$instance\"}) ", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -945,7 +945,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "sum (dragonfly_db_keys_expiring{pod=~\"$instance\"})", + "expr": "sum (dragonfly_db_keys_expiring{namespace=\"$namespace\",pod=~\"$instance\"})", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -1071,7 +1071,7 @@ }, "disableTextWrap": false, "editorMode": "code", - "expr": "irate(dragonfly_connections_received_total{pod=\"$instance\"}[$__rate_interval])", + "expr": "irate(dragonfly_connections_received_total{namespace=\"$namespace\",pod=\"$instance\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, @@ -1142,7 +1142,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "dragonfly_connected_clients{pod=\"$instance\"}", + "expr": "dragonfly_connected_clients{namespace=\"$namespace\",pod=\"$instance\"}", "format": "time_series", "interval": "", "intervalFactor": 1, @@ -1243,7 +1243,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "rate(dragonfly_keyspace_hits_total{pod=~\"$instance\"}[5m])", + "expr": "rate(dragonfly_keyspace_hits_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -1260,7 +1260,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "rate(dragonfly_keyspace_misses_total{pod=~\"$instance\"}[5m])", + "expr": "rate(dragonfly_keyspace_misses_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])", "hide": false, "instant": false, "legendFormat": "misses", @@ -1376,7 +1376,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "sum(rate(dragonfly_expired_keys_total{pod=~\"$instance\"}[5m])) by (instance)", + "expr": "sum(rate(dragonfly_expired_keys_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])) by (instance)", "format": "time_series", "hide": false, "interval": "", @@ -1393,7 +1393,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": true, - "expr": "sum(rate(dragonfly_evicted_keys_total{pod=~\"$instance\"}[5m])) by (instance)", + "expr": "sum(rate(dragonfly_evicted_keys_total{namespace=\"$namespace\",pod=~\"$instance\"}[5m])) by (instance)", "format": "time_series", "interval": "", "intervalFactor": 2, @@ -1442,49 +1442,78 @@ ], "templating": { "list": [ - { - "current": {}, - "definition": "label_values(dragonfly_uptime_in_seconds,app)", - "hide": 0, - "includeAll": false, - "label": "", - "multi": false, - "name": "Dragonfly", - "options": [], - "query": { - "query": "label_values(dragonfly_uptime_in_seconds,app)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" + "hide": 2, + "name": "DS_PROMETHEUS", + "query": "prometheus", + "skipUrlSync": true, + "type": "constant" }, { - "current": {}, - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(dragonfly_uptime_in_seconds{app=\"$Dragonfly\"},pod)", - "hide": 0, - "includeAll": false, - "label": "instance", - "multi": false, - "name": "instance", - "options": [], - "query": { - "query": "label_values(dragonfly_uptime_in_seconds{app=\"$Dragonfly\"},pod)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } + "current": {}, + "definition": "label_values(dragonfly_uptime_in_seconds,app)", + "hide": 0, + "includeAll": false, + "label": "", + "multi": false, + "name": "Dragonfly", + "options": [], + "query": { + "query": "label_values(dragonfly_uptime_in_seconds,app)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(dragonfly_uptime_in_seconds{app=\"$Dragonfly\"},namespace)", + "hide": 0, + "includeAll": false, + "label": "namespace", + "multi": false, + "name": "namespace", + "options": [], + "query": { + "query": "label_values(dragonfly_uptime_in_seconds{app=\"$Dragonfly\"},namespace)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(dragonfly_uptime_in_seconds{app=\"$Dragonfly\",namespace=\"$namespace\"},pod)", + "hide": 0, + "includeAll": false, + "label": "instance", + "multi": false, + "name": "instance", + "options": [], + "query": { + "query": "label_values(dragonfly_uptime_in_seconds{app=\"$Dragonfly\",namespace=\"$namespace\"},pod)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } ] }, "time": {