From ec1db64bfb500e5c89c9ce2708eb06dd1effa28c Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 22 May 2025 19:41:22 +0200 Subject: [PATCH 1/3] Tezt/Cloud/DAL: remove duplicate network name in reports --- tezt/tests/cloud/dal.ml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index 007e5e0033af..90eda983b40d 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -1553,17 +1553,12 @@ module Monitoring_app = struct "*DAL report* for the *%s* network over the last 6 hours." (String.capitalize_ascii (Network.to_string network)) in - let network_info = - Format.sprintf - "• Network: %s" - (String.capitalize_ascii (Network.to_string network)) - in let* ratio_dal_commitments_total_info = fetch_dal_commitments_total_info () in let* slots_info = fetch_slots_info () in let network_overview_info = - network_info :: ratio_dal_commitments_total_info :: slots_info + ratio_dal_commitments_total_info :: slots_info in let data = let open Format_app in -- GitLab From 18efcd3be565aeb0396599c51a8053ab60e11f1c Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 22 May 2025 20:32:57 +0200 Subject: [PATCH 2/3] Tezt/Cloud/DAL: also report the bandwidth --- tezt/tests/cloud/dal.ml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index 90eda983b40d..91c8760a9e8c 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -1353,12 +1353,26 @@ module Monitoring_app = struct view_ratio_attested_over_published (`attested attested, `published published) in - let view = + let ratio_view = (Format.sprintf "• Percentage of attested over published DAL commitments: %s") (Option.value ~default:"unk" ratio) in - Lwt.return view + let slot_size = 126_944 (* TODO: do not hard-code this *) in + let bandwidth = + Option.map + (fun x -> + Format.sprintf + "%.2f" + (x *. float_of_int slot_size /. float_of_int (1024 * 6 * 3600))) + attested + in + let bandwidth_view = + Format.sprintf + "• Bandwidth: %s KiB/s" + (Option.value ~default:"unk" bandwidth) + in + Lwt.return (ratio_view, bandwidth_view) let pp_stake fmt stake_ratio = Format.fprintf fmt "`%.2f%%` stake" (stake_ratio *. 100.) @@ -1553,12 +1567,12 @@ module Monitoring_app = struct "*DAL report* for the *%s* network over the last 6 hours." (String.capitalize_ascii (Network.to_string network)) in - let* ratio_dal_commitments_total_info = + let* ratio_dal_commitments_total_info, bandwidth_info = fetch_dal_commitments_total_info () in let* slots_info = fetch_slots_info () in let network_overview_info = - ratio_dal_commitments_total_info :: slots_info + bandwidth_info :: ratio_dal_commitments_total_info :: slots_info in let data = let open Format_app in -- GitLab From 5e7cf442c03d8806e282fff29a8bbb495620b760 Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Wed, 4 Jun 2025 14:25:44 +0200 Subject: [PATCH 3/3] Tezt/Cloud/DAL: do not hard-code the report interval --- tezt/tests/cloud/dal.ml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index 91c8760a9e8c..3e98326a9d0d 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -1118,6 +1118,9 @@ let get_metrics t infos_per_level metrics = } module Monitoring_app = struct + (* time interval in hours at which to submit report *) + let report_interval = 6 + let pp_delegate fmt delegate_pkh = match Hashtbl.find_opt aliases delegate_pkh with | None -> Format.fprintf fmt "`%s`" delegate_pkh @@ -1298,9 +1301,10 @@ module Monitoring_app = struct let fetch_slot_info ~slot_index = let query s = Format.sprintf - "increase(tezt_total_%s_commitments_per_slot{slot_index=\"%d\"}[6h])" + "increase(tezt_total_%s_commitments_per_slot{slot_index=\"%d\"}[%dh])" s slot_index + report_interval in let decoder = decoder_prometheus_float in let* attested = @@ -1334,7 +1338,10 @@ module Monitoring_app = struct let fetch_dal_commitments_total_info () = let query s = - Format.sprintf {|increase(tezt_dal_commitments_total{kind="%s"}[6h])|} s + Format.sprintf + {|increase(tezt_dal_commitments_total{kind="%s"}[%dh])|} + s + report_interval in let decoder = decoder_prometheus_float in let* attested = @@ -1364,7 +1371,8 @@ module Monitoring_app = struct (fun x -> Format.sprintf "%.2f" - (x *. float_of_int slot_size /. float_of_int (1024 * 6 * 3600))) + (x *. float_of_int slot_size + /. float_of_int (1024 * report_interval * 3600))) attested in let bandwidth_view = @@ -1400,20 +1408,23 @@ module Monitoring_app = struct let fetch_baker_info ~tz1 ~origin = let query = Format.sprintf - "sum_over_time(tezt_dal_commitments_attested{attester=\"%s\"}[6h])" + "sum_over_time(tezt_dal_commitments_attested{attester=\"%s\"}[%dh])" tz1 + report_interval in let* attested = fetch ~decoder:decoder_prometheus_float ~query ~origin in let query = Format.sprintf - "sum_over_time(tezt_dal_commitments_published{attester=\"%s\"}[6h])" + "sum_over_time(tezt_dal_commitments_published{attester=\"%s\"}[%dh])" tz1 + report_interval in let* published = fetch ~decoder:decoder_prometheus_float ~query ~origin in let query = Format.sprintf - "avg_over_time(tezt_dal_attestation_sent{attester=\"%s\"}[6h])" + "avg_over_time(tezt_dal_attestation_sent{attester=\"%s\"}[%dh])" tz1 + report_interval in let* dal_attestation_ratio = fetch ~decoder:decoder_prometheus_float ~query ~origin @@ -1564,8 +1575,9 @@ module Monitoring_app = struct let network = configuration.network in let title_info = Format.sprintf - "*DAL report* for the *%s* network over the last 6 hours." + "*DAL report* for the *%s* network over the last %d hours." (String.capitalize_ascii (Network.to_string network)) + report_interval in let* ratio_dal_commitments_total_info, bandwidth_info = fetch_dal_commitments_total_info () @@ -1619,11 +1631,8 @@ module Monitoring_app = struct endpoint () in - Chronos.task - ~name:"network-overview" - ~tm:"0 0-23/6 * * *" - ~action - () + let tm = Format.sprintf "0 0-23/%d * * *" report_interval in + Chronos.task ~name:"network-overview" ~tm ~action () in Cloud.register_chronos_task cloud task end -- GitLab