From 5a014e806249bd347463a4a2ba301dd21e010c77 Mon Sep 17 00:00:00 2001 From: Loocapro Date: Thu, 14 Sep 2023 16:11:39 +0200 Subject: [PATCH 1/6] feat: adding metric_url for reth --- src/el/besu/besu_launcher.star | 1 + src/el/el_client_context.star | 2 ++ src/el/erigon/erigon_launcher.star | 1 + src/el/ethereumjs/ethereumjs_launcher.star | 1 + src/el/geth/geth_launcher.star | 1 + src/el/nethermind/nethermind_launcher.star | 1 + src/el/reth/reth_launcher.star | 3 +++ 7 files changed, 10 insertions(+) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index 358a7caf..1a7a86f4 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -97,6 +97,7 @@ def launch( WS_PORT_NUM, ENGINE_HTTP_RPC_PORT_NUM, jwt_secret, + "", # Passing empty metric_url for now service_name ) diff --git a/src/el/el_client_context.star b/src/el/el_client_context.star index 1d732624..90fb7fad 100644 --- a/src/el/el_client_context.star +++ b/src/el/el_client_context.star @@ -7,6 +7,7 @@ def new_el_client_context( ws_port_num, engine_rpc_port_num, jwt_secret, + metric_url, service_name = ""): return struct( service_name = service_name, @@ -18,4 +19,5 @@ def new_el_client_context( ws_port_num = ws_port_num, engine_rpc_port_num = engine_rpc_port_num, jwt_secret = jwt_secret, + metric_url = metric_url, ) diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index d4ba03c5..038ce2ec 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -94,6 +94,7 @@ def launch( WS_RPC_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + "", # Passing empty metric_url for now service_name ) diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 3fa420e3..bb915c6e 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -109,6 +109,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + "", # Passing empty metric_url for now service_name, ) diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index fd828393..a4c07a02 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -115,6 +115,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + "", # Passing empty metric_url for now service_name ) diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index bfd6dfca..f64f05ee 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -96,6 +96,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + "", # Passing empty metric_url for now service_name ) diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 2f0bf3e2..bc161b7a 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -97,6 +97,8 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) + metric_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + return el_client_context.new_el_client_context( "reth", "", # reth has no enr @@ -106,6 +108,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + metric_url, service_name, ) From 5518f89ec7d72a5e70545700a95edc8ec338193d Mon Sep 17 00:00:00 2001 From: Loocapro Date: Thu, 14 Sep 2023 16:39:06 +0200 Subject: [PATCH 2/6] feat: add node metric info --- src/cl/lighthouse/lighthouse_launcher.star | 6 +++--- src/cl/lodestar/lodestar_launcher.star | 4 ++-- src/cl/nimbus/nimbus_launcher.star | 4 ++-- src/cl/prysm/prysm_launcher.star | 6 +++--- src/cl/teku/teku_launcher.star | 4 ++-- src/el/reth/reth_launcher.star | 6 ++++-- .../cl_node_metrics_info.star => node_metrics_info.star} | 4 ++-- 7 files changed, 18 insertions(+), 16 deletions(-) rename src/{cl/cl_node_metrics_info.star => node_metrics_info.star} (69%) diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index f95b58ac..448d4c64 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -1,7 +1,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/shared_utils/shared_utils.star") input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") cl_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_client_context.star") -cl_node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_metrics_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -169,8 +169,8 @@ def launch( validator_metrics_port = validator_service.ports[VALIDATOR_METRICS_PORT_ID] validator_metrics_url = "{0}:{1}".format(validator_service.ip_address, validator_metrics_port.number) - beacon_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(beacon_node_service_name, METRICS_PATH, beacon_metrics_url) - validator_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(validator_node_service_name, METRICS_PATH, validator_metrics_url) + beacon_node_metrics_info = node_metrics.new_node_metrics_info(beacon_node_service_name, METRICS_PATH, beacon_metrics_url) + validator_node_metrics_info = node_metrics.new_node_metrics_info(validator_node_service_name, METRICS_PATH, validator_metrics_url) nodes_metrics_info = [beacon_node_metrics_info, validator_node_metrics_info] return cl_client_context.new_cl_client_context( diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index 42eb0060..edae61a5 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -1,7 +1,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/shared_utils/shared_utils.star") input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") cl_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_client_context.star") -cl_node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_metrics_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") cl_node_ready_conditions = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_ready_conditions.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -160,7 +160,7 @@ def launch( beacon_metrics_port = beacon_service.ports[METRICS_PORT_ID] beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number) - beacon_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(service_name, METRICS_PATH, beacon_metrics_url) + beacon_node_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, beacon_metrics_url) nodes_metrics_info = [beacon_node_metrics_info] return cl_client_context.new_cl_client_context( diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index fc5c12b8..c62564f7 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -1,7 +1,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/shared_utils/shared_utils.star") input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") cl_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_client_context.star") -cl_node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_metrics_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") cl_node_ready_conditions = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_ready_conditions.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -139,7 +139,7 @@ def launch( metrics_port = nimbus_service.ports[METRICS_PORT_ID] metrics_url = "{0}:{1}".format(nimbus_service.ip_address, metrics_port.number) - nimbus_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(service_name, METRICS_PATH, metrics_url) + nimbus_node_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, metrics_url) nodes_metrics_info = [nimbus_node_metrics_info] diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index 7c51c80c..a6f803c0 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -1,7 +1,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/shared_utils/shared_utils.star") input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") cl_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_client_context.star") -cl_node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_metrics_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") cl_node_ready_conditions = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_ready_conditions.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -188,8 +188,8 @@ def launch( validator_metrics_port = validator_service.ports[VALIDATOR_MONITORING_PORT_ID] validator_metrics_url = "{0}:{1}".format(validator_service.ip_address, validator_metrics_port.number) - beacon_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(beacon_node_service_name, METRICS_PATH, beacon_metrics_url) - validator_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(validator_node_service_name, METRICS_PATH, validator_metrics_url) + beacon_node_metrics_info = node_metrics.new_node_metrics_info(beacon_node_service_name, METRICS_PATH, beacon_metrics_url) + validator_node_metrics_info = node_metrics.new_node_metrics_info(validator_node_service_name, METRICS_PATH, validator_metrics_url) nodes_metrics_info = [beacon_node_metrics_info, validator_node_metrics_info] diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index 3b6e0632..abe405b7 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -1,7 +1,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/shared_utils/shared_utils.star") input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") cl_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_client_context.star") -cl_node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_metrics_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") cl_node_ready_conditions = import_module("github.com/kurtosis-tech/eth-network-package/src/cl/cl_node_ready_conditions.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -141,7 +141,7 @@ def launch( teku_metrics_port = teku_service.ports[METRICS_PORT_ID] teku_metrics_url = "{0}:{1}".format(teku_service.ip_address, teku_metrics_port.number) - teku_node_metrics_info = cl_node_metrics.new_cl_node_metrics_info(service_name, METRICS_PATH, teku_metrics_url) + teku_node_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, teku_metrics_url) nodes_metrics_info = [teku_node_metrics_info] return cl_client_context.new_cl_client_context( diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index bc161b7a..6749af51 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -2,7 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/share input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") el_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_client_context.star") el_admin_node_info = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_admin_node_info.star") - +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -26,8 +26,9 @@ UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" +# Paths +METRICS_PATH = "/metrics" GENESIS_DATA_MOUNT_DIRPATH = "/genesis" - PREFUNDED_KEYS_MOUNT_DIRPATH = "/prefunded-keys" # The dirpath of the execution data directory on the client container @@ -98,6 +99,7 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) metric_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + reth_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, metric_url) return el_client_context.new_el_client_context( "reth", diff --git a/src/cl/cl_node_metrics_info.star b/src/node_metrics_info.star similarity index 69% rename from src/cl/cl_node_metrics_info.star rename to src/node_metrics_info.star index cb335dfe..08f1ce91 100644 --- a/src/cl/cl_node_metrics_info.star +++ b/src/node_metrics_info.star @@ -1,7 +1,7 @@ # this is a dictionary as this will get serialzed to JSON -def new_cl_node_metrics_info(name, path, url): +def new_node_metrics_info(name, path, url): return { "name": name, "path": path, "url": url - } + } \ No newline at end of file From 05e5d83974bd36eb75ca301b4059c52c43d0d757 Mon Sep 17 00:00:00 2001 From: Loocapro Date: Thu, 14 Sep 2023 16:41:05 +0200 Subject: [PATCH 3/6] review: fix comments --- src/el/besu/besu_launcher.star | 2 +- src/el/el_client_context.star | 2 +- src/el/erigon/erigon_launcher.star | 2 +- src/el/ethereumjs/ethereumjs_launcher.star | 2 +- src/el/geth/geth_launcher.star | 2 +- src/el/nethermind/nethermind_launcher.star | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index 1a7a86f4..5924697d 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -97,7 +97,7 @@ def launch( WS_PORT_NUM, ENGINE_HTTP_RPC_PORT_NUM, jwt_secret, - "", # Passing empty metric_url for now + "", # TODO: Passing empty metric_url for now service_name ) diff --git a/src/el/el_client_context.star b/src/el/el_client_context.star index 90fb7fad..4b3f2b14 100644 --- a/src/el/el_client_context.star +++ b/src/el/el_client_context.star @@ -7,7 +7,7 @@ def new_el_client_context( ws_port_num, engine_rpc_port_num, jwt_secret, - metric_url, + metric_url = "", service_name = ""): return struct( service_name = service_name, diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index 038ce2ec..9ffc5f69 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -94,7 +94,7 @@ def launch( WS_RPC_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # Passing empty metric_url for now + "", # TODO: Passing empty metric_url for now service_name ) diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index bb915c6e..a4584d3f 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -109,7 +109,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # Passing empty metric_url for now + "", # TODO: Passing empty metric_url for now service_name, ) diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index a4c07a02..1213dc8e 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -115,7 +115,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # Passing empty metric_url for now + "", # TODO: Passing empty metric_url for now service_name ) diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index f64f05ee..2225206b 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -96,7 +96,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # Passing empty metric_url for now + "", # TODO: Passing empty metric_url for now service_name ) From a267780b7871e5d8c894a178bf88f55858671bb9 Mon Sep 17 00:00:00 2001 From: Carlos Bermudez Porto Date: Thu, 14 Sep 2023 17:40:41 -0400 Subject: [PATCH 4/6] feat: add execution clients metrics info --- src/el/besu/besu_launcher.star | 16 ++++++++++++++-- src/el/el_client_context.star | 4 ++-- src/el/erigon/erigon_launcher.star | 15 ++++++++++++++- src/el/ethereumjs/ethereumjs_launcher.star | 15 +++++++++++---- src/el/geth/geth_launcher.star | 18 +++++++++++++++--- src/el/nethermind/nethermind_launcher.star | 15 +++++++++++++-- src/el/reth/reth_launcher.star | 2 +- 7 files changed, 70 insertions(+), 15 deletions(-) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index 5924697d..d1208871 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth-network-package/share input_parser = import_module("github.com/kurtosis-tech/eth-network-package/package_io/input_parser.star") el_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_client_context.star") el_admin_node_info = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_admin_node_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") # The dirpath of the execution data directory on the client container @@ -10,10 +11,13 @@ KZG_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/opt/besu/genesis/output/trusted_setup.t GENESIS_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/opt/besu/genesis" +METRICS_PATH = "/metrics" + RPC_PORT_NUM = 8545 WS_PORT_NUM = 8546 DISCOVERY_PORT_NUM = 30303 ENGINE_HTTP_RPC_PORT_NUM = 8551 +METRICS_PORT_NUM = 9001 # The min/max CPU/memory that the execution node can use EXECUTION_MIN_CPU = 100 @@ -27,6 +31,7 @@ WS_PORT_ID = "ws" TCP_DISCOVERY_PORT_ID = "tcp-discovery" UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_HTTP_RPC_PORT_ID = "engine-rpc" +METRICS_PORT_ID = "metrics" PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" @@ -36,6 +41,7 @@ USED_PORTS = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL), ENGINE_HTTP_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_HTTP_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), + METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) } ENTRYPOINT_ARGS = ["sh", "-c"] @@ -88,6 +94,9 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) + metrics_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + besu_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, metrics_url) + return el_client_context.new_el_client_context( "besu", "", # besu has no ENR @@ -97,7 +106,7 @@ def launch( WS_PORT_NUM, ENGINE_HTTP_RPC_PORT_NUM, jwt_secret, - "", # TODO: Passing empty metric_url for now + besu_metrics_info, service_name ) @@ -142,7 +151,10 @@ def get_config( "--engine-rpc-port={0}".format(ENGINE_HTTP_RPC_PORT_NUM), "--sync-mode=FULL", "--data-storage-format=BONSAI", - "--kzg-trusted-setup=" + KZG_DATA_DIRPATH_ON_CLIENT_CONTAINER + "--kzg-trusted-setup=" + KZG_DATA_DIRPATH_ON_CLIENT_CONTAINER, + "--metrics-enabled=true", + "--metrics-host=0.0.0.0", + "--metrics-port={0}".format(METRICS_PORT_NUM), ] if len(existing_el_clients) > 0: diff --git a/src/el/el_client_context.star b/src/el/el_client_context.star index 4b3f2b14..264730b8 100644 --- a/src/el/el_client_context.star +++ b/src/el/el_client_context.star @@ -7,7 +7,7 @@ def new_el_client_context( ws_port_num, engine_rpc_port_num, jwt_secret, - metric_url = "", + el_metrics_info, service_name = ""): return struct( service_name = service_name, @@ -19,5 +19,5 @@ def new_el_client_context( ws_port_num = ws_port_num, engine_rpc_port_num = engine_rpc_port_num, jwt_secret = jwt_secret, - metric_url = metric_url, + el_metrics_info = el_metrics_info, ) diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index 9ffc5f69..879f6084 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -3,6 +3,7 @@ input_parser = import_module("github.com/kurtosis-tech/eth-network-package/packa el_admin_node_info = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_admin_node_info.star") el_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_client_context.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") # The dirpath of the execution data directory on the client container @@ -10,9 +11,12 @@ EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/home/erigon/execution-data" GENESIS_DATA_MOUNT_DIRPATH = "/genesis" +METRICS_PATH = "/metrics" + WS_RPC_PORT_NUM = 8545 DISCOVERY_PORT_NUM = 30303 ENGINE_RPC_PORT_NUM = 8551 +METRICS_PORT_NUM = 9001 # The min/max CPU/memory that the execution node can use EXECUTION_MIN_CPU = 100 @@ -25,6 +29,7 @@ WS_RPC_PORT_ID = "ws-rpc" TCP_DISCOVERY_PORT_ID = "tcp-discovery" UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" +METRICS_PORT_ID = "metrics" PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" @@ -33,6 +38,8 @@ USED_PORTS = { WS_RPC_PORT_ID: shared_utils.new_port_spec(WS_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), + METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL), } ENTRYPOINT_ARGS = ["sh", "-c"] @@ -85,6 +92,9 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) + metrics_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + erigon_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, metrics_url) + return el_client_context.new_el_client_context( "erigon", enr, @@ -94,7 +104,7 @@ def launch( WS_RPC_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # TODO: Passing empty metric_url for now + erigon_metrics_info, service_name ) @@ -145,6 +155,9 @@ def get_config( "--authrpc.addr=0.0.0.0", "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.vhosts=*", + "--metrics", + "--metrics.addr=0.0.0.0", + "--metrics.port={0}".format(METRICS_PORT_NUM), ] if len(existing_el_clients) > 0: diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index a4584d3f..448b5039 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -3,6 +3,7 @@ input_parser = import_module("github.com/kurtosis-tech/eth-network-package/packa el_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_client_context.star") el_admin_node_info = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_admin_node_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -11,7 +12,7 @@ WS_PORT_NUM = 8546 WS_PORT_ENGINE_NUM = 8547 DISCOVERY_PORT_NUM = 30303 ENGINE_RPC_PORT_NUM = 8551 -#METRICS_PORT_NUM = 9001 +METRICS_PORT_NUM = 9001 # The min/max CPU/memory that the execution node can use EXECUTION_MIN_CPU = 100 @@ -26,12 +27,14 @@ TCP_DISCOVERY_PORT_ID = "tcp-discovery" UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" WS_PORT_ENGINE_ID = "ws-engine" -#METRICS_PORT_ID = "metrics" +METRICS_PORT_ID = "metrics" GENESIS_DATA_MOUNT_DIRPATH = "/genesis" PREFUNDED_KEYS_MOUNT_DIRPATH = "/prefunded-keys" +METRICS_PATH = "/metrics" + # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/execution-data" @@ -44,7 +47,7 @@ USED_PORTS = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL), ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), -# METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) + # METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) } ENTRYPOINT_ARGS = [] @@ -100,6 +103,10 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) + # TODO: Passing empty string for metrics_url for now + # metrics_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + ethjs_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, "") + return el_client_context.new_el_client_context( "ethereumjs", "", # ethereumjs has no enr @@ -109,7 +116,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # TODO: Passing empty metric_url for now + ethjs_metrics_info, service_name, ) diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index 1213dc8e..8980e26b 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -4,6 +4,7 @@ el_client_context = import_module("github.com/kurtosis-tech/eth-network-package/ el_admin_node_info = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_admin_node_info.star") genesis_constants = import_module("github.com/kurtosis-tech/eth-network-package/src/prelaunch_data_generator/genesis_constants/genesis_constants.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") @@ -11,6 +12,7 @@ RPC_PORT_NUM = 8545 WS_PORT_NUM = 8546 DISCOVERY_PORT_NUM = 30303 ENGINE_RPC_PORT_NUM = 8551 +METRICS_PORT_NUM = 9001 # The min/max CPU/memory that the execution node can use EXECUTION_MIN_CPU = 100 @@ -25,6 +27,7 @@ TCP_DISCOVERY_PORT_ID = "tcp-discovery" UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" ENGINE_WS_PORT_ID = "engineWs" +METRICS_PORT_ID = "metrics" # TODO(old) Scale this dynamically based on CPUs available and Geth nodes mining NUM_MINING_THREADS = 1 @@ -33,6 +36,8 @@ GENESIS_DATA_MOUNT_DIRPATH = "/genesis" PREFUNDED_KEYS_MOUNT_DIRPATH = "/prefunded-keys" +METRICS_PATH = "/debug/metrics/prometheus" + # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/execution-data" KEYSTORE_DIRPATH_ON_CLIENT_CONTAINER = EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER + "/keystore" @@ -47,7 +52,8 @@ USED_PORTS = { WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL) + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), + METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) } ENTRYPOINT_ARGS = ["sh", "-c"] @@ -106,6 +112,9 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) + metrics_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + geth_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, metrics_url) + return el_client_context.new_el_client_context( "geth", enr, @@ -115,7 +124,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # TODO: Passing empty metric_url for now + geth_metrics_info, service_name ) @@ -203,7 +212,10 @@ def get_config( "--authrpc.vhosts=*", "--authrpc.jwtsecret={0}".format(jwt_secret_json_filepath_on_client), "--syncmode=full", - "--rpc.allow-unprotected-txs" + "--rpc.allow-unprotected-txs", + "--metrics", + "--metrics.addr=0.0.0.0", + "--metrics.port={0}".format(METRICS_PORT_NUM), ] if BUILDER_IMAGE_STR in image: diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index 2225206b..fa86b978 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -3,6 +3,7 @@ input_parser = import_module("github.com/kurtosis-tech/eth-network-package/packa el_client_context = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_client_context.star") el_admin_node_info = import_module("github.com/kurtosis-tech/eth-network-package/src/el/el_admin_node_info.star") +node_metrics = import_module("github.com/kurtosis-tech/eth-network-package/src/node_metrics_info.star") package_io = import_module("github.com/kurtosis-tech/eth-network-package/package_io/constants.star") # The dirpath of the execution data directory on the client container @@ -10,10 +11,13 @@ EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/execution-data" KZG_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/genesis/output/trusted_setup.txt" GENESIS_DATA_MOUNT_DIRPATH = "/genesis" +METRICS_PATH = "/metrics" + RPC_PORT_NUM = 8545 WS_PORT_NUM = 8546 DISCOVERY_PORT_NUM = 30303 ENGINE_RPC_PORT_NUM = 8551 +METRICS_PORT_NUM = 9001 # The min/max CPU/memory that the execution node can use EXECUTION_MIN_CPU = 100 @@ -27,6 +31,7 @@ WS_PORT_ID = "ws" TCP_DISCOVERY_PORT_ID = "tcp-discovery" UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" +METRICS_PORT_ID = "metrics" PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" @@ -35,7 +40,8 @@ USED_PORTS = { WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL) + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec(ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), + METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) } NETHERMIND_LOG_LEVELS = { @@ -86,6 +92,9 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) + metrics_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) + nethermind_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, metrics_url) + return el_client_context.new_el_client_context( "nethermind", "", # nethermind has no ENR in the eth2-merge-kurtosis-module either @@ -96,7 +105,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - "", # TODO: Passing empty metric_url for now + nethermind_metrics_info, service_name ) @@ -135,6 +144,8 @@ def get_config( "--Network.P2PPort={0}".format(DISCOVERY_PORT_NUM), "--JsonRpc.JwtSecretFile={0}".format(jwt_secret_json_filepath_on_client), "--Network.OnlyStaticPeers=true", + "--Metrics.Enabled=true", + "--Metrics.ExposePort={0}".format(METRICS_PORT_NUM), ] if len(existing_el_clients) > 0: diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 6749af51..e371dfd9 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -110,7 +110,7 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - metric_url, + reth_metrics_info, service_name, ) From 329f398cca29d4316524bc8d71f9c0ee0b27346d Mon Sep 17 00:00:00 2001 From: Carlos Bermudez Porto Date: Tue, 19 Sep 2023 12:57:12 -0400 Subject: [PATCH 5/6] fix: parameters order for backward compatibility --- src/el/besu/besu_launcher.star | 2 +- src/el/el_client_context.star | 4 ++-- src/el/erigon/erigon_launcher.star | 4 ++-- src/el/ethereumjs/ethereumjs_launcher.star | 2 +- src/el/geth/geth_launcher.star | 2 +- src/el/nethermind/nethermind_launcher.star | 2 +- src/el/reth/reth_launcher.star | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index d1208871..6c0cc9c4 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -106,8 +106,8 @@ def launch( WS_PORT_NUM, ENGINE_HTTP_RPC_PORT_NUM, jwt_secret, + service_name, besu_metrics_info, - service_name ) diff --git a/src/el/el_client_context.star b/src/el/el_client_context.star index 264730b8..4ee4f82d 100644 --- a/src/el/el_client_context.star +++ b/src/el/el_client_context.star @@ -7,8 +7,8 @@ def new_el_client_context( ws_port_num, engine_rpc_port_num, jwt_secret, - el_metrics_info, - service_name = ""): + service_name = "", + el_metrics_info = None): return struct( service_name = service_name, client_name = client_name, diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index 879f6084..3c6c2c38 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -104,8 +104,8 @@ def launch( WS_RPC_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - erigon_metrics_info, - service_name + service_name, + erigon_metrics_info ) diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 448b5039..3b8670c1 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -116,8 +116,8 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - ethjs_metrics_info, service_name, + ethjs_metrics_info, ) def get_config( diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index 8980e26b..a00e30f6 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -124,8 +124,8 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + service_name, geth_metrics_info, - service_name ) def get_config( diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index fa86b978..c7b12761 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -105,8 +105,8 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, + service_name, nethermind_metrics_info, - service_name ) diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index e371dfd9..234a1285 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -110,8 +110,8 @@ def launch( WS_PORT_NUM, ENGINE_RPC_PORT_NUM, jwt_secret, - reth_metrics_info, service_name, + reth_metrics_info, ) def get_config( From ad580dbb1a547c0e93ee245e6e373b2239ebe783 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 20 Sep 2023 12:50:28 +0200 Subject: [PATCH 6/6] Update ethereumjs_launcher.star --- src/el/ethereumjs/ethereumjs_launcher.star | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 446690ee..14a3e261 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -105,7 +105,7 @@ def launch( jwt_secret = shared_utils.read_file_from_service(plan, service_name, jwt_secret_json_filepath_on_client) - # TODO: Passing empty string for metrics_url for now + # TODO: Passing empty string for metrics_url for now https://github.com/kurtosis-tech/eth-network-package/issues/127 # metrics_url = "http://{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) ethjs_metrics_info = node_metrics.new_node_metrics_info(service_name, METRICS_PATH, "")