From 6c02dfee67e239650f9f21786ff5c976770a733b Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Mon, 19 Aug 2024 15:53:06 +0200 Subject: [PATCH] feat: add customizable configuraiton for prometheus retention (#745) --- main.star | 2 ++ src/package_io/input_parser.star | 18 ++++++++++++++++++ src/package_io/sanity_check.star | 4 ++++ src/prometheus/prometheus_launcher.star | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/main.star b/main.star index f8ecd4c4d..669cfb571 100644 --- a/main.star +++ b/main.star @@ -639,6 +639,8 @@ def run(plan, args={}): all_ethereum_metrics_exporter_contexts, all_xatu_sentry_contexts, global_node_selectors, + args_with_right_defaults.prometheus_params.storage_tsdb_retention_time, + args_with_right_defaults.prometheus_params.storage_tsdb_retention_size, ) plan.print("Launching grafana...") diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 2063790e1..99aa46882 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -101,6 +101,7 @@ def input_parser(plan, input_args): result["disable_peer_scoring"] = False result["goomy_blob_params"] = get_default_goomy_blob_params() result["assertoor_params"] = get_default_assertoor_params() + result["prometheus_params"] = get_default_prometheus_params() result["xatu_sentry_params"] = get_default_xatu_sentry_params() result["persistent"] = False result["parallel_keystore_generation"] = False @@ -322,6 +323,14 @@ def input_parser(plan, input_args): goomy_blob_params=struct( goomy_blob_args=result["goomy_blob_params"]["goomy_blob_args"], ), + prometheus_params=struct( + storage_tsdb_retention_time=result["prometheus_params"][ + "storage_tsdb_retention_time" + ], + storage_tsdb_retention_size=result["prometheus_params"][ + "storage_tsdb_retention_size" + ], + ), apache_port=result["apache_port"], assertoor_params=struct( image=result["assertoor_params"]["image"], @@ -922,6 +931,8 @@ def get_default_mev_params(mev_type, preset): mev_builder_prometheus_config = { "scrape_interval": "15s", "labels": None, + "storage_tsdb_retention_time": "1d", + "storage_tsdb_retention_size": "512MB", } if mev_type == constants.MEV_RS_MEV_TYPE: @@ -979,6 +990,13 @@ def get_default_assertoor_params(): } +def get_default_prometheus_params(): + return { + "storage_tsdb_retention_time": "1d", + "storage_tsdb_retention_size": "512MB", + } + + def get_default_xatu_sentry_params(): return { "xatu_sentry_image": "ethpandaops/xatu:latest", diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index 6a00ff1b6..9e6ba934b 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -163,6 +163,10 @@ SUBCATEGORY_PARAMS = { "run_lifecycle_test", "tests", ], + "prometheus_params": [ + "storage_tsdb_retention_time", + "storage_tsdb_retention_size", + ], "mev_params": [ "mev_relay_image", "mev_builder_image", diff --git a/src/prometheus/prometheus_launcher.star b/src/prometheus/prometheus_launcher.star index f2650bf38..0cc57f288 100644 --- a/src/prometheus/prometheus_launcher.star +++ b/src/prometheus/prometheus_launcher.star @@ -28,6 +28,8 @@ def launch_prometheus( ethereum_metrics_exporter_contexts, xatu_sentry_contexts, global_node_selectors, + storage_tsdb_retention_time, + storage_tsdb_retention_size, ): metrics_jobs = get_metrics_jobs( el_contexts, @@ -46,6 +48,8 @@ def launch_prometheus( MIN_MEMORY, MAX_MEMORY, node_selectors=global_node_selectors, + storage_tsdb_retention_time=storage_tsdb_retention_time, + storage_tsdb_retention_size=storage_tsdb_retention_size, ) return prometheus_url