From cc1915ef4a4e95e5956c541cc8968883eda3804c Mon Sep 17 00:00:00 2001 From: Maximilian Schubert Date: Wed, 1 Nov 2023 12:09:47 +0100 Subject: [PATCH 01/18] feat: add basic co2 emissions --- chart/files/caas-carbon-dashboard.json | 347 ++++++++++++++++++++++--- 1 file changed, 311 insertions(+), 36 deletions(-) diff --git a/chart/files/caas-carbon-dashboard.json b/chart/files/caas-carbon-dashboard.json index 2b74c3d..4c89f4c 100644 --- a/chart/files/caas-carbon-dashboard.json +++ b/chart/files/caas-carbon-dashboard.json @@ -42,7 +42,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "fieldConfig": { "defaults": { @@ -94,7 +94,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -112,7 +112,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -130,7 +130,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -148,7 +148,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -166,7 +166,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -184,7 +184,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -202,7 +202,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -220,7 +220,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -238,7 +238,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -256,7 +256,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -274,7 +274,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -292,7 +292,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -310,7 +310,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus" + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -345,12 +345,16 @@ "mode": "absolute", "steps": [ { - "color": "green", + "color": "blue", "value": null }, + { + "color": "#EAB839", + "value": 0.6 + }, { "color": "red", - "value": 80 + "value": 0.8 } ] } @@ -373,7 +377,7 @@ "calcs": [ "lastNotNull" ], - "fields": "", + "fields": "/^Engergy Index FOS$/", "values": false }, "textMode": "auto" @@ -386,10 +390,8 @@ "uid": "${datasource}" }, "editorMode": "code", - "exemplar": false, "expr": "avg(entsoe_generation_fos)", "hide": false, - "instant": false, "legendFormat": "Engergy Index FOS", "range": true, "refId": "B" @@ -415,16 +417,12 @@ "mode": "absolute", "steps": [ { - "color": "red", + "color": "green", "value": null }, { - "color": "yellow", - "value": 0.2 - }, - { - "color": "green", - "value": 0.5 + "color": "red", + "value": 80 } ] } @@ -470,6 +468,70 @@ "title": "Energy Index ECO", "type": "stat" }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "description": "Using data from https://transparency.entsoe.eu/", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 13 + }, + "id": 21, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^Engergy Index FOS$/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.5.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "avg(entsoe_generation_fos)*$fosfactor", + "hide": false, + "legendFormat": "Engergy Index FOS", + "range": true, + "refId": "B" + } + ], + "title": "CO2g/kwh FOS", + "transformations": [], + "type": "stat" + }, { "datasource": { "type": "prometheus", @@ -505,7 +567,7 @@ "h": 6, "w": 19, "x": 2, - "y": 13 + "y": 19 }, "id": 18, "options": { @@ -679,7 +741,7 @@ "h": 1, "w": 24, "x": 0, - "y": 19 + "y": 25 }, "id": 8, "panels": [], @@ -810,7 +872,7 @@ "h": 10, "w": 24, "x": 0, - "y": 20 + "y": 26 }, "id": 16, "options": { @@ -879,6 +941,199 @@ "title": "Pod/Process Power Consumption (W) in Namespace: $namespace", "type": "timeseries" }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "CO2g/h", + "axisPlacement": "left", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 44, + "gradientMode": "opacity", + "hideFrom": { + "graph": false, + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 0, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*DRAM.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*OTHER.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*GPU.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*PKG.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 36 + }, + "id": 22, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": "prometheus", + "editorMode": "code", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_package_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "hide": false, + "interval": "", + "legendFormat": "{{pod_name}} / {{container_namespace}} / PKG", + "range": true, + "refId": "A" + }, + { + "datasource": "prometheus", + "editorMode": "code", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_dram_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "hide": false, + "interval": "", + "legendFormat": "{{pod_name}} / {{container_namespace}} / DRAM", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_other_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "hide": false, + "interval": "", + "legendFormat": "{{pod_name}} / {{container_namespace}} / OTHER", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_gpu_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "hide": false, + "legendFormat": "{{pod_name}} / {{container_namespace}} / GPU", + "range": true, + "refId": "D" + } + ], + "title": "Pod/Process CO2 FOS Emission (C02g/h) in Namespace: $namespace", + "type": "timeseries" + }, { "datasource": { "type": "prometheus", @@ -1003,7 +1258,7 @@ "h": 8, "w": 12, "x": 0, - "y": 30 + "y": 46 }, "id": 2, "options": { @@ -1200,7 +1455,7 @@ "h": 8, "w": 12, "x": 12, - "y": 30 + "y": 46 }, "id": 17, "options": { @@ -1306,7 +1561,7 @@ "h": 7, "w": 24, "x": 0, - "y": 38 + "y": 54 }, "id": 15, "options": { @@ -1343,7 +1598,7 @@ "type": "bargauge" } ], - "refresh": "", + "refresh": false, "schemaVersion": 38, "style": "dark", "tags": [], @@ -1351,7 +1606,7 @@ "list": [ { "current": { - "selected": false, + "selected": true, "text": "Prometheus", "value": "Prometheus" }, @@ -1438,12 +1693,32 @@ "query": "0.000000277777777777778", "skipUrlSync": false, "type": "constant" + }, + { + "current": { + "selected": false, + "text": "996", + "value": "996" + }, + "hide": 0, + "label": "FOS CO2g/kWh", + "name": "fosfactor", + "options": [ + { + "selected": true, + "text": "996", + "value": "996" + } + ], + "query": "996", + "skipUrlSync": false, + "type": "textbox" } ] }, "time": { - "from": "now-15m", - "to": "now" + "from": "2023-11-01T10:03:24.016Z", + "to": "2023-11-01T10:34:20.750Z" }, "timepicker": {}, "timezone": "browser", From ffeb031b514058f39a7e6b0eb19e1ba95b1e9f1a Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Wed, 1 Nov 2023 18:48:56 +0100 Subject: [PATCH 02/18] update dashboard --- chart/files/caas-carbon-dashboard.json | 293 +++++++++++++++++++++++-- 1 file changed, 279 insertions(+), 14 deletions(-) diff --git a/chart/files/caas-carbon-dashboard.json b/chart/files/caas-carbon-dashboard.json index 4c89f4c..2fc2437 100644 --- a/chart/files/caas-carbon-dashboard.json +++ b/chart/files/caas-carbon-dashboard.json @@ -22,6 +22,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, + "id": 20, "links": [], "liveNow": false, "panels": [ @@ -309,8 +310,8 @@ }, { "datasource": { + "uid": "${datasource}" "type": "prometheus", - "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -382,7 +383,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.5.1", + "pluginVersion": "10.1.4", "targets": [ { "datasource": { @@ -450,7 +451,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.5.1", + "pluginVersion": "10.1.4", "targets": [ { "datasource": { @@ -513,7 +514,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.5.1", + "pluginVersion": "10.1.4", "targets": [ { "datasource": { @@ -583,7 +584,7 @@ "showThresholdMarkers": true, "text": {} }, - "pluginVersion": "9.5.1", + "pluginVersion": "10.1.4", "targets": [ { "datasource": { @@ -774,6 +775,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 0, "pointSize": 5, @@ -967,6 +969,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 0, "pointSize": 5, @@ -1160,6 +1163,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 0, "pointSize": 5, @@ -1357,6 +1361,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 0, "pointSize": 5, @@ -1579,7 +1584,7 @@ "showUnfilled": true, "valueMode": "color" }, - "pluginVersion": "9.5.1", + "pluginVersion": "10.1.4", "targets": [ { "datasource": { @@ -1598,7 +1603,7 @@ "type": "bargauge" } ], - "refresh": false, + "refresh": "", "schemaVersion": 38, "style": "dark", "tags": [], @@ -1606,9 +1611,9 @@ "list": [ { "current": { - "selected": true, + "selected": false, "text": "Prometheus", - "value": "Prometheus" + "value": "PBFA97CFB590B2093" }, "hide": 0, "includeAll": false, @@ -1697,12 +1702,72 @@ { "current": { "selected": false, - "text": "996", - "value": "996" + "text": "751", + "value": "751" }, "hide": 0, "label": "FOS CO2g/kWh", "name": "fosfactor", + "options": [ + { + "selected": true, + "text": "751", + "value": "751" + } + ], + "query": "751", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "117", + "value": "117" + }, + "hide": 0, + "label": "ECO CO2g/kWh", + "name": "ecofactor", + "options": [ + { + "selected": true, + "text": "117", + "value": "117" + } + ], + "query": "117", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "230", + "value": "230" + }, + "hide": 0, + "label": "B01 Biomass CO2g/kWh", + "name": "biomass", + "options": [ + { + "selected": true, + "text": "230", + "value": "230" + } + ], + "query": "230", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "996", + "value": "996" + }, + "hide": 0, + "label": "B02 Brown Coal CO2g/kWh", + "name": "browncoal", "options": [ { "selected": true, @@ -1713,17 +1778,217 @@ "query": "996", "skipUrlSync": false, "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "880", + "value": "880" + }, + "hide": 0, + "label": "B05 Hard Coal CO2g/kWh", + "name": "hardcoal", + "options": [ + { + "selected": true, + "text": "880", + "value": "880" + } + ], + "query": "880", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "378", + "value": "378" + }, + "hide": 0, + "label": "B04 Gas CO2g/kWh", + "name": "gas", + "options": [ + { + "selected": true, + "text": "378", + "value": "378" + } + ], + "query": "378", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "39", + "value": "39" + }, + "hide": 0, + "label": "B14 Nuclear CO2g/kWh", + "name": "nuclear", + "options": [ + { + "selected": true, + "text": "39", + "value": "39" + } + ], + "query": "39", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "9", + "value": "9" + }, + "hide": 0, + "label": "B19 Wind Onshore CO2g/kWh", + "name": "windonshore", + "options": [ + { + "selected": true, + "text": "9", + "value": "9" + } + ], + "query": "9", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "4", + "value": "4" + }, + "hide": 0, + "label": "B18 Wind Offhore CO2g/kWh", + "name": "windoffshore", + "options": [ + { + "selected": true, + "text": "4", + "value": "4" + } + ], + "query": "4", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "26", + "value": "26" + }, + "hide": 0, + "label": "B16 Solar CO2g/kWh", + "name": "solar", + "options": [ + { + "selected": true, + "text": "26", + "value": "26" + } + ], + "query": "26", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "494", + "value": "494" + }, + "hide": 0, + "label": "B17 Waste CO2g/kWh", + "name": "waste", + "options": [ + { + "selected": true, + "text": "494", + "value": "494" + } + ], + "query": "494", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "23", + "value": "23" + }, + "hide": 0, + "label": "B10 Hydro Pumped Storage CO2g/kWh", + "name": "hydro", + "options": [ + { + "selected": true, + "text": "23", + "value": "23" + } + ], + "query": "23", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "23", + "value": "23" + }, + "hide": 0, + "label": "B11 Hydro Run River CO2g/kWh", + "name": "hydro", + "options": [ + { + "selected": true, + "text": "23", + "value": "23" + } + ], + "query": "23", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "23", + "value": "23" + }, + "hide": 0, + "label": "B12 Hydro Water Reservoir CO2g/kWh", + "name": "hydro", + "options": [ + { + "selected": true, + "text": "23", + "value": "23" + } + ], + "query": "23", + "skipUrlSync": false, + "type": "textbox" } ] }, "time": { - "from": "2023-11-01T10:03:24.016Z", - "to": "2023-11-01T10:34:20.750Z" + "from": "now-5m", + "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "CaaS Carbon Dashboard", "uid": "NhnWODJ4zIBM", - "version": 5, + "version": 4, "weekStart": "" } From 5613989c153eb6c0a5afd5f1ff6e3e9096de33e5 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Wed, 1 Nov 2023 19:08:37 +0100 Subject: [PATCH 03/18] upgrade dashboard --- chart/files/caas-carbon-dashboard.json | 88 ++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 12 deletions(-) diff --git a/chart/files/caas-carbon-dashboard.json b/chart/files/caas-carbon-dashboard.json index 2fc2437..3624331 100644 --- a/chart/files/caas-carbon-dashboard.json +++ b/chart/files/caas-carbon-dashboard.json @@ -22,7 +22,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 20, "links": [], "liveNow": false, "panels": [ @@ -310,8 +309,8 @@ }, { "datasource": { - "uid": "${datasource}" "type": "prometheus", + "uid": "PBFA97CFB590B2093" }, "disableTextWrap": false, "editorMode": "builder", @@ -533,6 +532,70 @@ "transformations": [], "type": "stat" }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "description": "Using data from https://transparency.entsoe.eu/", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 7, + "y": 13 + }, + "id": 23, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^Engergy Index FOS$/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "avg(entsoe_generation_bio)*$ecofactor", + "hide": false, + "legendFormat": "Engergy Index FOS", + "range": true, + "refId": "B" + } + ], + "title": "CO2g/kwh ECO", + "transformations": [], + "type": "stat" + }, { "datasource": { "type": "prometheus", @@ -1091,7 +1154,7 @@ { "datasource": "prometheus", "editorMode": "code", - "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_package_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_package_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*($fosfactor/1000)*($ecofactor/1000))", "hide": false, "interval": "", "legendFormat": "{{pod_name}} / {{container_namespace}} / PKG", @@ -1101,7 +1164,7 @@ { "datasource": "prometheus", "editorMode": "code", - "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_dram_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_dram_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*($fosfactor/1000)*($ecofactor/1000))", "hide": false, "interval": "", "legendFormat": "{{pod_name}} / {{container_namespace}} / DRAM", @@ -1114,7 +1177,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_other_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_other_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*($fosfactor/1000)*($ecofactor/1000))", "hide": false, "interval": "", "legendFormat": "{{pod_name}} / {{container_namespace}} / OTHER", @@ -1127,7 +1190,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_gpu_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*$fosfactor/1000)", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_gpu_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*($fosfactor/1000)*($ecofactor/1000))", "hide": false, "legendFormat": "{{pod_name}} / {{container_namespace}} / GPU", "range": true, @@ -1712,14 +1775,15 @@ { "selected": true, "text": "751", - "value": "751" + "value": "751", + "width": "10" } ], "query": "751", "skipUrlSync": false, "type": "textbox" }, - { + { "current": { "selected": false, "text": "117", @@ -1738,7 +1802,7 @@ "query": "117", "skipUrlSync": false, "type": "textbox" - }, + }, { "current": { "selected": false, @@ -1927,7 +1991,7 @@ }, "hide": 0, "label": "B10 Hydro Pumped Storage CO2g/kWh", - "name": "hydro", + "name": "hydropump", "options": [ { "selected": true, @@ -1947,7 +2011,7 @@ }, "hide": 0, "label": "B11 Hydro Run River CO2g/kWh", - "name": "hydro", + "name": "hydroriver", "options": [ { "selected": true, @@ -1967,7 +2031,7 @@ }, "hide": 0, "label": "B12 Hydro Water Reservoir CO2g/kWh", - "name": "hydro", + "name": "hydrores", "options": [ { "selected": true, From a671a488171846824f0c5447ed064f15e5fe21ed Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Wed, 1 Nov 2023 19:08:55 +0100 Subject: [PATCH 04/18] more references --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b5822d2..b772891 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,10 @@ entsoe_generation_fos 0.23437570916352743 Ref: CO2 emissions factor: -https://iinas.org/app/uploads/2023/10/IINAS_2023_KEV_THG_Strom-2022_2030-2050.pdf +- https://iinas.org/app/uploads/2023/10/IINAS_2023_KEV_THG_Strom-2022_2030-2050.pdf +- https://impactful.ninja/the-carbon-footprint-of-biomass-energy/ +- https://www.hydropower.org/blog/carbon-emissions-from-hydropower-reservoirs-facts-and-myths +- https://www.rte-france.com/en/eco2mix/co2-emissions ## Credits From 9bb5b53e6ab3ebb3cb1f9f660fcd1c6b48c5c49c Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Wed, 1 Nov 2023 19:09:34 +0100 Subject: [PATCH 05/18] keep secret while helm upgrade --- chart/templates/entsoe-secret.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chart/templates/entsoe-secret.yaml b/chart/templates/entsoe-secret.yaml index 54db7e1..ecb6d3e 100644 --- a/chart/templates/entsoe-secret.yaml +++ b/chart/templates/entsoe-secret.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: Secret type: Opaque metadata: + annotations: + "helm.sh/resource-policy": keep name: entsoe-{{ include "caas-carbon-footprint.fullname" . }} labels: app.kubernetes.io/component: entsoe From d3d896444db3ddab7a81665a8de6b3752231fd18 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sun, 5 Nov 2023 07:25:41 +0100 Subject: [PATCH 06/18] pie chart mean --- chart/files/caas-carbon-dashboard.json | 435 ++++++++++++------------- 1 file changed, 216 insertions(+), 219 deletions(-) diff --git a/chart/files/caas-carbon-dashboard.json b/chart/files/caas-carbon-dashboard.json index 3624331..069d3e8 100644 --- a/chart/files/caas-carbon-dashboard.json +++ b/chart/files/caas-carbon-dashboard.json @@ -58,7 +58,173 @@ }, "mappings": [] }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Gas" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hard Coal" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#010101", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Wind Onshore" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Wind Offshore" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Brown Coal" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#5c291b", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Waste" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#ef3524", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Geothermal" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#f4001d", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Biomass" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#b9d0b6", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hydro Water Res." + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hydro Run-of-river" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Nuclear" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#f8f17b", + "mode": "fixed" + } + } + ] + } + ] }, "gridPos": { "h": 12, @@ -80,7 +246,7 @@ "pieType": "pie", "reduceOptions": { "calcs": [ - "lastNotNull" + "mean" ], "fields": "", "values": false @@ -375,7 +541,7 @@ "orientation": "auto", "reduceOptions": { "calcs": [ - "lastNotNull" + "mean" ], "fields": "/^Engergy Index FOS$/", "values": false @@ -443,7 +609,7 @@ "orientation": "auto", "reduceOptions": { "calcs": [ - "lastNotNull" + "mean" ], "fields": "", "values": false @@ -506,7 +672,7 @@ "orientation": "auto", "reduceOptions": { "calcs": [ - "lastNotNull" + "mean" ], "fields": "/^Engergy Index FOS$/", "values": false @@ -570,7 +736,7 @@ "orientation": "auto", "reduceOptions": { "calcs": [ - "lastNotNull" + "mean" ], "fields": "/^Engergy Index FOS$/", "values": false @@ -1763,296 +1929,127 @@ "type": "constant" }, { - "current": { - "selected": false, - "text": "751", - "value": "751" - }, - "hide": 0, - "label": "FOS CO2g/kWh", + "description": "FOS CO2g/kWh", + "hide": 2, "name": "fosfactor", - "options": [ - { - "selected": true, - "text": "751", - "value": "751", - "width": "10" - } - ], "query": "751", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "117", - "value": "117" - }, - "hide": 0, - "label": "ECO CO2g/kWh", + "description": "ECO CO2g/kWh", + "hide": 2, "name": "ecofactor", - "options": [ - { - "selected": true, - "text": "117", - "value": "117" - } - ], "query": "117", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "230", - "value": "230" - }, - "hide": 0, - "label": "B01 Biomass CO2g/kWh", + "description": "B01 Biomass CO2g/kWh", + "hide": 2, "name": "biomass", - "options": [ - { - "selected": true, - "text": "230", - "value": "230" - } - ], "query": "230", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "996", - "value": "996" - }, - "hide": 0, - "label": "B02 Brown Coal CO2g/kWh", + "description": "B02 Brown Coal CO2g/kWh", + "hide": 2, "name": "browncoal", - "options": [ - { - "selected": true, - "text": "996", - "value": "996" - } - ], "query": "996", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "880", - "value": "880" - }, - "hide": 0, - "label": "B05 Hard Coal CO2g/kWh", + "description": "B05 Hard Coal CO2g/kWh", + "hide": 2, "name": "hardcoal", - "options": [ - { - "selected": true, - "text": "880", - "value": "880" - } - ], "query": "880", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "378", - "value": "378" - }, - "hide": 0, - "label": "B04 Gas CO2g/kWh", + "description": "B04 Gas CO2g/kWh", + "hide": 2, "name": "gas", - "options": [ - { - "selected": true, - "text": "378", - "value": "378" - } - ], "query": "378", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "39", - "value": "39" - }, - "hide": 0, - "label": "B14 Nuclear CO2g/kWh", + "description": "B14 Nuclear CO2g/kWh", + "hide": 2, "name": "nuclear", - "options": [ - { - "selected": true, - "text": "39", - "value": "39" - } - ], "query": "39", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "9", - "value": "9" - }, - "hide": 0, - "label": "B19 Wind Onshore CO2g/kWh", + "description": "B19 Wind Onshore CO2g/kWh", + "hide": 2, "name": "windonshore", - "options": [ - { - "selected": true, - "text": "9", - "value": "9" - } - ], "query": "9", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "4", - "value": "4" - }, - "hide": 0, - "label": "B18 Wind Offhore CO2g/kWh", + "description": "B18 Wind Offhore CO2g/kWh", + "hide": 2, "name": "windoffshore", - "options": [ - { - "selected": true, - "text": "4", - "value": "4" - } - ], "query": "4", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "26", - "value": "26" - }, - "hide": 0, - "label": "B16 Solar CO2g/kWh", + "description": "B16 Solar CO2g/kWh", + "hide": 2, "name": "solar", - "options": [ - { - "selected": true, - "text": "26", - "value": "26" - } - ], "query": "26", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "494", - "value": "494" - }, - "hide": 0, - "label": "B17 Waste CO2g/kWh", + "description": "B17 Waste CO2g/kWh", + "hide": 2, "name": "waste", - "options": [ - { - "selected": true, - "text": "494", - "value": "494" - } - ], "query": "494", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "23", - "value": "23" - }, - "hide": 0, - "label": "B10 Hydro Pumped Storage CO2g/kWh", + "description": "B10 Hydro Pumped Storage CO2g/kWh", + "hide": 2, "name": "hydropump", - "options": [ - { - "selected": true, - "text": "23", - "value": "23" - } - ], "query": "23", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "23", - "value": "23" - }, - "hide": 0, - "label": "B11 Hydro Run River CO2g/kWh", + "description": "B11 Hydro Run River CO2g/kWh", + "hide": 2, "name": "hydroriver", - "options": [ - { - "selected": true, - "text": "23", - "value": "23" - } - ], "query": "23", "skipUrlSync": false, - "type": "textbox" + "type": "constant" }, { - "current": { - "selected": false, - "text": "23", - "value": "23" - }, - "hide": 0, - "label": "B12 Hydro Water Reservoir CO2g/kWh", + "description": "B12 Hydro Water Reservoir CO2g/kWh", + "hide": 2, "name": "hydrores", - "options": [ - { - "selected": true, - "text": "23", - "value": "23" - } - ], "query": "23", "skipUrlSync": false, - "type": "textbox" + "type": "constant" } ] }, "time": { - "from": "now-5m", + "from": "now-1h", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "CaaS Carbon Dashboard", "uid": "NhnWODJ4zIBM", - "version": 4, + "version": 16, "weekStart": "" } From 9073b2ea6cde936925d29279d2f1d5ebd3bf3b81 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sun, 5 Nov 2023 08:01:06 +0100 Subject: [PATCH 07/18] compute co2 rate --- chart/files/caas-carbon-dashboard.json | 143 ++++++++++++++++++++++--- 1 file changed, 126 insertions(+), 17 deletions(-) diff --git a/chart/files/caas-carbon-dashboard.json b/chart/files/caas-carbon-dashboard.json index 069d3e8..007f297 100644 --- a/chart/files/caas-carbon-dashboard.json +++ b/chart/files/caas-carbon-dashboard.json @@ -762,6 +762,119 @@ "transformations": [], "type": "stat" }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "description": "Using data from https://transparency.entsoe.eu/", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + }, + { + "color": "red", + "value": 8 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "CO2 emmission" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 23, + "x": 0, + "y": 19 + }, + "id": 24, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "avg(entsoe_generation_b02)*$browncoal/1000/1000+avg(entsoe_generation_b05)*$hardcoal/1000/1000+avg(entsoe_generation_b04)*$gas/1000/1000+avg(entsoe_generation_b19)*$windonshore/1000/1000+avg(entsoe_generation_b18)*$windoffshore/1000/1000+avg(entsoe_generation_b16)*$solar/1000/1000+avg(entsoe_generation_b17)*$waste/1000/1000+avg(entsoe_generation_b10)*$hydropump/1000/1000+avg(entsoe_generation_b11)*$hydroriver/1000/1000+avg(entsoe_generation_b12)*$hydrores/1000/1000", + "hide": false, + "legendFormat": "CO2 emmission", + "range": true, + "refId": "B" + } + ], + "title": "CO2g/w", + "transformations": [], + "type": "timeseries" + }, { "datasource": { "type": "prometheus", @@ -797,7 +910,7 @@ "h": 6, "w": 19, "x": 2, - "y": 19 + "y": 27 }, "id": 18, "options": { @@ -971,7 +1084,7 @@ "h": 1, "w": 24, "x": 0, - "y": 25 + "y": 33 }, "id": 8, "panels": [], @@ -1103,7 +1216,7 @@ "h": 10, "w": 24, "x": 0, - "y": 26 + "y": 34 }, "id": 16, "options": { @@ -1220,8 +1333,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1297,7 +1409,7 @@ "h": 10, "w": 24, "x": 0, - "y": 36 + "y": 44 }, "id": 22, "options": { @@ -1414,8 +1526,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1491,7 +1602,7 @@ "h": 8, "w": 12, "x": 0, - "y": 46 + "y": 54 }, "id": 2, "options": { @@ -1612,8 +1723,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1689,7 +1799,7 @@ "h": 8, "w": 12, "x": 12, - "y": 46 + "y": 54 }, "id": 17, "options": { @@ -1779,8 +1889,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1795,7 +1904,7 @@ "h": 7, "w": 24, "x": 0, - "y": 54 + "y": 62 }, "id": 15, "options": { @@ -2043,13 +2152,13 @@ ] }, "time": { - "from": "now-1h", + "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "CaaS Carbon Dashboard", "uid": "NhnWODJ4zIBM", - "version": 16, + "version": 18, "weekStart": "" } From cf88b0fb1f20a0e86b61e7895d7d92ea51f970ee Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 19:10:33 +0100 Subject: [PATCH 08/18] new metrics with co2 summary and exposed constants --- flask/app.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/flask/app.py b/flask/app.py index 801aba0..bef6c17 100644 --- a/flask/app.py +++ b/flask/app.py @@ -146,6 +146,21 @@ def metrics(): except: result_b19=0 ####################################### + # Factor CO2g/kWh + ####################################### + fac_b01 = 230 + fac_b02 = 996 + fac_b05 = 880 + fac_b04 = 378 + fac_b14 = 39 + fac_b19 = 9 + fac_b18 = 4 + fac_b16 = 26 + fac_b17 = 494 + fac_b10 = 23 + fac_b11 = 23 + fac_b12 = 23 + ####################################### # Summary Energy Generation ####################################### result_sum = int(result_b01) + int(result_b02) + int(result_b04) + int(result_b05) + int(result_b09) + int(result_b10) + int(result_b11) + int(result_b12) + int(result_b14) + int(result_b16) + int(result_b17) + int(result_b18) + int(result_b19) @@ -158,6 +173,10 @@ def metrics(): ####################################### result_fos = (int(result_b02) + int(result_b04) + int(result_b05)) / int(result_sum) ####################################### + # CO2 gramm/watt + ####################################### + result_co2 = ((int(result_b02) * fac_b02) + (int(result_b04) * fac_b04) + (int(result_b05)) * fac_b05) + ((int(result_b01) * fac_b01) + (int(result_b09) * fac_b09) + (int(result_b10) * fac_b10) + (int(result_b11) * fac_b11) + (int(result_b12) * fac_b12) + (int(result_b16) * fac_b16) + (int(result_b17) * fac_b17) + (int(result_b18) * fac_b18) + (int(result_b19) * fac_b19)) / 1000 / 3600 + ####################################### # Print Out Metrics ####################################### counter = "# HELP entsoe_generation_b01 Current generation of energy with Biomass in MW" + "\n" @@ -208,7 +227,47 @@ def metrics(): counter += "# HELP entsoe_generation_fos Current generation of fossil energy summary rate" + "\n" counter += "# TYPE entsoe_generation_fos gauge" + "\n" counter += "entsoe_generation_fos " + str(result_fos) + "\n" + counter += "# HELP entsoe_generation_co2 Current generation of co2 per watt" + "\n" + counter += "# TYPE entsoe_generation_co2 gauge" + "\n" + counter += "entsoe_generation_co2 " + str(result_co2) + "\n" + counter += "# HELP entsoe_factor_b01 Factor CO2g/kWh Biomass" + "\n" + counter += "# TYPE entsoe_factor_b01 gauge" + "\n" + counter += "entsoe_factor_b01 " + str(fac_b01) + "\n" + counter += "# HELP entsoe_factor_b02 Factor CO2g/kWh Brown Coal" + "\n" + counter += "# TYPE entsoe_factor_b02 gauge" + "\n" + counter += "entsoe_factor_b02 " + str(fac_b02) + "\n" + counter += "# HELP entsoe_factor_b04 Factor CO2g/kWh Gas" + "\n" + counter += "# TYPE entsoe_factor_b04 gauge" + "\n" + counter += "entsoe_factor_b04 " + str(fac_b04) + "\n" + counter += "# HELP entsoe_factor_b05 Factor CO2g/kWh Hard Coal" + "\n" + counter += "# TYPE entsoe_factor_b05 gauge" + "\n" + counter += "entsoe_factor_b05 " + str(fac_b05) + "\n" + counter += "# HELP entsoe_factor_b10 Factor CO2g/kWh Hydro Pumped Storage" + "\n" + counter += "# TYPE entsoe_factor_b10 gauge" + "\n" + counter += "entsoe_factor_b10 " + str(fac_b10) + "\n" + counter += "# HELP entsoe_factor_b11 Factor CO2g/kWh Hydro Run River" + "\n" + counter += "# TYPE entsoe_factor_b11 gauge" + "\n" + counter += "entsoe_factor_b11 " + str(fac_b11) + "\n" + counter += "# HELP entsoe_factor_b12 Factor CO2g/kWh Hydro Water Reservoir" + "\n" + counter += "# TYPE entsoe_factor_b12 gauge" + "\n" + counter += "entsoe_factor_b12 " + str(fac_b12) + "\n" + counter += "# HELP entsoe_factor_b14 Factor CO2g/kWh Nuclear" + "\n" + counter += "# TYPE entsoe_factor_b14 gauge" + "\n" + counter += "entsoe_factor_b14 " + str(fac_b14) + "\n" + counter += "# HELP entsoe_factor_b16 Factor CO2g/kWh Solar" + "\n" + counter += "# TYPE entsoe_factor_b16 gauge" + "\n" + counter += "entsoe_factor_b16 " + str(fac_b16) + "\n" + counter += "# HELP entsoe_factor_b17 Factor CO2g/kWh Waste" + "\n" + counter += "# TYPE entsoe_factor_b17 gauge" + "\n" + counter += "entsoe_factor_b17 " + str(fac_b17) + "\n" + counter += "# HELP entsoe_factor_b18 Factor CO2g/kWh Wind Offshore" + "\n" + counter += "# TYPE entsoe_factor_b18 gauge" + "\n" + counter += "entsoe_factor_b18 " + str(fac_b18) + "\n" + counter += "# HELP entsoe_factor_b19 Factor CO2g/kWh Wind Onshore" + "\n" + counter += "# TYPE entsoe_factor_b19 gauge" + "\n" + counter += "entsoe_factor_b19 " + str(fac_b19) + "\n" + ####################################### #json_data = json.dumps(data_dict) #print(json_data,file=open('data.json','w')) From 85cc4b12c9f1b4959353d78606aaffcadd36d6e3 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 19:27:56 +0100 Subject: [PATCH 09/18] debug error 500 --- flask/app.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/flask/app.py b/flask/app.py index bef6c17..2f02934 100644 --- a/flask/app.py +++ b/flask/app.py @@ -268,8 +268,8 @@ def metrics(): counter += "entsoe_factor_b19 " + str(fac_b19) + "\n" ####################################### - #json_data = json.dumps(data_dict) - #print(json_data,file=open('data.json','w')) + json_data = json.dumps(data_dict) + print(json_data,file=open('data.json','w')) return counter, 200, {'Content-Type': 'text/plain'} @@ -278,15 +278,15 @@ def not_found_error(error): message = "Couldn't found your requested page" return message, 404, {'Content-Type': 'text/plain'} -@app.errorhandler(500) -def internal_error(error): - message = "Something went wrong" - return message, 500, {'Content-Type': 'text/plain'} +#@app.errorhandler(500) +#def internal_error(error): +# message = "Something went wrong" +# return message, 500, {'Content-Type': 'text/plain'} if __name__ == '__main__': app.run( host = "0.0.0.0", port = 9091, - debug = 0 + debug = 1 ) From f539817dde8d23d71b4a2a5b086f25f50acf22de Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 19:45:08 +0100 Subject: [PATCH 10/18] fix geothermal --- README.md | 1 + flask/app.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b772891..40b7801 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ Ref: CO2 emissions factor: - https://impactful.ninja/the-carbon-footprint-of-biomass-energy/ - https://www.hydropower.org/blog/carbon-emissions-from-hydropower-reservoirs-facts-and-myths - https://www.rte-france.com/en/eco2mix/co2-emissions +- https://www.geothermal-energy.org/pdf/IGAstandard/WGC/2010/0209.pdf ## Credits diff --git a/flask/app.py b/flask/app.py index 2f02934..23f3761 100644 --- a/flask/app.py +++ b/flask/app.py @@ -152,6 +152,7 @@ def metrics(): fac_b02 = 996 fac_b05 = 880 fac_b04 = 378 + fac_b09 = 91 fac_b14 = 39 fac_b19 = 9 fac_b18 = 4 @@ -268,8 +269,8 @@ def metrics(): counter += "entsoe_factor_b19 " + str(fac_b19) + "\n" ####################################### - json_data = json.dumps(data_dict) - print(json_data,file=open('data.json','w')) + #json_data = json.dumps(data_dict) + #print(json_data,file=open('data.json','w')) return counter, 200, {'Content-Type': 'text/plain'} @@ -278,15 +279,15 @@ def not_found_error(error): message = "Couldn't found your requested page" return message, 404, {'Content-Type': 'text/plain'} -#@app.errorhandler(500) -#def internal_error(error): -# message = "Something went wrong" -# return message, 500, {'Content-Type': 'text/plain'} +@app.errorhandler(500) +def internal_error(error): + message = "Something went wrong" + return message, 500, {'Content-Type': 'text/plain'} if __name__ == '__main__': app.run( host = "0.0.0.0", port = 9091, - debug = 1 + debug = 0 ) From d68d4aed1aedca7de023b46aea1345104934438c Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 19:50:34 +0100 Subject: [PATCH 11/18] fix sum --- flask/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/app.py b/flask/app.py index 23f3761..7cf6f22 100644 --- a/flask/app.py +++ b/flask/app.py @@ -176,7 +176,7 @@ def metrics(): ####################################### # CO2 gramm/watt ####################################### - result_co2 = ((int(result_b02) * fac_b02) + (int(result_b04) * fac_b04) + (int(result_b05)) * fac_b05) + ((int(result_b01) * fac_b01) + (int(result_b09) * fac_b09) + (int(result_b10) * fac_b10) + (int(result_b11) * fac_b11) + (int(result_b12) * fac_b12) + (int(result_b16) * fac_b16) + (int(result_b17) * fac_b17) + (int(result_b18) * fac_b18) + (int(result_b19) * fac_b19)) / 1000 / 3600 + result_co2 = ((int(result_b02) * fac_b02) + (int(result_b04) * fac_b04) + (int(result_b05)) * fac_b05) + ((int(result_b01) * fac_b01) + (int(result_b09) * fac_b09) + (int(result_b10) * fac_b10) + (int(result_b11) * fac_b11) + (int(result_b12) * fac_b12) + (int(result_b16) * fac_b16) + (int(result_b17) * fac_b17) + (int(result_b18) * fac_b18) + (int(result_b19) * fac_b19)) / 1000 / 3600 / int(result_sum) ####################################### # Print Out Metrics ####################################### From 64339aa8752722adac9c48c9b8763564a7a40abb Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 02:06:33 +0100 Subject: [PATCH 12/18] fix sum --- flask/app.py | 76 ++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/flask/app.py b/flask/app.py index 7cf6f22..9e11278 100644 --- a/flask/app.py +++ b/flask/app.py @@ -176,11 +176,47 @@ def metrics(): ####################################### # CO2 gramm/watt ####################################### - result_co2 = ((int(result_b02) * fac_b02) + (int(result_b04) * fac_b04) + (int(result_b05)) * fac_b05) + ((int(result_b01) * fac_b01) + (int(result_b09) * fac_b09) + (int(result_b10) * fac_b10) + (int(result_b11) * fac_b11) + (int(result_b12) * fac_b12) + (int(result_b16) * fac_b16) + (int(result_b17) * fac_b17) + (int(result_b18) * fac_b18) + (int(result_b19) * fac_b19)) / 1000 / 3600 / int(result_sum) + result_co2 = ((int(result_b02) * fac_b02) + (int(result_b04) * fac_b04) + (int(result_b05)) * fac_b05) + ((int(result_b01) * fac_b01) + (int(result_b09) * fac_b09) + (int(result_b10) * fac_b10) + (int(result_b11) * fac_b11) + (int(result_b12) * fac_b12) + (int(result_b16) * fac_b16) + (int(result_b17) * fac_b17) + (int(result_b18) * fac_b18) + (int(result_b19) * fac_b19)) / 1000 / 1000 / 3600 ####################################### # Print Out Metrics ####################################### - counter = "# HELP entsoe_generation_b01 Current generation of energy with Biomass in MW" + "\n" + counter = "# HELP entsoe_factor_b01 Factor CO2g/kWh Biomass" + "\n" + counter += "# TYPE entsoe_factor_b01 gauge" + "\n" + counter += "entsoe_factor_b01 " + str(fac_b01) + "\n" + counter += "# HELP entsoe_factor_b02 Factor CO2g/kWh Brown Coal" + "\n" + counter += "# TYPE entsoe_factor_b02 gauge" + "\n" + counter += "entsoe_factor_b02 " + str(fac_b02) + "\n" + counter += "# HELP entsoe_factor_b04 Factor CO2g/kWh Gas" + "\n" + counter += "# TYPE entsoe_factor_b04 gauge" + "\n" + counter += "entsoe_factor_b04 " + str(fac_b04) + "\n" + counter += "# HELP entsoe_factor_b05 Factor CO2g/kWh Hard Coal" + "\n" + counter += "# TYPE entsoe_factor_b05 gauge" + "\n" + counter += "entsoe_factor_b05 " + str(fac_b05) + "\n" + counter += "# HELP entsoe_factor_b10 Factor CO2g/kWh Hydro Pumped Storage" + "\n" + counter += "# TYPE entsoe_factor_b10 gauge" + "\n" + counter += "entsoe_factor_b10 " + str(fac_b10) + "\n" + counter += "# HELP entsoe_factor_b11 Factor CO2g/kWh Hydro Run River" + "\n" + counter += "# TYPE entsoe_factor_b11 gauge" + "\n" + counter += "entsoe_factor_b11 " + str(fac_b11) + "\n" + counter += "# HELP entsoe_factor_b12 Factor CO2g/kWh Hydro Water Reservoir" + "\n" + counter += "# TYPE entsoe_factor_b12 gauge" + "\n" + counter += "entsoe_factor_b12 " + str(fac_b12) + "\n" + counter += "# HELP entsoe_factor_b14 Factor CO2g/kWh Nuclear" + "\n" + counter += "# TYPE entsoe_factor_b14 gauge" + "\n" + counter += "entsoe_factor_b14 " + str(fac_b14) + "\n" + counter += "# HELP entsoe_factor_b16 Factor CO2g/kWh Solar" + "\n" + counter += "# TYPE entsoe_factor_b16 gauge" + "\n" + counter += "entsoe_factor_b16 " + str(fac_b16) + "\n" + counter += "# HELP entsoe_factor_b17 Factor CO2g/kWh Waste" + "\n" + counter += "# TYPE entsoe_factor_b17 gauge" + "\n" + counter += "entsoe_factor_b17 " + str(fac_b17) + "\n" + counter += "# HELP entsoe_factor_b18 Factor CO2g/kWh Wind Offshore" + "\n" + counter += "# TYPE entsoe_factor_b18 gauge" + "\n" + counter += "entsoe_factor_b18 " + str(fac_b18) + "\n" + counter += "# HELP entsoe_factor_b19 Factor CO2g/kWh Wind Onshore" + "\n" + counter += "# TYPE entsoe_factor_b19 gauge" + "\n" + counter += "entsoe_factor_b19 " + str(fac_b19) + "\n" + counter += "# HELP entsoe_generation_b01 Current generation of energy with Biomass in MW" + "\n" counter += "# TYPE entsoe_generation_b01 gauge" + "\n" counter += "entsoe_generation_b01 " + str(result_b01) + "\n" counter += "# HELP entsoe_generation_b02 Current generation of energy with Fossil Brown coal/Lignite in MW" + "\n" @@ -231,42 +267,6 @@ def metrics(): counter += "# HELP entsoe_generation_co2 Current generation of co2 per watt" + "\n" counter += "# TYPE entsoe_generation_co2 gauge" + "\n" counter += "entsoe_generation_co2 " + str(result_co2) + "\n" - counter += "# HELP entsoe_factor_b01 Factor CO2g/kWh Biomass" + "\n" - counter += "# TYPE entsoe_factor_b01 gauge" + "\n" - counter += "entsoe_factor_b01 " + str(fac_b01) + "\n" - counter += "# HELP entsoe_factor_b02 Factor CO2g/kWh Brown Coal" + "\n" - counter += "# TYPE entsoe_factor_b02 gauge" + "\n" - counter += "entsoe_factor_b02 " + str(fac_b02) + "\n" - counter += "# HELP entsoe_factor_b04 Factor CO2g/kWh Gas" + "\n" - counter += "# TYPE entsoe_factor_b04 gauge" + "\n" - counter += "entsoe_factor_b04 " + str(fac_b04) + "\n" - counter += "# HELP entsoe_factor_b05 Factor CO2g/kWh Hard Coal" + "\n" - counter += "# TYPE entsoe_factor_b05 gauge" + "\n" - counter += "entsoe_factor_b05 " + str(fac_b05) + "\n" - counter += "# HELP entsoe_factor_b10 Factor CO2g/kWh Hydro Pumped Storage" + "\n" - counter += "# TYPE entsoe_factor_b10 gauge" + "\n" - counter += "entsoe_factor_b10 " + str(fac_b10) + "\n" - counter += "# HELP entsoe_factor_b11 Factor CO2g/kWh Hydro Run River" + "\n" - counter += "# TYPE entsoe_factor_b11 gauge" + "\n" - counter += "entsoe_factor_b11 " + str(fac_b11) + "\n" - counter += "# HELP entsoe_factor_b12 Factor CO2g/kWh Hydro Water Reservoir" + "\n" - counter += "# TYPE entsoe_factor_b12 gauge" + "\n" - counter += "entsoe_factor_b12 " + str(fac_b12) + "\n" - counter += "# HELP entsoe_factor_b14 Factor CO2g/kWh Nuclear" + "\n" - counter += "# TYPE entsoe_factor_b14 gauge" + "\n" - counter += "entsoe_factor_b14 " + str(fac_b14) + "\n" - counter += "# HELP entsoe_factor_b16 Factor CO2g/kWh Solar" + "\n" - counter += "# TYPE entsoe_factor_b16 gauge" + "\n" - counter += "entsoe_factor_b16 " + str(fac_b16) + "\n" - counter += "# HELP entsoe_factor_b17 Factor CO2g/kWh Waste" + "\n" - counter += "# TYPE entsoe_factor_b17 gauge" + "\n" - counter += "entsoe_factor_b17 " + str(fac_b17) + "\n" - counter += "# HELP entsoe_factor_b18 Factor CO2g/kWh Wind Offshore" + "\n" - counter += "# TYPE entsoe_factor_b18 gauge" + "\n" - counter += "entsoe_factor_b18 " + str(fac_b18) + "\n" - counter += "# HELP entsoe_factor_b19 Factor CO2g/kWh Wind Onshore" + "\n" - counter += "# TYPE entsoe_factor_b19 gauge" + "\n" - counter += "entsoe_factor_b19 " + str(fac_b19) + "\n" ####################################### #json_data = json.dumps(data_dict) From 10752aaaedf23d9fa09ca710349ee22471f38a4a Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 02:17:32 +0100 Subject: [PATCH 13/18] fix sum --- flask/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/app.py b/flask/app.py index 9e11278..4fec4ca 100644 --- a/flask/app.py +++ b/flask/app.py @@ -176,7 +176,7 @@ def metrics(): ####################################### # CO2 gramm/watt ####################################### - result_co2 = ((int(result_b02) * fac_b02) + (int(result_b04) * fac_b04) + (int(result_b05)) * fac_b05) + ((int(result_b01) * fac_b01) + (int(result_b09) * fac_b09) + (int(result_b10) * fac_b10) + (int(result_b11) * fac_b11) + (int(result_b12) * fac_b12) + (int(result_b16) * fac_b16) + (int(result_b17) * fac_b17) + (int(result_b18) * fac_b18) + (int(result_b19) * fac_b19)) / 1000 / 1000 / 3600 + result_co2 = ((int(result_b02) * fac_b02 / 1000 / 1000) + (int(result_b04) * fac_b04 / 1000 / 1000) + (int(result_b05) * fac_b05 / 1000 / 1000) + (int(result_b01) * fac_b01 / 1000 / 1000) + (int(result_b09) * fac_b09 / 1000 / 1000) + (int(result_b10) * fac_b10 / 1000 / 1000) + (int(result_b11) * fac_b11 / 1000 / 1000) + (int(result_b12) * fac_b12 / 1000 / 1000) + (int(result_b16) * fac_b16 / 1000 / 1000) + (int(result_b17) * fac_b17 / 1000 / 1000) + (int(result_b18) * fac_b18 / 1000 / 1000) + (int(result_b19) * fac_b19 / 1000 / 1000)) / 3600 ####################################### # Print Out Metrics ####################################### From f5e6831fb995aa0b4f2f7c3229d836e50a558070 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Fri, 10 Nov 2023 03:22:24 +0100 Subject: [PATCH 14/18] fix sum --- flask/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flask/app.py b/flask/app.py index 4fec4ca..de09d26 100644 --- a/flask/app.py +++ b/flask/app.py @@ -174,9 +174,9 @@ def metrics(): ####################################### result_fos = (int(result_b02) + int(result_b04) + int(result_b05)) / int(result_sum) ####################################### - # CO2 gramm/watt + # CO2 gramm/watt second ####################################### - result_co2 = ((int(result_b02) * fac_b02 / 1000 / 1000) + (int(result_b04) * fac_b04 / 1000 / 1000) + (int(result_b05) * fac_b05 / 1000 / 1000) + (int(result_b01) * fac_b01 / 1000 / 1000) + (int(result_b09) * fac_b09 / 1000 / 1000) + (int(result_b10) * fac_b10 / 1000 / 1000) + (int(result_b11) * fac_b11 / 1000 / 1000) + (int(result_b12) * fac_b12 / 1000 / 1000) + (int(result_b16) * fac_b16 / 1000 / 1000) + (int(result_b17) * fac_b17 / 1000 / 1000) + (int(result_b18) * fac_b18 / 1000 / 1000) + (int(result_b19) * fac_b19 / 1000 / 1000)) / 3600 + result_co2 = ((int(result_b02) * (fac_b02 / 3600) / 1000 / 1000) + (int(result_b04) * (fac_b04 / 3600) / 1000 / 1000) + (int(result_b05) * (fac_b05 / 3600) / 1000 / 1000) + (int(result_b01) * (fac_b01 / 3600) / 1000 / 1000) + (int(result_b09) * (fac_b09/ 3600) / 1000 / 1000) + (int(result_b10) * (fac_b10 / 3600) / 1000 / 1000) + (int(result_b11) * (fac_b11 / 3600) / 1000 / 1000) + (int(result_b12) * (fac_b12 / 3600) / 1000 / 1000) + (int(result_b16) * (fac_b16 / 3600) / 1000 / 1000) + (int(result_b17) * (fac_b17 / 3600) / 1000 / 1000) + (int(result_b18) * (fac_b18 / 3600) / 1000 / 1000) + (int(result_b19) * (fac_b19 / 3600) / 1000 / 1000)) ####################################### # Print Out Metrics ####################################### From 00ddc192bcf804eecb48e5dbbe349d3cc79d51ea Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sat, 11 Nov 2023 16:49:11 +0100 Subject: [PATCH 15/18] fix sum --- flask/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/app.py b/flask/app.py index de09d26..17fef98 100644 --- a/flask/app.py +++ b/flask/app.py @@ -264,7 +264,7 @@ def metrics(): counter += "# HELP entsoe_generation_fos Current generation of fossil energy summary rate" + "\n" counter += "# TYPE entsoe_generation_fos gauge" + "\n" counter += "entsoe_generation_fos " + str(result_fos) + "\n" - counter += "# HELP entsoe_generation_co2 Current generation of co2 per watt" + "\n" + counter += "# HELP entsoe_generation_co2 Current generation of co2 per watt per second" + "\n" counter += "# TYPE entsoe_generation_co2 gauge" + "\n" counter += "entsoe_generation_co2 " + str(result_co2) + "\n" From 643d043f9bf84f739752a9e6b343c6ac868c02a0 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sat, 11 Nov 2023 18:25:02 +0100 Subject: [PATCH 16/18] rename bio metrics in eco --- flask/app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flask/app.py b/flask/app.py index 17fef98..b5a8dd3 100644 --- a/flask/app.py +++ b/flask/app.py @@ -168,7 +168,7 @@ def metrics(): ####################################### # Bio efficience ####################################### - result_bio = (int(result_b01) + int(result_b09) + int(result_b10) + int(result_b11) + int(result_b12) + int(result_b16) + int(result_b17) + int(result_b18) + int(result_b19)) / int(result_sum) + result_eco = (int(result_b01) + int(result_b09) + int(result_b10) + int(result_b11) + int(result_b12) + int(result_b16) + int(result_b17) + int(result_b18) + int(result_b19)) / int(result_sum) ####################################### # Fossil part ####################################### @@ -258,9 +258,9 @@ def metrics(): counter += "# HELP entsoe_generation_sum Current generation of energy summary in MW" + "\n" counter += "# TYPE entsoe_generation_sum gauge" + "\n" counter += "entsoe_generation_sum " + str(result_sum) + "\n" - counter += "# HELP entsoe_generation_bio Current generation of bio energy summary rate" + "\n" - counter += "# TYPE entsoe_generation_bio gauge" + "\n" - counter += "entsoe_generation_bio " + str(result_bio) + "\n" + counter += "# HELP entsoe_generation_eco Current generation of eco energy summary rate" + "\n" + counter += "# TYPE entsoe_generation_eco gauge" + "\n" + counter += "entsoe_generation_eco " + str(result_eco) + "\n" counter += "# HELP entsoe_generation_fos Current generation of fossil energy summary rate" + "\n" counter += "# TYPE entsoe_generation_fos gauge" + "\n" counter += "entsoe_generation_fos " + str(result_fos) + "\n" From fc26d0a1f6a56a3dfd76dc35a61374861a29264c Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sat, 11 Nov 2023 22:11:24 +0100 Subject: [PATCH 17/18] refresh dashboard --- chart/files/caas-carbon-dashboard.json | 419 ++++++------------------- 1 file changed, 96 insertions(+), 323 deletions(-) diff --git a/chart/files/caas-carbon-dashboard.json b/chart/files/caas-carbon-dashboard.json index 007f297..b1f5cf8 100644 --- a/chart/files/caas-carbon-dashboard.json +++ b/chart/files/caas-carbon-dashboard.json @@ -11,7 +11,9 @@ "target": { "limit": 100, "matchAny": false, - "tags": [], + "tags": [ + "sustainable-computing" + ], "type": "dashboard" }, "type": "dashboard" @@ -228,7 +230,7 @@ }, "gridPos": { "h": 12, - "w": 14, + "w": 12, "x": 0, "y": 1 }, @@ -511,16 +513,12 @@ "mode": "absolute", "steps": [ { - "color": "blue", + "color": "green", "value": null }, - { - "color": "#EAB839", - "value": 0.6 - }, { "color": "red", - "value": 0.8 + "value": 80 } ] } @@ -530,10 +528,10 @@ "gridPos": { "h": 6, "w": 7, - "x": 14, + "x": 12, "y": 1 }, - "id": 19, + "id": 20, "options": { "colorMode": "value", "graphMode": "area", @@ -543,7 +541,7 @@ "calcs": [ "mean" ], - "fields": "/^Engergy Index FOS$/", + "fields": "", "values": false }, "textMode": "auto" @@ -556,15 +554,14 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "avg(entsoe_generation_fos)", + "expr": "avg(entsoe_generation_eco)*100", "hide": false, - "legendFormat": "Engergy Index FOS", + "legendFormat": "Engergy Index ECO %", "range": true, "refId": "B" } ], - "title": "Energy Index FOS", - "transformations": [], + "title": "Energy ECO %", "type": "stat" }, { @@ -583,12 +580,44 @@ "mode": "absolute", "steps": [ { - "color": "green", + "color": "#5e5c5e", "value": null }, { - "color": "red", - "value": 80 + "color": "light-red", + "value": 0.1 + }, + { + "color": "dark-orange", + "value": 0.2 + }, + { + "color": "orange", + "value": 0.3 + }, + { + "color": "super-light-orange", + "value": 0.4 + }, + { + "color": "#EAB839", + "value": 0.5 + }, + { + "color": "light-yellow", + "value": 0.6 + }, + { + "color": "super-light-green", + "value": 0.7 + }, + { + "color": "green", + "value": 0.8 + }, + { + "color": "dark-green", + "value": 0.9 } ] } @@ -596,25 +625,26 @@ "overrides": [] }, "gridPos": { - "h": 6, - "w": 7, - "x": 14, - "y": 7 + "h": 12, + "w": 4, + "x": 19, + "y": 1 }, - "id": 20, + "id": 25, "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", + "displayMode": "lcd", + "minVizHeight": 10, + "minVizWidth": 0, "orientation": "auto", "reduceOptions": { "calcs": [ - "mean" + "last" ], "fields": "", "values": false }, - "textMode": "auto" + "showUnfilled": true, + "valueMode": "color" }, "pluginVersion": "10.1.4", "targets": [ @@ -624,15 +654,15 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "avg(entsoe_generation_bio)", + "expr": "avg(entsoe_generation_eco)", "hide": false, - "legendFormat": "Engergy Index ECO", + "legendFormat": "Engergy Index ECO %", "range": true, "refId": "B" } ], - "title": "Energy Index ECO", - "type": "stat" + "title": "Energy Ampel", + "type": "bargauge" }, { "datasource": { @@ -652,70 +682,10 @@ { "color": "blue", "value": null - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 7, - "x": 0, - "y": 13 - }, - "id": 21, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "mean" - ], - "fields": "/^Engergy Index FOS$/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "avg(entsoe_generation_fos)*$fosfactor", - "hide": false, - "legendFormat": "Engergy Index FOS", - "range": true, - "refId": "B" - } - ], - "title": "CO2g/kwh FOS", - "transformations": [], - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Using data from https://transparency.entsoe.eu/", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ + }, { - "color": "blue", - "value": null + "color": "red", + "value": 80 } ] } @@ -725,10 +695,10 @@ "gridPos": { "h": 6, "w": 7, - "x": 7, - "y": 13 + "x": 12, + "y": 7 }, - "id": 23, + "id": 27, "options": { "colorMode": "value", "graphMode": "area", @@ -738,7 +708,7 @@ "calcs": [ "mean" ], - "fields": "/^Engergy Index FOS$/", + "fields": "", "values": false }, "textMode": "auto" @@ -751,15 +721,14 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "avg(entsoe_generation_bio)*$ecofactor", + "expr": "avg(entsoe_generation_fos)*100", "hide": false, - "legendFormat": "Engergy Index FOS", + "legendFormat": "Engergy Index ECO %", "range": true, "refId": "B" } ], - "title": "CO2g/kwh ECO", - "transformations": [], + "title": "Energy FOS %", "type": "stat" }, { @@ -841,9 +810,9 @@ "h": 8, "w": 23, "x": 0, - "y": 19 + "y": 13 }, - "id": 24, + "id": 26, "options": { "legend": { "calcs": [], @@ -864,7 +833,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "avg(entsoe_generation_b02)*$browncoal/1000/1000+avg(entsoe_generation_b05)*$hardcoal/1000/1000+avg(entsoe_generation_b04)*$gas/1000/1000+avg(entsoe_generation_b19)*$windonshore/1000/1000+avg(entsoe_generation_b18)*$windoffshore/1000/1000+avg(entsoe_generation_b16)*$solar/1000/1000+avg(entsoe_generation_b17)*$waste/1000/1000+avg(entsoe_generation_b10)*$hydropump/1000/1000+avg(entsoe_generation_b11)*$hydroriver/1000/1000+avg(entsoe_generation_b12)*$hydrores/1000/1000", + "expr": "avg(entsoe_generation_co2)", "hide": false, "legendFormat": "CO2 emmission", "range": true, @@ -875,208 +844,6 @@ "transformations": [], "type": "timeseries" }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "#EAB839", - "value": 60 - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 19, - "x": 2, - "y": 27 - }, - "id": 18, - "options": { - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showThresholdLabels": false, - "showThresholdMarkers": true, - "text": {} - }, - "pluginVersion": "10.1.4", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b02", - "hide": false, - "legendFormat": "Brown coal", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b04", - "hide": false, - "legendFormat": "Gas", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b05", - "hide": false, - "legendFormat": "Hard coal", - "range": true, - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b09", - "hide": false, - "legendFormat": "Geothermal", - "range": true, - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b10", - "hide": false, - "legendFormat": "Hydro Pump Storage", - "range": true, - "refId": "E" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b11", - "hide": false, - "legendFormat": "Hydro Run-of-river", - "range": true, - "refId": "F" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b12", - "hide": false, - "legendFormat": "Hydro Water Res.", - "range": true, - "refId": "G" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b14", - "hide": false, - "legendFormat": "Nuclear", - "range": true, - "refId": "H" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b16", - "hide": false, - "legendFormat": "Solar", - "range": true, - "refId": "I" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b17", - "hide": false, - "legendFormat": "Waste", - "range": true, - "refId": "J" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b18", - "hide": false, - "legendFormat": "Wind Offshore", - "range": true, - "refId": "K" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "editorMode": "code", - "expr": "entsoe_generation_b19", - "hide": false, - "legendFormat": "Wind Onshore", - "range": true, - "refId": "L" - } - ], - "title": "Energy Generation Index Germany (Detail in MW)", - "transparent": true, - "type": "gauge" - }, { "collapsed": false, "datasource": "prometheus", @@ -1084,7 +851,7 @@ "h": 1, "w": 24, "x": 0, - "y": 33 + "y": 21 }, "id": 8, "panels": [], @@ -1216,7 +983,7 @@ "h": 10, "w": 24, "x": 0, - "y": 34 + "y": 22 }, "id": 16, "options": { @@ -1333,7 +1100,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1409,13 +1177,13 @@ "h": 10, "w": 24, "x": 0, - "y": 44 + "y": 32 }, "id": 22, "options": { "legend": { "calcs": [ - "mean" + "last" ], "displayMode": "table", "placement": "right", @@ -1432,7 +1200,7 @@ { "datasource": "prometheus", "editorMode": "code", - "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_package_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*($fosfactor/1000)*($ecofactor/1000))", + "expr": "sum by (pod_name, container_namespace) (irate(kepler_container_package_joules_total{container_namespace=~\"$namespace\", pod_name=~\"$pod\"}[1m])*(entsoe_generation_co2*3600))", "hide": false, "interval": "", "legendFormat": "{{pod_name}} / {{container_namespace}} / PKG", @@ -1526,7 +1294,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1602,7 +1371,7 @@ "h": 8, "w": 12, "x": 0, - "y": 54 + "y": 42 }, "id": 2, "options": { @@ -1723,7 +1492,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1799,7 +1569,7 @@ "h": 8, "w": 12, "x": 12, - "y": 54 + "y": 42 }, "id": 17, "options": { @@ -1889,7 +1659,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1904,7 +1675,7 @@ "h": 7, "w": 24, "x": 0, - "y": 62 + "y": 50 }, "id": 15, "options": { @@ -1944,7 +1715,9 @@ "refresh": "", "schemaVersion": 38, "style": "dark", - "tags": [], + "tags": [ + "sustainable-computing" + ], "templating": { "list": [ { @@ -2152,13 +1925,13 @@ ] }, "time": { - "from": "now-6h", + "from": "now-5m", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "CaaS Carbon Dashboard", "uid": "NhnWODJ4zIBM", - "version": 18, + "version": 26, "weekStart": "" } From a48a2b223a09faf8408ca846e227e0667fdcc832 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sat, 11 Nov 2023 22:12:00 +0100 Subject: [PATCH 18/18] bump chart/app version --- chart/Chart.yaml | 4 ++-- chart/values.yaml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 4939c45..fe0ac07 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -3,8 +3,8 @@ annotations: catalog.cattle.io/display-name: CaaS Carbon Footprint name: caas-carbon-footprint description: A Helm chart for carbon footprint measurement -version: "0.0.4" -appVersion: "0.3" +version: "0.0.5" +appVersion: "0.0.5" keywords: - monitoring dependencies: diff --git a/chart/values.yaml b/chart/values.yaml index 8ad65d8..336d607 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -21,10 +21,10 @@ kepler: entsoe: enabled: true # apply for token here: https://transparency.entsoe.eu/content/static_content/download?path=/Static%20content/API-Token-Management.pdf - #entsoe_api_key: + #entsoe_api_key: image: repository: mtr.devops.telekom.de/caas/entsoe - tag: 0.0.4 + tag: 0.0.5 pullPolicy: Always podSecurityContext: fsGroup: 1000 @@ -57,10 +57,10 @@ entsoe: serviceMonitor: interval: 10m # hours back when entsoe metrics should collected - # note: unfortunately no real time data for Germany, must be at least one day back - start: 25 - end: 24 + # note: sometimes no real time data for Germany, must be at least one day back + start: 1 + end: 0 # install app in Rancher environment # this will user Rancher defined namespaces and labels rancher: - enabled: true + enabled: true