From c9895953e485168aeb61e26843ed73bd8f7b67a4 Mon Sep 17 00:00:00 2001 From: Ammar Arif Date: Tue, 21 Jan 2025 17:33:40 -0500 Subject: [PATCH] docs(katana): update monitoring example (#2942) --- crates/katana/monitoring/docker-compose.yml | 11 +- .../grafana/dashboards/default.yaml | 12 ++ .../grafana/dashboards/overview.json | 158 ++++++------------ .../{prometheus.yml => default.yml} | 2 +- .../katana/monitoring/prometheus/config.yml | 1 + 5 files changed, 77 insertions(+), 107 deletions(-) create mode 100644 crates/katana/monitoring/grafana/dashboards/default.yaml rename crates/katana/monitoring/grafana/datasources/{prometheus.yml => default.yml} (70%) diff --git a/crates/katana/monitoring/docker-compose.yml b/crates/katana/monitoring/docker-compose.yml index 09eada50b6..d9cdc9eb19 100644 --- a/crates/katana/monitoring/docker-compose.yml +++ b/crates/katana/monitoring/docker-compose.yml @@ -3,7 +3,7 @@ name: "katana" services: katana: restart: unless-stopped - image: ghcr.io/dojoengine/dojo + image: ghcr.io/dojoengine/dojo:v1.0.12 ports: - "5050:5050" # rpc - "9001:9001" # metrics @@ -15,7 +15,7 @@ services: prometheus: restart: unless-stopped - image: prom/prometheus + image: prom/prometheus:v3.1.0 depends_on: - katana ports: @@ -29,7 +29,7 @@ services: grafana: restart: unless-stopped - image: grafana/grafana + image: grafana/grafana:11.4.0 depends_on: - prometheus ports: @@ -38,6 +38,11 @@ services: - ./grafana/dashboards:/etc/grafana/provisioning/dashboards - ./grafana/datasources:/etc/grafana/provisioning/datasources - grafanadata:/var/lib/grafana + environment: + - GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/overview.json + - GF_SECURITY_ADMIN_PASSWORD=admin + - GF_SECURITY_ADMIN_USER=admin + - GF_AUTH_ANONYMOUS_ENABLED=true volumes: prometheusdata: diff --git a/crates/katana/monitoring/grafana/dashboards/default.yaml b/crates/katana/monitoring/grafana/dashboards/default.yaml new file mode 100644 index 0000000000..e9c69410ce --- /dev/null +++ b/crates/katana/monitoring/grafana/dashboards/default.yaml @@ -0,0 +1,12 @@ +apiVersion: 1 + +providers: + - name: "Katana" + orgId: 1 + folder: "" + type: file + disableDeletion: false + updateIntervalSeconds: 10 + allowUiUpdates: true + options: + path: /etc/grafana/provisioning/dashboards diff --git a/crates/katana/monitoring/grafana/dashboards/overview.json b/crates/katana/monitoring/grafana/dashboards/overview.json index de6e3946fc..faf2b375e1 100644 --- a/crates/katana/monitoring/grafana/dashboards/overview.json +++ b/crates/katana/monitoring/grafana/dashboards/overview.json @@ -1,14 +1,5 @@ { - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], + "__inputs": [], "__requires": [ { @@ -110,10 +101,7 @@ "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -192,7 +180,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -208,7 +196,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -225,7 +213,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -242,7 +230,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -259,7 +247,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -276,7 +264,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -293,7 +281,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -310,7 +298,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -327,7 +315,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -344,7 +332,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -361,7 +349,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -378,7 +366,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -395,7 +383,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -412,7 +400,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -429,7 +417,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -446,7 +434,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -463,7 +451,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -480,7 +468,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -497,7 +485,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -514,7 +502,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -531,7 +519,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -548,7 +536,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -567,10 +555,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "Total storage capacity of the database", "fieldConfig": { "defaults": { @@ -622,7 +607,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -639,7 +624,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -669,10 +654,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -752,7 +734,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -783,10 +765,7 @@ "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "The total amount of L1 gas that has been processed", "fieldConfig": { "defaults": { @@ -865,7 +844,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -883,10 +862,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "The total amount of Cairo steps that has been processed", "fieldConfig": { "defaults": { @@ -965,7 +941,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "builder", @@ -996,10 +972,7 @@ "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "", "fieldConfig": { "defaults": { @@ -1105,7 +1078,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "disableTextWrap": false, "editorMode": "code", @@ -1123,10 +1096,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "", "fieldConfig": { "defaults": { @@ -1197,7 +1167,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "code", "exemplar": false, @@ -1213,10 +1183,7 @@ "type": "heatmap" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1296,7 +1263,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "code", "expr": "max(max_over_time(katana_rpc_server_calls_time_seconds[$__rate_interval])) by (method) > 0", @@ -1310,10 +1277,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "", "fieldConfig": { "defaults": { @@ -1384,7 +1348,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "code", "exemplar": false, @@ -1413,10 +1377,7 @@ "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "100% = 1 core", "fieldConfig": { "defaults": { @@ -1496,7 +1457,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "avg(rate(katana_process_cpu_seconds_total{instance=~\"$instance\"}[1m]))", @@ -1510,10 +1471,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "", "fieldConfig": { "defaults": { @@ -1593,7 +1551,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "code", "expr": "katana_process_resident_memory_bytes{instance=~\"$instance\"}", @@ -1607,10 +1565,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1689,7 +1644,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_jemalloc_active{instance=~\"$instance\"}", @@ -1701,7 +1656,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_jemalloc_allocated{instance=~\"$instance\"}", @@ -1714,7 +1669,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_jemalloc_mapped{instance=~\"$instance\"}", @@ -1727,7 +1682,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_jemalloc_metadata{instance=~\"$instance\"}", @@ -1740,7 +1695,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_jemalloc_resident{instance=~\"$instance\"}", @@ -1753,7 +1708,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_jemalloc_retained{instance=~\"$instance\"}", @@ -1768,10 +1723,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, + "datasource": "Prometheus", "description": "", "fieldConfig": { "defaults": { @@ -1851,7 +1803,7 @@ { "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "editorMode": "builder", "expr": "katana_process_open_fds{instance=~\"$instance\"}", @@ -1875,7 +1827,7 @@ "current": {}, "datasource": { "type": "prometheus", - "uid": "${DS_PROMETHEUS}" + "uid": "Prometheus" }, "definition": "query_result(up)", "hide": 0, diff --git a/crates/katana/monitoring/grafana/datasources/prometheus.yml b/crates/katana/monitoring/grafana/datasources/default.yml similarity index 70% rename from crates/katana/monitoring/grafana/datasources/prometheus.yml rename to crates/katana/monitoring/grafana/datasources/default.yml index 6561365f85..1de24f833f 100644 --- a/crates/katana/monitoring/grafana/datasources/prometheus.yml +++ b/crates/katana/monitoring/grafana/datasources/default.yml @@ -4,5 +4,5 @@ datasources: - name: Prometheus type: prometheus access: proxy - url: $PROMETHEUS_URL + url: "http://host.docker.internal:9090" editable: true diff --git a/crates/katana/monitoring/prometheus/config.yml b/crates/katana/monitoring/prometheus/config.yml index 9916fa536c..894f053642 100644 --- a/crates/katana/monitoring/prometheus/config.yml +++ b/crates/katana/monitoring/prometheus/config.yml @@ -4,3 +4,4 @@ scrape_configs: scrape_interval: 5s static_configs: - targets: ["host.docker.internal:9001", "localhost:9100"] + fallback_scrape_protocol: PrometheusText1.0.0