-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add beacon-metrics-gazer + beacon-metrics-gazer grafana dashboa…
…rd (#114) Changelog picked up from commits here: feat: add beacon-metrics-gazer --------- Co-authored-by: Gyanendra Mishra <[email protected]>
- Loading branch information
1 parent
14dc957
commit 5540587
Showing
8 changed files
with
453 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/beacon_metrics_gazer/beacon_metrics_gazer_launcher.star
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") | ||
|
||
|
||
SERVICE_NAME = "beacon-metrics-gazer" | ||
IMAGE_NAME = "dapplion/beacon-metrics-gazer:latest" | ||
|
||
HTTP_PORT_ID = "http" | ||
HTTP_PORT_NUMBER = 8080 | ||
|
||
BEACON_METRICS_GAZER_CONFIG_FILENAME = "beacon-metrics-gazer-ranges.yaml" | ||
|
||
BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config" | ||
|
||
USED_PORTS = { | ||
HTTP_PORT_ID:shared_utils.new_port_spec(HTTP_PORT_NUMBER, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL) | ||
} | ||
|
||
|
||
def launch_beacon_metrics_gazer( | ||
plan, | ||
config_template, | ||
cl_client_contexts, | ||
network_params | ||
): | ||
|
||
data = [] | ||
for index, client in enumerate(cl_client_contexts): | ||
start_index = index*network_params.num_validator_keys_per_node | ||
end_index = ((index+1)*network_params.num_validator_keys_per_node)-1 | ||
service_name = client.beacon_service_name | ||
data.append({"ClientName": service_name, "Range": "{0}-{1}".format(start_index, end_index)}) | ||
|
||
template_data = {"Data": data} | ||
|
||
template_and_data_by_rel_dest_filepath = {} | ||
template_and_data_by_rel_dest_filepath[BEACON_METRICS_GAZER_CONFIG_FILENAME] = shared_utils.new_template_and_data(config_template, template_data) | ||
|
||
config_files_artifact_name = plan.render_templates(template_and_data_by_rel_dest_filepath, "beacon-metrics-gazer-config") | ||
|
||
config = get_config( | ||
config_files_artifact_name, | ||
cl_client_contexts[0].ip_addr, | ||
cl_client_contexts[0].http_port_num) | ||
|
||
plan.add_service(SERVICE_NAME, config) | ||
|
||
|
||
def get_config( | ||
config_files_artifact_name, | ||
ip_addr, | ||
http_port_num): | ||
config_file_path = shared_utils.path_join(BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE, BEACON_METRICS_GAZER_CONFIG_FILENAME) | ||
return ServiceConfig( | ||
image = IMAGE_NAME, | ||
ports = USED_PORTS, | ||
files = { | ||
BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name, | ||
}, | ||
cmd = [ | ||
"http://{0}:{1}".format(ip_addr, http_port_num), | ||
"--ranges-file", | ||
"/config/{0}".format(BEACON_METRICS_GAZER_CONFIG_FILENAME), | ||
"--port", | ||
"{0}".format(HTTP_PORT_NUMBER), | ||
"--address", | ||
"0.0.0.0", | ||
"-v" | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ range $data := .Data }} | ||
{{ $data.Range }}: {{ $data.ClientName }} | ||
{{ end }} |
Oops, something went wrong.