From e3355c66c907453d608941198b5b557b96049fe1 Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 13 Mar 2024 13:10:16 +0100 Subject: [PATCH 1/2] Add column avg inclusion delay to pools summary --- pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql | 1 + pkg/db/migrations/000004_add_inclusion_delay_pools.up.sql | 1 + pkg/db/pools_summary.go | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql create mode 100644 pkg/db/migrations/000004_add_inclusion_delay_pools.up.sql diff --git a/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql b/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql new file mode 100644 index 00000000..757cd0c6 --- /dev/null +++ b/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql @@ -0,0 +1 @@ +ALTER TABLE t_pool_summary DROP COLUMN f_avg_inclusion_delay; \ No newline at end of file diff --git a/pkg/db/migrations/000004_add_inclusion_delay_pools.up.sql b/pkg/db/migrations/000004_add_inclusion_delay_pools.up.sql new file mode 100644 index 00000000..6113a321 --- /dev/null +++ b/pkg/db/migrations/000004_add_inclusion_delay_pools.up.sql @@ -0,0 +1 @@ +ALTER TABLE t_pool_summary ADD COLUMN avg_inclusion_delay Float; \ No newline at end of file diff --git a/pkg/db/pools_summary.go b/pkg/db/pools_summary.go index 99b14757..fb59bc13 100644 --- a/pkg/db/pools_summary.go +++ b/pkg/db/pools_summary.go @@ -23,7 +23,8 @@ var ( COUNT(*) as count_expected_attestations, SUM(CASE WHEN t_proposer_duties.f_proposed = TRUE THEN 1 ELSE 0 END) as proposed_blocks_performance, SUM(CASE WHEN t_proposer_duties.f_proposed = FALSE THEN 1 ELSE 0 END) as missed_blocks_performance, - count(distinct(t_validator_rewards_summary.f_val_idx)) as number_active_vals + count(distinct(t_validator_rewards_summary.f_val_idx)) as number_active_vals, + AVG(f_inclusion_delay) as avg_inclusion_delay FROM t_validator_rewards_summary LEFT JOIN t_eth2_pubkeys ON t_validator_rewards_summary.f_val_idx = t_eth2_pubkeys.f_val_idx From 008ec85396cb061c4c267e6fab07995c80646376 Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 13 Mar 2024 15:42:09 +0100 Subject: [PATCH 2/2] Fix typo --- pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql b/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql index 757cd0c6..1695f87a 100644 --- a/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql +++ b/pkg/db/migrations/000004_add_inclusion_delay_pools.down.sql @@ -1 +1 @@ -ALTER TABLE t_pool_summary DROP COLUMN f_avg_inclusion_delay; \ No newline at end of file +ALTER TABLE t_pool_summary DROP COLUMN avg_inclusion_delay; \ No newline at end of file