From 734de8a51a411eeccd96cbf08cc0cdc9c8bd1303 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Wed, 1 Mar 2023 15:31:00 +0100 Subject: [PATCH] Add dashboard variables to customize beacon/validator job name (#5211) Hard coded job names need to be kept to work with dashboard provisioning as for some reason grafana does not use default values when dashboard is automatically provisioned. See https://github.com/grafana/grafana/issues/10786 --- dashboards/lodestar_block_processor.json | 32 +++++++++- dashboards/lodestar_summary.json | 76 ++++++++++++++++++++--- dashboards/lodestar_validator_client.json | 38 ++++++++++-- dashboards/lodestar_vm_host.json | 42 ++++++++++--- 4 files changed, 164 insertions(+), 24 deletions(-) diff --git a/dashboards/lodestar_block_processor.json b/dashboards/lodestar_block_processor.json index 83f4cf248a6b..c2dc2094a06b 100644 --- a/dashboards/lodestar_block_processor.json +++ b/dashboards/lodestar_block_processor.json @@ -7,6 +7,13 @@ "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" + }, + { + "name": "VAR_BEACON_JOB", + "type": "constant", + "label": "Beacon node job name", + "value": "beacon", + "description": "" } ], "__elements": {}, @@ -3717,7 +3724,7 @@ { "matcher": { "id": "byName", - "options": "beacon_fork_choice_errors_total{group=\"beta\", instance=\"contabo-13\", job=\"beacon\"}" + "options": "beacon_fork_choice_errors_total{group=\"beta\", instance=\"contabo-13\", job=~\"$beacon_job|beacon\"}" }, "properties": [ { @@ -3967,7 +3974,7 @@ { "matcher": { "id": "byName", - "options": "{job=\"beacon\"}" + "options": "{job=~\"$beacon_job|beacon\"}" }, "properties": [ { @@ -4153,6 +4160,27 @@ "name": "Filters", "skipUrlSync": false, "type": "adhoc" + }, + { + "description": "Job name used in Prometheus config to scrape Beacon node", + "hide": 2, + "label": "Beacon node job name", + "name": "beacon_job", + "query": "${VAR_BEACON_JOB}", + "skipUrlSync": false, + "type": "constant", + "current": { + "value": "${VAR_BEACON_JOB}", + "text": "${VAR_BEACON_JOB}", + "selected": false + }, + "options": [ + { + "value": "${VAR_BEACON_JOB}", + "text": "${VAR_BEACON_JOB}", + "selected": false + } + ] } ] }, diff --git a/dashboards/lodestar_summary.json b/dashboards/lodestar_summary.json index 5945a4ab420c..f194999a3b48 100644 --- a/dashboards/lodestar_summary.json +++ b/dashboards/lodestar_summary.json @@ -7,6 +7,20 @@ "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" + }, + { + "name": "VAR_BEACON_JOB", + "type": "constant", + "label": "Beacon node job name", + "value": "beacon", + "description": "" + }, + { + "name": "VAR_VALIDATOR_JOB", + "type": "constant", + "label": "Validator client job name", + "value": "validator", + "description": "" } ], "__elements": {}, @@ -645,7 +659,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "rate(process_cpu_user_seconds_total{job=\"beacon\"} [1m])", + "expr": "rate(process_cpu_user_seconds_total{job=~\"$beacon_job|beacon\"} [1m])", "interval": "", "legendFormat": "", "refId": "A" @@ -705,7 +719,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "process_heap_bytes{job=\"beacon\"}", + "expr": "process_heap_bytes{job=~\"$beacon_job|beacon\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -769,7 +783,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "process_start_time_seconds{job=\"beacon\"}*1000", + "expr": "process_start_time_seconds{job=~\"$beacon_job|beacon\"}*1000", "instant": false, "interval": "", "legendFormat": "", @@ -913,7 +927,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "lodestar_version{job=\"beacon\"}", + "expr": "lodestar_version{job=~\"$beacon_job|beacon\"}", "format": "time_series", "instant": true, "interval": "", @@ -973,7 +987,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "lodestar_version{job=\"beacon\"}", + "expr": "lodestar_version{job=~\"$beacon_job|beacon\"}", "format": "time_series", "instant": true, "interval": "", @@ -1042,7 +1056,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "nodejs_version_info{job=\"beacon\"}", + "expr": "nodejs_version_info{job=~\"$beacon_job|beacon\"}", "instant": true, "interval": "", "legendFormat": "{{version}}", @@ -1704,7 +1718,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "sum(rate(nodejs_gc_duration_seconds_sum{job=\"beacon\"} [$rate_interval])) by (instance)", + "expr": "sum(rate(nodejs_gc_duration_seconds_sum{job=~\"$beacon_job|beacon\"} [$rate_interval])) by (instance)", "hide": false, "interval": "", "legendFormat": "gc_duration_sum", @@ -1716,7 +1730,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "sum(rate(nodejs_gc_pause_seconds_total{job=\"beacon\"} [$rate_interval])) by (instance)", + "expr": "sum(rate(nodejs_gc_pause_seconds_total{job=~\"$beacon_job|beacon\"} [$rate_interval])) by (instance)", "hide": false, "interval": "", "legendFormat": "gc_pause_sum", @@ -1845,7 +1859,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "avg_over_time( scrape_duration_seconds{job=\"beacon\"} [$rate_interval])", + "expr": "avg_over_time( scrape_duration_seconds{job=~\"$beacon_job|beacon\"} [$rate_interval])", "hide": false, "interval": "", "legendFormat": "prometheus_beacon_scrape_roundtrip", @@ -1857,7 +1871,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "avg_over_time( scrape_duration_seconds{job=\"validator\"} [$rate_interval])", + "expr": "avg_over_time( scrape_duration_seconds{job=~\"$validator_job|validator\"} [$rate_interval])", "hide": false, "interval": "", "legendFormat": "prometheus_validator_scrape_roundtrip", @@ -3073,6 +3087,48 @@ "name": "Filters", "skipUrlSync": false, "type": "adhoc" + }, + { + "description": "Job name used in Prometheus config to scrape Beacon node", + "hide": 2, + "label": "Beacon node job name", + "name": "beacon_job", + "query": "${VAR_BEACON_JOB}", + "skipUrlSync": false, + "type": "constant", + "current": { + "value": "${VAR_BEACON_JOB}", + "text": "${VAR_BEACON_JOB}", + "selected": false + }, + "options": [ + { + "value": "${VAR_BEACON_JOB}", + "text": "${VAR_BEACON_JOB}", + "selected": false + } + ] + }, + { + "description": "Job name used in Prometheus config to scrape Validator client", + "hide": 2, + "label": "Validator client job name", + "name": "validator_job", + "query": "${VAR_VALIDATOR_JOB}", + "skipUrlSync": false, + "type": "constant", + "current": { + "value": "${VAR_VALIDATOR_JOB}", + "text": "${VAR_VALIDATOR_JOB}", + "selected": false + }, + "options": [ + { + "value": "${VAR_VALIDATOR_JOB}", + "text": "${VAR_VALIDATOR_JOB}", + "selected": false + } + ] } ] }, diff --git a/dashboards/lodestar_validator_client.json b/dashboards/lodestar_validator_client.json index fc8e4faecc0a..7ba5c119e9ae 100644 --- a/dashboards/lodestar_validator_client.json +++ b/dashboards/lodestar_validator_client.json @@ -7,6 +7,13 @@ "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" + }, + { + "name": "VAR_VALIDATOR_JOB", + "type": "constant", + "label": "Validator client job name", + "value": "validator", + "description": "" } ], "__elements": {}, @@ -270,7 +277,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "lodestar_version{job=\"validator\"}", + "expr": "lodestar_version{job=~\"$validator_job|validator\"}", "format": "time_series", "instant": true, "interval": "", @@ -339,7 +346,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "nodejs_version_info{job=\"validator\"}", + "expr": "nodejs_version_info{job=~\"$validator_job|validator\"}", "instant": true, "interval": "", "legendFormat": "{{version}}", @@ -406,7 +413,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "lodestar_version{job=\"validator\"}", + "expr": "lodestar_version{job=~\"$validator_job|validator\"}", "format": "time_series", "instant": true, "interval": "", @@ -539,7 +546,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "process_heap_bytes{job=\"validator\"}", + "expr": "process_heap_bytes{job=~\"$validator_job|validator\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -605,7 +612,7 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "nodejs_heap_size_used_bytes{job=\"validator\"}", + "expr": "nodejs_heap_size_used_bytes{job=~\"$validator_job|validator\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2179,6 +2186,27 @@ "name": "Filters", "skipUrlSync": false, "type": "adhoc" + }, + { + "description": "Job name used in Prometheus config to scrape Validator client", + "hide": 2, + "label": "Validator client job name", + "name": "validator_job", + "query": "${VAR_VALIDATOR_JOB}", + "skipUrlSync": false, + "type": "constant", + "current": { + "value": "${VAR_VALIDATOR_JOB}", + "text": "${VAR_VALIDATOR_JOB}", + "selected": false + }, + "options": [ + { + "value": "${VAR_VALIDATOR_JOB}", + "text": "${VAR_VALIDATOR_JOB}", + "selected": false + } + ] } ] }, diff --git a/dashboards/lodestar_vm_host.json b/dashboards/lodestar_vm_host.json index a672e6be6345..b0a145341e1d 100644 --- a/dashboards/lodestar_vm_host.json +++ b/dashboards/lodestar_vm_host.json @@ -7,6 +7,13 @@ "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" + }, + { + "name": "VAR_BEACON_JOB", + "type": "constant", + "label": "Beacon node job name", + "value": "beacon", + "description": "" } ], "__elements": {}, @@ -420,7 +427,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "process_heap_bytes{job=\"beacon\"}", + "expr": "process_heap_bytes{job=~\"$beacon_job|beacon\"}", "interval": "", "legendFormat": "process_heap_bytes", "range": true, @@ -433,7 +440,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "nodejs_heap_size_total_bytes{job=\"beacon\"}", + "expr": "nodejs_heap_size_total_bytes{job=~\"$beacon_job|beacon\"}", "hide": false, "interval": "", "legendFormat": "heap_total", @@ -447,7 +454,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "nodejs_heap_size_used_bytes{job=\"beacon\"}", + "expr": "nodejs_heap_size_used_bytes{job=~\"$beacon_job|beacon\"}", "hide": false, "interval": "", "legendFormat": "heap_used", @@ -461,7 +468,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "nodejs_external_memory_bytes{job=\"beacon\"}", + "expr": "nodejs_external_memory_bytes{job=~\"$beacon_job|beacon\"}", "hide": false, "interval": "", "legendFormat": "external_memory", @@ -475,7 +482,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "process_resident_memory_bytes{job=\"beacon\"}", + "expr": "process_resident_memory_bytes{job=~\"$beacon_job|beacon\"}", "hide": false, "interval": "", "legendFormat": "rss", @@ -748,7 +755,7 @@ { "matcher": { "id": "byName", - "options": "{job=\"beacon\"}" + "options": "{job=~\"$beacon_job|beacon\"}" }, "properties": [ { @@ -2816,7 +2823,7 @@ { "matcher": { "id": "byName", - "options": "{job=\"beacon\"}" + "options": "{job=~\"$beacon_job|beacon\"}" }, "properties": [ { @@ -4615,6 +4622,27 @@ "name": "Filters", "skipUrlSync": false, "type": "adhoc" + }, + { + "description": "Job name used in Prometheus config to scrape Beacon node", + "hide": 2, + "label": "Beacon node job name", + "name": "beacon_job", + "query": "${VAR_BEACON_JOB}", + "skipUrlSync": false, + "type": "constant", + "current": { + "value": "${VAR_BEACON_JOB}", + "text": "${VAR_BEACON_JOB}", + "selected": false + }, + "options": [ + { + "value": "${VAR_BEACON_JOB}", + "text": "${VAR_BEACON_JOB}", + "selected": false + } + ] } ] },