From 45452a94ddff8635f9e6696e4f13d9dd31896b96 Mon Sep 17 00:00:00 2001 From: avilagaston9 Date: Tue, 30 Jul 2024 13:23:24 -0300 Subject: [PATCH] refactor: adds metrics_port --- Makefile | 2 +- config/runtime.exs | 9 ++++++--- metrics/grafana/provisioning/dashboards/home.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a5c9ee815..0fda8be1a 100644 --- a/Makefile +++ b/Makefile @@ -166,7 +166,7 @@ checkpoint-sync: compile-all #▶️ sepolia: @ Run an interactive terminal using sepolia network sepolia: compile-all - iex -S mix run -- --checkpoint-sync-url https://sepolia.beaconstate.info --network sepolia --metrics + iex -S mix run -- --checkpoint-sync-url https://sepolia.beaconstate.info --network sepolia --metrics --metrics-port=2000 #▶️ holesky: @ Run an interactive terminal using holesky network holesky: compile-all diff --git a/config/runtime.exs b/config/runtime.exs index d97be066e..606f16cc3 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -14,6 +14,7 @@ switches = [ datadir: :string, testnet_dir: :string, metrics: :boolean, + metrics_port: :integer, log_file: :string, beacon_api: :boolean, beacon_api_port: :integer, @@ -42,7 +43,8 @@ checkpoint_sync_url = Keyword.get(args, :checkpoint_sync_url) execution_endpoint = Keyword.get(args, :execution_endpoint, "http://localhost:8551") jwt_path = Keyword.get(args, :execution_jwt) testnet_dir = Keyword.get(args, :testnet_dir) -disable_metrics = not Keyword.get(args, :metrics, false) +enable_metrics = Keyword.get(args, :metrics, false) +metrics_port = Keyword.get(args, :metrics_port, if(enable_metrics, do: 9568, else: nil)) beacon_api_port = Keyword.get(args, :beacon_api_port, nil) enable_beacon_api = Keyword.get(args, :beacon_api, not is_nil(beacon_api_port)) listen_addresses = Keyword.get_values(args, :listen_address) @@ -187,9 +189,10 @@ block_time_ms = # Metrics config :lambda_ethereum_consensus, LambdaEthereumConsensus.PromEx, - disabled: disable_metrics, + disabled: not enable_metrics, metrics_server: [ - port: 9568, + port: metrics_port, + protocol: :http, auth_strategy: :none ], grafana: [ diff --git a/metrics/grafana/provisioning/dashboards/home.json b/metrics/grafana/provisioning/dashboards/home.json index 359800376..a654d03b7 100644 --- a/metrics/grafana/provisioning/dashboards/home.json +++ b/metrics/grafana/provisioning/dashboards/home.json @@ -1589,7 +1589,7 @@ "uid": "PBFA97CFB590B2093" }, "editorMode": "code", - "expr": "lambda_ethereum_consensus_prom_ex_beam_stats_uptime_milliseconds_count{job=\"prom_ex\", instance=\"host.docker.internal:9568\"}", + "expr": "lambda_ethereum_consensus_prom_ex_beam_stats_uptime_milliseconds_count{job=\"prom_ex\"}", "legendFormat": "Uptime", "range": true, "refId": "Uptime"