From debc0ba3ffbfca5a346e977fb512c51adc07ee48 Mon Sep 17 00:00:00 2001 From: divya Date: Fri, 9 Jun 2023 10:56:35 -0500 Subject: [PATCH 1/2] feat: Add swap metric to fly-apps dashboard --- grafana/fly-app.json | 107 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/grafana/fly-app.json b/grafana/fly-app.json index 6252744..a51f8b4 100644 --- a/grafana/fly-app.json +++ b/grafana/fly-app.json @@ -725,6 +725,113 @@ "title": "Memory Utilization", "type": "timeseries" }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus_on_fly" + }, + "description": "Swap Usage; Total and Available", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 31, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus_on_fly" + }, + "editorMode": "code", + "expr": "avg(fly_instance_memory_swap_total{app=\"$app\"})", + "legendFormat": "__auto", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus_on_fly" + }, + "editorMode": "code", + "expr": "avg(fly_instance_memory_swap_total{app=\"$app\"}) - avg(fly_instance_memory_swap_free{app=\"$app\"})", + "hide": false, + "legendFormat": "__auto", + "range": true, + "refId": "B" + } + ], + "title": "Swap Usage", + "type": "timeseries" + }, { "datasource": { "type": "prometheus", From c2aa2c3cc6dbf425cad90fa4b876f032ab96bfe8 Mon Sep 17 00:00:00 2001 From: divya Date: Fri, 9 Jun 2023 12:32:07 -0500 Subject: [PATCH 2/2] fix: Add swap to mem utilization panel --- grafana/fly-app.json | 111 ++++++++----------------------------------- 1 file changed, 20 insertions(+), 91 deletions(-) diff --git a/grafana/fly-app.json b/grafana/fly-app.json index a51f8b4..632e4ea 100644 --- a/grafana/fly-app.json +++ b/grafana/fly-app.json @@ -720,101 +720,18 @@ "legendFormat": "{{instance}} - {{region}}", "range": true, "refId": "B" - } - ], - "title": "Memory Utilization", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus_on_fly" - }, - "description": "Swap Usage; Total and Available", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 31, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus_on_fly" }, "editorMode": "code", - "expr": "avg(fly_instance_memory_swap_total{app=\"$app\"})", - "legendFormat": "__auto", + "expr": "(fly_instance_memory_swap_total{app=\"$app\"} -\nfly_instance_memory_swap_free{app=\"$app\"}) > 0", + "hide": false, + "legendFormat": "SwapUsed - Memory which has been evicted from RAM, and is temporarily on the disk", "range": true, - "refId": "A" + "refId": "J" }, { "datasource": { @@ -822,14 +739,14 @@ "uid": "prometheus_on_fly" }, "editorMode": "code", - "expr": "avg(fly_instance_memory_swap_total{app=\"$app\"}) - avg(fly_instance_memory_swap_free{app=\"$app\"})", + "expr": "(fly_instance_memory_swap_total{app=\"$app\"}) > 0", "hide": false, - "legendFormat": "__auto", + "legendFormat": "SwapTotal - total amount of swap space available", "range": true, - "refId": "B" + "refId": "I" } ], - "title": "Swap Usage", + "title": "Memory Utilization", "type": "timeseries" }, { @@ -1187,6 +1104,18 @@ "unit": "short" }, "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "Swap.*" + }, + "properties": [ + { + "id": "custom.transform", + "value": "negative-Y" + } + ] + }, { "matcher": { "id": "byName",