From 70c1ceebbd89aa4b8137c4606f8cd6adfee82f4d Mon Sep 17 00:00:00 2001 From: josedev-union <70741025+josedev-union@users.noreply.github.com> Date: Fri, 18 Aug 2023 22:37:02 +0200 Subject: [PATCH] chore: Use templating for datasource in grafana dashboard file (#2542) ### Description This PR uses templating for datasource. i.e. no need to keep inside the dashboard json file which should be manually replaced by users. ### Drive-by changes ### Related issues ### Backward compatibility ### Testing Co-authored-by: josedev-union Co-authored-by: Mattie Conover --- tools/grafana/README.md | 9 ++-- tools/grafana/validator-dashboard.json | 75 ++++++++++++++++---------- 2 files changed, 51 insertions(+), 33 deletions(-) diff --git a/tools/grafana/README.md b/tools/grafana/README.md index 0e331494e..cdae78526 100644 --- a/tools/grafana/README.md +++ b/tools/grafana/README.md @@ -5,11 +5,10 @@ updated when we want to update our published templates. ## Importing -1. replace all instances of `` with your prometheus deployment name in grafana -2. Create a new dashboard in grafana -3. Select the gear icon "dashboard settings" -4. Select "JSON Model" -5. Copy/paste from the "\*.json" file +1. Create a new dashboard in grafana +2. Select the gear icon "dashboard settings" +3. Select "JSON Model" +4. Copy/paste from the "\*.json" file ## Exporting diff --git a/tools/grafana/validator-dashboard.json b/tools/grafana/validator-dashboard.json index 0b5b2e940..ef334ba10 100644 --- a/tools/grafana/validator-dashboard.json +++ b/tools/grafana/validator-dashboard.json @@ -42,7 +42,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "Seconds between blocks for each chain", "fieldConfig": { @@ -119,7 +119,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "1 / avg by(chain)(rate(hyperlane_block_height{hyperlane_deployment=~\"$deployment\",chain=~\"$chain\",agent=\"validator\"}[$__rate_interval]))", @@ -135,7 +135,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "fieldConfig": { "defaults": { @@ -181,7 +181,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "max(hyperlane_block_height{agent=\"validator\", }) by (chain)", @@ -196,7 +196,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "fieldConfig": { "defaults": { @@ -242,7 +242,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "exemplar": false, @@ -260,7 +260,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "Count of messages signed per time window", "fieldConfig": { @@ -333,7 +333,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "max by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_processed\"}) - max by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_processed\"} offset $bucket)", @@ -349,7 +349,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "If running multiple validator instances, the difference between the latest and earliest observed checkpoints for each chain.", "fieldConfig": { @@ -424,7 +424,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "max by(chain) (hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_observed\"}) - min by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_observed\"})", @@ -440,7 +440,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "fieldConfig": { "defaults": { @@ -523,7 +523,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "exemplar": false, @@ -541,7 +541,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "fieldConfig": { "defaults": { @@ -612,7 +612,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "exemplar": false, @@ -629,7 +629,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "Total number of contract calls made by chain for a period", "fieldConfig": { @@ -706,7 +706,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "sum by (chain)(increase(hyperlane_contract_call_count{ chain=~\"$chain\", agent=\"validator\"}[$bucket]))", @@ -722,7 +722,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "The rate at which we are making contract calls.", "fieldConfig": { @@ -799,7 +799,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "sum by (chain) (rate(hyperlane_contract_call_count{agent=\"validator\"}[$__rate_interval]))", @@ -815,7 +815,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "The average contract call duration by chain", "fieldConfig": { @@ -892,7 +892,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "avg by (chain)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]) - rate(hyperlane_contract_call_duration_seconds{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))", @@ -918,7 +918,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "", "fieldConfig": { @@ -994,7 +994,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "sum by (contract_name, function_name)(increase(hyperlane_contract_call_count{ chain=~\"$chain\", agent=\"validator\"}[$bucket]))", @@ -1010,7 +1010,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "", "fieldConfig": { @@ -1086,7 +1086,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "sum by (function_name,contract_name)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))", @@ -1102,7 +1102,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "description": "", "fieldConfig": { @@ -1178,7 +1178,7 @@ { "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "editorMode": "code", "expr": "avg by (function_name,contract_name)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]) - rate(hyperlane_contract_call_duration_seconds{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))", @@ -1204,6 +1204,25 @@ "tags": [], "templating": { "list": [ + { + "current": { + "selected": true, + "text": "default", + "value": "default" + }, + "hide": 0, + "includeAll": false, + "label": "Data Source", + "multi": false, + "name": "datasource", + "options": [], + "query": "prometheus", + "queryValue": "", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, { "auto": true, "auto_count": 30, @@ -1277,7 +1296,7 @@ }, "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "definition": "label_values(hyperlane_block_height, hyperlane_deployment)", "hide": 0, @@ -1308,7 +1327,7 @@ }, "datasource": { "type": "prometheus", - "uid": "" + "uid": "$datasource" }, "definition": "label_values(hyperlane_block_height{hyperlane_deployment=~\"$deployment\"}, chain)", "hide": 0,