From 9b6cab154b81cb573ef2b62df989558346314f1f Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 2 Mar 2023 14:53:49 +0100 Subject: [PATCH] Fix grafana dashboard lint script (#5221) * Fix grafana dashboard lint script - Nested dashboard panels are now recursively checked - Panel datasource must point to the datasource variable * Run scripts/validate-grafana-dashboards.sh script --- dashboards/libp2p.json | 12 +-- dashboards/lodestar_block_production.json | 4 +- dashboards/lodestar_debug_gossipsub.json | 50 ++++----- dashboards/lodestar_discv5.json | 48 ++++----- dashboards/lodestar_execution_engine.json | 118 ++++++++++----------- dashboards/lodestar_validator_monitor.json | 2 +- dashboards/lodestar_vm_host.json | 4 +- scripts/lint-grafana-dashboards.mjs | 60 +++++++---- 8 files changed, 158 insertions(+), 140 deletions(-) diff --git a/dashboards/libp2p.json b/dashboards/libp2p.json index 70014964ad26..dcf6b6e69d83 100644 --- a/dashboards/libp2p.json +++ b/dashboards/libp2p.json @@ -698,7 +698,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -775,7 +775,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", "expr": "rate(libp2p_tcp_listener_events_total[$rate_interval])", @@ -790,7 +790,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -867,7 +867,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", "expr": "rate(libp2p_tcp_listener_errors_total[$rate_interval])", @@ -882,7 +882,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -977,7 +977,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", "expr": "libp2p_tcp_listener_status_info", diff --git a/dashboards/lodestar_block_production.json b/dashboards/lodestar_block_production.json index 987612a71f07..2c586efbb186 100644 --- a/dashboards/lodestar_block_production.json +++ b/dashboards/lodestar_block_production.json @@ -47,7 +47,7 @@ "collapsed": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -359,7 +359,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { diff --git a/dashboards/lodestar_debug_gossipsub.json b/dashboards/lodestar_debug_gossipsub.json index 58202229c742..46feb2aed866 100644 --- a/dashboards/lodestar_debug_gossipsub.json +++ b/dashboards/lodestar_debug_gossipsub.json @@ -96,7 +96,7 @@ "collapsed": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -236,7 +236,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -295,7 +295,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -372,7 +372,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -439,7 +439,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -499,7 +499,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -789,7 +789,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1059,7 +1059,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1152,7 +1152,7 @@ "dashes": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1240,7 +1240,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -1257,7 +1257,7 @@ "dashes": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1303,7 +1303,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "expr": "delta(lodestar_gossip_validation_queue_job_wait_time_seconds_sum[$rate_interval])/delta(lodestar_gossip_validation_queue_job_wait_time_seconds_count[$rate_interval])", "format": "time_series", @@ -1345,7 +1345,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1423,7 +1423,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "expr": "delta(lodestar_gossip_validation_queue_dropped_jobs_total[$rate_interval])/(delta(lodestar_gossip_validation_queue_job_time_seconds_count[$rate_interval])+delta(lodestar_gossip_validation_queue_dropped_jobs_total[$rate_interval]))", "interval": "", @@ -1545,7 +1545,7 @@ "dashes": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1591,7 +1591,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "expr": "lodestar_gossip_validation_queue_length", "interval": "", @@ -1646,7 +1646,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -2055,7 +2055,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -2820,7 +2820,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -3402,7 +3402,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -4231,7 +4231,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -4972,7 +4972,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -6867,7 +6867,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -7537,7 +7537,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -8210,7 +8210,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, diff --git a/dashboards/lodestar_discv5.json b/dashboards/lodestar_discv5.json index baa939580fc9..3a687955c62a 100644 --- a/dashboards/lodestar_discv5.json +++ b/dashboards/lodestar_discv5.json @@ -47,7 +47,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -152,7 +152,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -247,7 +247,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -341,7 +341,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -436,7 +436,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -531,7 +531,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -625,7 +625,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -825,7 +825,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -919,7 +919,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1013,7 +1013,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1106,7 +1106,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1200,7 +1200,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1294,7 +1294,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1388,7 +1388,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1621,7 +1621,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1726,7 +1726,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1819,7 +1819,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1911,7 +1911,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2004,7 +2004,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2106,7 +2106,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2184,7 +2184,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", "expr": "rate(lodestar_discv5_decode_enr_error_count[$rate_interval]) / rate(lodestar_discv5_decode_enr_attempt_count[$rate_interval])", @@ -2200,7 +2200,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2302,7 +2302,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", "expr": "rate(lodestar_discv5_decode_enr_error_count[$rate_interval])", @@ -2313,7 +2313,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", "expr": "rate(lodestar_discv5_decode_enr_attempt_count[$rate_interval])", diff --git a/dashboards/lodestar_execution_engine.json b/dashboards/lodestar_execution_engine.json index ac60eb23dab5..68b43a73e5a3 100644 --- a/dashboards/lodestar_execution_engine.json +++ b/dashboards/lodestar_execution_engine.json @@ -47,7 +47,7 @@ "collapsed": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -72,7 +72,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -167,7 +167,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -264,7 +264,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -361,7 +361,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -458,7 +458,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -555,7 +555,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -653,7 +653,7 @@ "collapsed": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -678,7 +678,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -776,7 +776,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -836,7 +836,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -932,7 +932,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1028,7 +1028,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1125,7 +1125,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1233,7 +1233,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1326,7 +1326,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1419,7 +1419,7 @@ "collapsed": false, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -1444,7 +1444,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1564,7 +1564,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1638,7 +1638,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1698,7 +1698,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1759,7 +1759,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1822,7 +1822,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -1942,7 +1942,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2039,7 +2039,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2158,7 +2158,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2250,7 +2250,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2356,7 +2356,7 @@ "collapsed": true, "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 1, @@ -2369,7 +2369,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2435,7 +2435,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_status", @@ -2451,7 +2451,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2501,7 +2501,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_ttd", @@ -2518,7 +2518,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2569,7 +2569,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "(lodestar_eth1_merge_ttd - lodestar_eth1_latest_block_ttd)\n/\nrate(lodestar_eth1_latest_block_ttd[32m])", @@ -2585,7 +2585,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2636,7 +2636,7 @@ { "datasource": { "type": "prometheus", - "uid": "Prometheus" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "(time()\n+\n(lodestar_eth1_merge_ttd - lodestar_eth1_latest_block_ttd)\n/\nrate(lodestar_eth1_latest_block_ttd[32m])\n)*1000", @@ -2652,7 +2652,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2696,7 +2696,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_parent_blocks_fetched_total", @@ -2712,7 +2712,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2762,7 +2762,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_block_details", @@ -2779,7 +2779,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2829,7 +2829,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_block_details", @@ -2846,7 +2846,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2889,7 +2889,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_td_factor", @@ -2905,7 +2905,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -2948,7 +2948,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_latest_block_ttd", @@ -2964,7 +2964,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -3008,7 +3008,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_latest_block_timestamp * 1000", @@ -3024,7 +3024,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -3067,7 +3067,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_latest_block_number", @@ -3083,7 +3083,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -3126,7 +3126,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_get_terminal_pow_block_promise_cache_hit_total", @@ -3142,7 +3142,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -3192,7 +3192,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_block_details", @@ -3209,7 +3209,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -3286,7 +3286,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_latest_block_ttd", @@ -3298,7 +3298,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "lodestar_eth1_merge_ttd", @@ -3314,7 +3314,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "fieldConfig": { "defaults": { @@ -3391,7 +3391,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "exemplar": false, "expr": "rate(lodestar_eth1_poll_merge_block_errors_total[$rate_interval])", diff --git a/dashboards/lodestar_validator_monitor.json b/dashboards/lodestar_validator_monitor.json index ecb599409e7e..50370cbd4f34 100644 --- a/dashboards/lodestar_validator_monitor.json +++ b/dashboards/lodestar_validator_monitor.json @@ -312,7 +312,7 @@ { "datasource": { "type": "prometheus", - "uid": "prometheus_local" + "uid": "${DS_PROMETHEUS}" }, "description": "", "fieldConfig": { diff --git a/dashboards/lodestar_vm_host.json b/dashboards/lodestar_vm_host.json index b0a145341e1d..3b9df47efc8a 100644 --- a/dashboards/lodestar_vm_host.json +++ b/dashboards/lodestar_vm_host.json @@ -4251,7 +4251,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "exemplar": true, + "exemplar": false, "expr": "lodestar_db_size_bytes_total", "interval": "", "legendFormat": "db size", @@ -4368,7 +4368,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "exemplar": true, + "exemplar": false, "expr": "validator_db_size_bytes_total", "interval": "", "legendFormat": "db size", diff --git a/scripts/lint-grafana-dashboards.mjs b/scripts/lint-grafana-dashboards.mjs index 65531878b9d5..4082300d53c3 100755 --- a/scripts/lint-grafana-dashboards.mjs +++ b/scripts/lint-grafana-dashboards.mjs @@ -32,7 +32,9 @@ if (filenames.length === 0) throw Error(`Empty dir ${dirpath}`); * @property {Templating} [templating] * * @typedef {Object} Panel + * @property {Datasource} [datasource] * @property {Target[]} [targets] + * @property {Panel[]} [panels] * * @typedef {Object} Target * @property {Datasource} [datasource] @@ -74,27 +76,7 @@ for (const filename of filenames) { const json = JSON.parse(jsonStr); if (json.panels) { - for (const panel of json.panels) { - if (panel.targets) { - for (const target of panel.targets) { - // All panels must point to the datasource variable - if (target.datasource) { - target.datasource.type = "prometheus"; - target.datasource.uid = "${DS_PROMETHEUS}"; - } - - // Disable exemplar - if (target.exemplar !== undefined) { - target.exemplar = false; - } - - // Force usage of interval variable - if (target.expr) { - target.expr.replace(/\$__rate_interval/g, `$${variableNameRateInterval}`); - } - } - } - } + assertPanels(json.panels); } const LODESTAR_TAG = "lodestar"; @@ -226,3 +208,39 @@ function assertTemplatingListItemContent(json, varName, item) { json.templating.list[index] = item; } } + +/** + * @param {Panel[]} panels + */ +function assertPanels(panels) { + for (const panel of panels) { + // Panel datasource must point to the datasource variable + if (panel.datasource) { + panel.datasource.type = "prometheus"; + panel.datasource.uid = `\${${variableNameDatasource}}`; + } + if (panel.targets) { + for (const target of panel.targets) { + // All panels must point to the datasource variable + if (target.datasource) { + target.datasource.type = "prometheus"; + target.datasource.uid = `\${${variableNameDatasource}}`; + } + + // Disable exemplar + if (target.exemplar !== undefined) { + target.exemplar = false; + } + + // Force usage of interval variable + if (target.expr) { + target.expr.replace(/\$__rate_interval/g, `$${variableNameRateInterval}`); + } + } + } + // Recursively check nested panels + if (panel.panels) { + assertPanels(panel.panels); + } + } +}