diff --git a/rs/execution_environment/src/scheduler.rs b/rs/execution_environment/src/scheduler.rs index d3b0aa61208..e78ad9a148a 100644 --- a/rs/execution_environment/src/scheduler.rs +++ b/rs/execution_environment/src/scheduler.rs @@ -1606,8 +1606,10 @@ impl Scheduler for SchedulerImpl { // Subnet queues: execute long running install code call if present. { - let measurement_scope = - MeasurementScope::nested(&self.metrics.round_subnet_queue, &root_measurement_scope); + let measurement_scope = MeasurementScope::nested( + &self.metrics.round_advance_long_install_code, + &root_measurement_scope, + ); let mut subnet_round_limits = scheduler_round_limits.subnet_round_limits(); state = self.advance_long_running_install_code( diff --git a/rs/execution_environment/src/scheduler/scheduler_metrics.rs b/rs/execution_environment/src/scheduler/scheduler_metrics.rs index 0e404bf71c1..b91b3e50013 100644 --- a/rs/execution_environment/src/scheduler/scheduler_metrics.rs +++ b/rs/execution_environment/src/scheduler/scheduler_metrics.rs @@ -70,6 +70,7 @@ pub(super) struct SchedulerMetrics { pub(super) round_consensus_queue: ScopedMetrics, pub(super) round_postponed_raw_rand_queue: ScopedMetrics, pub(super) round_subnet_queue: ScopedMetrics, + pub(super) round_advance_long_install_code: ScopedMetrics, pub(super) round_scheduling_duration: Histogram, pub(super) round_update_sign_with_ecdsa_contexts_duration: Histogram, pub(super) round_inner: ScopedMetrics, @@ -404,6 +405,32 @@ impl SchedulerMetrics { metrics_registry, ), }, + round_advance_long_install_code: ScopedMetrics { + duration: duration_histogram( + "execution_round_advance_long_install_code_duration_seconds", + "The duration of advancing an in progress long install code in \ + an execution round", + metrics_registry, + ), + instructions: instructions_histogram( + "execution_round_advance_long_install_code_instructions", + "The number of instructions executed during advancing \ + an in progress install code in an execution round", + metrics_registry, + ), + slices: slices_histogram( + "execution_round_advance_long_install_code_slices", + "The number of slices executed executed during advancing \ + an in progress install code in an execution round", + metrics_registry, + ), + messages: messages_histogram( + "execution_round_advance_long_install_code_messages", + "The number of messages executed during advancing \ + an in progress install code in an execution round", + metrics_registry, + ), + }, round_scheduling_duration: duration_histogram( "execution_round_scheduling_duration_seconds", "The duration of execution round scheduling in seconds.", diff --git a/rs/execution_environment/src/scheduler/tests.rs b/rs/execution_environment/src/scheduler/tests.rs index 44e7bad3ada..9cd7fb9b510 100644 --- a/rs/execution_environment/src/scheduler/tests.rs +++ b/rs/execution_environment/src/scheduler/tests.rs @@ -2502,16 +2502,30 @@ fn execution_round_metrics_are_recorded() { 13 ); assert_eq!(test.state().metadata.subnet_metrics.num_canisters, 3); - assert_eq!(3, metrics.round_subnet_queue.duration.get_sample_count()); assert_eq!( - 3, + 1, + metrics + .round_advance_long_install_code + .duration + .get_sample_count() + ); + assert_eq!( + 1, + metrics + .round_advance_long_install_code + .messages + .get_sample_count() + ); + assert_eq!(2, metrics.round_subnet_queue.duration.get_sample_count()); + assert_eq!( + 2, metrics.round_subnet_queue.instructions.get_sample_count() ); assert_eq!( 30, metrics.round_subnet_queue.instructions.get_sample_sum() as u64, ); - assert_eq!(3, metrics.round_subnet_queue.messages.get_sample_count()); + assert_eq!(2, metrics.round_subnet_queue.messages.get_sample_count()); assert_eq!( 3, metrics.round_subnet_queue.messages.get_sample_sum() as u64, @@ -4317,7 +4331,15 @@ fn dts_allow_only_one_long_install_code_execution_at_any_time() { .round_subnet_queue .slices .get_sample_sum(), - 2.0 + 1.0 + ); + assert_eq!( + test.scheduler() + .metrics + .round_advance_long_install_code + .slices + .get_sample_sum(), + 1.0 ); assert_eq!( test.scheduler() @@ -4369,7 +4391,7 @@ fn dts_allow_only_one_long_install_code_execution_at_any_time() { .round_subnet_queue .slices .get_sample_sum(), - 4.0 + 2.0 ); assert_eq!( test.scheduler() @@ -4377,8 +4399,24 @@ fn dts_allow_only_one_long_install_code_execution_at_any_time() { .round_subnet_queue .messages .get_sample_sum(), + 1.0 + ); + assert_eq!( + test.scheduler() + .metrics + .round_advance_long_install_code + .slices + .get_sample_sum(), 2.0 ); + assert_eq!( + test.scheduler() + .metrics + .round_advance_long_install_code + .messages + .get_sample_sum(), + 1.0 + ); // Execute another round to refresh the metrics test.execute_round(ExecutionRoundType::OrdinaryRound);