From 2e3e0a77fceff6cccb25623636d4e1d3710217b6 Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Thu, 14 Nov 2024 21:47:07 +0300 Subject: [PATCH 01/13] feat add block.Transactions log --- pkg/watcher/block.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 3d05b75..5181d79 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -227,6 +227,7 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { w.writer, color.YellowString(fmt.Sprintf("#%d", block.Height-1)), color.CyanString(fmt.Sprintf("%3d/%d validators", block.SignedValidators, block.TotalValidators)), + color.GreenString(fmt.Sprintf("txs: %d", block.Transactions)), strings.Join(validatorStatus, " "), ) From 38c600d7228021794c5cfcf8b34b0b3e6db0af7c Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:06:50 +0300 Subject: [PATCH 02/13] chore: test --- pkg/watcher/block_types.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/watcher/block_types.go b/pkg/watcher/block_types.go index 9d43723..8b41856 100644 --- a/pkg/watcher/block_types.go +++ b/pkg/watcher/block_types.go @@ -24,6 +24,12 @@ func NewBlockInfo(block *types.Block, validatorStatus []ValidatorStatus) *BlockI } } + fmt.Fprintln( + w.writer, + color.YellowString(fmt.Sprintf("#%d", block.Header.Height)), + color.BlueString(fmt.Sprintf("txs: %X", block.Txs)), + ) + return &BlockInfo{ ChainID: block.Header.ChainID, Height: block.Header.Height, From 55d85067c6eaf8fcf060da6dfa72dfe44d6f3e2c Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:10:20 +0300 Subject: [PATCH 03/13] chore: test --- pkg/watcher/block.go | 10 ++++++++++ pkg/watcher/block_types.go | 11 ++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 5181d79..0bdb1be 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -223,11 +223,21 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { validatorStatus = append(validatorStatus, fmt.Sprintf("%s %s", icon, res.Label)) } + txsInfo := "" + if len(block.TransactionsData) > 0 { + txBzs := make([]string, len(block.TransactionsData)) + for i, tx := range block.TransactionsData { + txBzs[i] = fmt.Sprintf("%X", tx) + } + txsInfo = color.GreenString(fmt.Sprintf("txs: %s", strings.Join(txBzs, " "))) + } + fmt.Fprintln( w.writer, color.YellowString(fmt.Sprintf("#%d", block.Height-1)), color.CyanString(fmt.Sprintf("%3d/%d validators", block.SignedValidators, block.TotalValidators)), color.GreenString(fmt.Sprintf("txs: %d", block.Transactions)), + txsInfo, strings.Join(validatorStatus, " "), ) diff --git a/pkg/watcher/block_types.go b/pkg/watcher/block_types.go index 8b41856..3c7b686 100644 --- a/pkg/watcher/block_types.go +++ b/pkg/watcher/block_types.go @@ -9,6 +9,7 @@ type BlockInfo struct { ChainID string Height int64 Transactions int + TransactionsData [][]byte TotalValidators int SignedValidators int ProposerAddress string @@ -24,16 +25,16 @@ func NewBlockInfo(block *types.Block, validatorStatus []ValidatorStatus) *BlockI } } - fmt.Fprintln( - w.writer, - color.YellowString(fmt.Sprintf("#%d", block.Header.Height)), - color.BlueString(fmt.Sprintf("txs: %X", block.Txs)), - ) + txs := make([][]byte, len(block.Data.Txs)) + for i, tx := range block.Data.Txs { + txs[i] = tx + } return &BlockInfo{ ChainID: block.Header.ChainID, Height: block.Header.Height, Transactions: block.Txs.Len(), + TransactionsData: txs, TotalValidators: len(block.LastCommit.Signatures), SignedValidators: signedValidators, ValidatorStatus: validatorStatus, From 22155c1506f5bbef6d63692dc1e2cb51df551cbb Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:14:19 +0300 Subject: [PATCH 04/13] fix: try len(block.Data.Txs) --- pkg/watcher/block_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/watcher/block_types.go b/pkg/watcher/block_types.go index 3c7b686..e76f0d3 100644 --- a/pkg/watcher/block_types.go +++ b/pkg/watcher/block_types.go @@ -33,7 +33,7 @@ func NewBlockInfo(block *types.Block, validatorStatus []ValidatorStatus) *BlockI return &BlockInfo{ ChainID: block.Header.ChainID, Height: block.Header.Height, - Transactions: block.Txs.Len(), + Transactions: len(block.Data.Txs), TransactionsData: txs, TotalValidators: len(block.LastCommit.Signatures), SignedValidators: signedValidators, From a583cb3cd6fb0f5ecfb51c1fa311e73a5f9ec178 Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:58:47 +0300 Subject: [PATCH 05/13] feat: rm txn log --- pkg/watcher/block.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 0bdb1be..24f3221 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -237,7 +237,6 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { color.YellowString(fmt.Sprintf("#%d", block.Height-1)), color.CyanString(fmt.Sprintf("%3d/%d validators", block.SignedValidators, block.TotalValidators)), color.GreenString(fmt.Sprintf("txs: %d", block.Transactions)), - txsInfo, strings.Join(validatorStatus, " "), ) From eecff39974f42becc8cb16b59d1086a81b009cdf Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Thu, 14 Nov 2024 23:00:38 +0300 Subject: [PATCH 06/13] feat: rm extra code --- pkg/watcher/block.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 24f3221..5181d79 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -223,15 +223,6 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { validatorStatus = append(validatorStatus, fmt.Sprintf("%s %s", icon, res.Label)) } - txsInfo := "" - if len(block.TransactionsData) > 0 { - txBzs := make([]string, len(block.TransactionsData)) - for i, tx := range block.TransactionsData { - txBzs[i] = fmt.Sprintf("%X", tx) - } - txsInfo = color.GreenString(fmt.Sprintf("txs: %s", strings.Join(txBzs, " "))) - } - fmt.Fprintln( w.writer, color.YellowString(fmt.Sprintf("#%d", block.Height-1)), From 57b5b9d2e914075acd67eb122a5446206fd4cd3c Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Sun, 17 Nov 2024 06:26:26 +0300 Subject: [PATCH 07/13] feat: add empty blocks monitoring --- pkg/metrics/metrics.go | 10 ++++++++++ pkg/watcher/block.go | 15 ++++++++++++--- pkg/watcher/block_test.go | 27 +++++++++++++++++++++++---- pkg/watcher/block_types.go | 9 +-------- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index ee0b3b3..bb979e8 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -17,6 +17,7 @@ type Metrics struct { TrackedBlocks *prometheus.CounterVec Transactions *prometheus.CounterVec UpgradePlan *prometheus.GaugeVec + EmptyBlocks *prometheus.CounterVec // Validator metrics Rank *prometheus.GaugeVec @@ -207,6 +208,14 @@ func New(namespace string) *Metrics { }, []string{"chain_id", "proposal_id"}, ), + EmptyBlocks: prometheus.NewCounterVec( + prometheus.CounterOpts{ + Namespace: namespace, + Name: "empty_blocks", + Help: "Number of empty blocks proposed by validator", + }, + []string{"chain_id", "address", "name"}, + ), } return metrics @@ -237,4 +246,5 @@ func (m *Metrics) Register() { m.Registry.MustRegister(m.NodeSynced) m.Registry.MustRegister(m.UpgradePlan) m.Registry.MustRegister(m.ProposalEndTime) + m.Registry.MustRegister(m.EmptyBlocks) } diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 5181d79..67e7d4e 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -177,12 +177,13 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { return } - // Ensure to inititalize counters for each validator + // Ensure to initialize counters for each validator for _, val := range w.trackedValidators { w.metrics.ValidatedBlocks.WithLabelValues(chainId, val.Address, val.Name) w.metrics.MissedBlocks.WithLabelValues(chainId, val.Address, val.Name) w.metrics.SoloMissedBlocks.WithLabelValues(chainId, val.Address, val.Name) w.metrics.ConsecutiveMissedBlocks.WithLabelValues(chainId, val.Address, val.Name) + w.metrics.EmptyBlocks.WithLabelValues(chainId, val.Address, val.Name) } w.metrics.SkippedBlocks.WithLabelValues(chainId) @@ -202,10 +203,19 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { for _, res := range block.ValidatorStatus { icon := "⚪️" if w.latestBlockProposer == res.Address { - icon = "👑" + if block.Transactions == 0 { + icon = "🫧" + } else { + icon = "👑" + } w.metrics.ProposedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() w.metrics.ValidatedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() w.metrics.ConsecutiveMissedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Set(0) + + // Check if this is an empty block + if block.Transactions == 0 { + w.metrics.EmptyBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() + } } else if res.Signed { icon = "✅" w.metrics.ValidatedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() @@ -227,7 +237,6 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { w.writer, color.YellowString(fmt.Sprintf("#%d", block.Height-1)), color.CyanString(fmt.Sprintf("%3d/%d validators", block.SignedValidators, block.TotalValidators)), - color.GreenString(fmt.Sprintf("txs: %d", block.Transactions)), strings.Join(validatorStatus, " "), ) diff --git a/pkg/watcher/block_test.go b/pkg/watcher/block_test.go index 214f2a3..b7ee18b 100644 --- a/pkg/watcher/block_test.go +++ b/pkg/watcher/block_test.go @@ -106,6 +106,23 @@ func TestBlockWatcher(t *testing.T) { Transactions: 7, TotalValidators: 2, SignedValidators: 2, + ProposerAddress: kilnAddress, + ValidatorStatus: []ValidatorStatus{ + { + Address: kilnAddress, + Label: kilnName, + Bonded: true, + Signed: true, + Rank: 2, + }, + }, + }, + { + ChainID: chainID, + Height: 45, + Transactions: 0, + TotalValidators: 2, + SignedValidators: 2, ValidatorStatus: []ValidatorStatus{ { Address: kilnAddress, @@ -129,22 +146,24 @@ func TestBlockWatcher(t *testing.T) { `#41 1/2 validators ✅ Kiln`, `#42 2/2 validators ✅ Kiln`, `#43 2/2 validators 👑 Kiln`, + `#44 2/2 validators 🫧 Kiln`, }, "\n")+"\n", blockWatcher.writer.(*bytes.Buffer).String(), ) - assert.Equal(t, float64(44), testutil.ToFloat64(blockWatcher.metrics.BlockHeight.WithLabelValues(chainID))) + assert.Equal(t, float64(45), testutil.ToFloat64(blockWatcher.metrics.BlockHeight.WithLabelValues(chainID))) assert.Equal(t, float64(29), testutil.ToFloat64(blockWatcher.metrics.Transactions.WithLabelValues(chainID))) assert.Equal(t, float64(2), testutil.ToFloat64(blockWatcher.metrics.ActiveSet.WithLabelValues(chainID))) - assert.Equal(t, float64(5), testutil.ToFloat64(blockWatcher.metrics.TrackedBlocks.WithLabelValues(chainID))) + assert.Equal(t, float64(6), testutil.ToFloat64(blockWatcher.metrics.TrackedBlocks.WithLabelValues(chainID))) assert.Equal(t, float64(5), testutil.ToFloat64(blockWatcher.metrics.SkippedBlocks.WithLabelValues(chainID))) assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.ValidatedBlocks)) assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.MissedBlocks)) assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.SoloMissedBlocks)) assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.ConsecutiveMissedBlocks)) - assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.ProposedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) - assert.Equal(t, float64(3), testutil.ToFloat64(blockWatcher.metrics.ValidatedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) + assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.EmptyBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) + assert.Equal(t, float64(2), testutil.ToFloat64(blockWatcher.metrics.ProposedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) + assert.Equal(t, float64(4), testutil.ToFloat64(blockWatcher.metrics.ValidatedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.MissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(0), testutil.ToFloat64(blockWatcher.metrics.SoloMissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(0), testutil.ToFloat64(blockWatcher.metrics.ConsecutiveMissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) diff --git a/pkg/watcher/block_types.go b/pkg/watcher/block_types.go index e76f0d3..9d43723 100644 --- a/pkg/watcher/block_types.go +++ b/pkg/watcher/block_types.go @@ -9,7 +9,6 @@ type BlockInfo struct { ChainID string Height int64 Transactions int - TransactionsData [][]byte TotalValidators int SignedValidators int ProposerAddress string @@ -25,16 +24,10 @@ func NewBlockInfo(block *types.Block, validatorStatus []ValidatorStatus) *BlockI } } - txs := make([][]byte, len(block.Data.Txs)) - for i, tx := range block.Data.Txs { - txs[i] = tx - } - return &BlockInfo{ ChainID: block.Header.ChainID, Height: block.Header.Height, - Transactions: len(block.Data.Txs), - TransactionsData: txs, + Transactions: block.Txs.Len(), TotalValidators: len(block.LastCommit.Signatures), SignedValidators: signedValidators, ValidatorStatus: validatorStatus, From b7cb05e44075d85ae6ebc8626291a4972a4b7ae7 Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:17:05 +0300 Subject: [PATCH 08/13] fix: empty blocks n-1 --- pkg/watcher/block.go | 11 +++++------ pkg/watcher/block_test.go | 9 +++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 67e7d4e..3ecb422 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -31,6 +31,7 @@ type BlockWatcher struct { validatorSet atomic.Value // []*types.Validator latestBlockHeight int64 latestBlockProposer string + latestBlockTransactions int webhook *webhook.Webhook customWebhooks []BlockWebhook } @@ -203,19 +204,16 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { for _, res := range block.ValidatorStatus { icon := "⚪️" if w.latestBlockProposer == res.Address { - if block.Transactions == 0 { + // Check if this is an empty block + if w.latestBlockTransactions == 0 { icon = "🫧" + w.metrics.EmptyBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() } else { icon = "👑" } w.metrics.ProposedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() w.metrics.ValidatedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() w.metrics.ConsecutiveMissedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Set(0) - - // Check if this is an empty block - if block.Transactions == 0 { - w.metrics.EmptyBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() - } } else if res.Signed { icon = "✅" w.metrics.ValidatedBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() @@ -245,6 +243,7 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { w.latestBlockHeight = block.Height w.latestBlockProposer = block.ProposerAddress + w.latestBlockTransactions = block.Transactions } func (w *BlockWatcher) computeValidatorStatus(block *types.Block) []ValidatorStatus { diff --git a/pkg/watcher/block_test.go b/pkg/watcher/block_test.go index b7ee18b..a5131fb 100644 --- a/pkg/watcher/block_test.go +++ b/pkg/watcher/block_test.go @@ -103,7 +103,7 @@ func TestBlockWatcher(t *testing.T) { { ChainID: chainID, Height: 44, - Transactions: 7, + Transactions: 0, TotalValidators: 2, SignedValidators: 2, ProposerAddress: kilnAddress, @@ -120,7 +120,7 @@ func TestBlockWatcher(t *testing.T) { { ChainID: chainID, Height: 45, - Transactions: 0, + Transactions: 7, TotalValidators: 2, SignedValidators: 2, ValidatorStatus: []ValidatorStatus{ @@ -161,11 +161,12 @@ func TestBlockWatcher(t *testing.T) { assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.MissedBlocks)) assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.SoloMissedBlocks)) assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.ConsecutiveMissedBlocks)) - assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.EmptyBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) + assert.Equal(t, 1, testutil.CollectAndCount(blockWatcher.metrics.EmptyBlocks)) assert.Equal(t, float64(2), testutil.ToFloat64(blockWatcher.metrics.ProposedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(4), testutil.ToFloat64(blockWatcher.metrics.ValidatedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.MissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(0), testutil.ToFloat64(blockWatcher.metrics.SoloMissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(0), testutil.ToFloat64(blockWatcher.metrics.ConsecutiveMissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) + assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.EmptyBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) }) -} +} \ No newline at end of file From 08e27cdf77b3c7c3aa6c0ef5059754d0b8ffe4db Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:19:58 +0300 Subject: [PATCH 09/13] chore: extra line --- pkg/watcher/block_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/watcher/block_test.go b/pkg/watcher/block_test.go index a5131fb..46ac671 100644 --- a/pkg/watcher/block_test.go +++ b/pkg/watcher/block_test.go @@ -169,4 +169,4 @@ func TestBlockWatcher(t *testing.T) { assert.Equal(t, float64(0), testutil.ToFloat64(blockWatcher.metrics.ConsecutiveMissedBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) assert.Equal(t, float64(1), testutil.ToFloat64(blockWatcher.metrics.EmptyBlocks.WithLabelValues(chainID, kilnAddress, kilnName))) }) -} \ No newline at end of file +} From 68fc087483e382854a3772a132cd46f0e48f522e Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:50:03 +0300 Subject: [PATCH 10/13] feat: change emoji for empty blocks --- pkg/watcher/block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 3ecb422..2801b14 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -206,7 +206,7 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { if w.latestBlockProposer == res.Address { // Check if this is an empty block if w.latestBlockTransactions == 0 { - icon = "🫧" + icon = "🟠" w.metrics.EmptyBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() } else { icon = "👑" From b6779ccf7e0b840a10c367c0c8c2db6d113b0773 Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:51:26 +0300 Subject: [PATCH 11/13] feat: change emoji color to yellow --- pkg/watcher/block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/watcher/block.go b/pkg/watcher/block.go index 2801b14..e0a2b18 100644 --- a/pkg/watcher/block.go +++ b/pkg/watcher/block.go @@ -206,7 +206,7 @@ func (w *BlockWatcher) handleBlockInfo(ctx context.Context, block *BlockInfo) { if w.latestBlockProposer == res.Address { // Check if this is an empty block if w.latestBlockTransactions == 0 { - icon = "🟠" + icon = "🟡" w.metrics.EmptyBlocks.WithLabelValues(block.ChainID, res.Address, res.Label).Inc() } else { icon = "👑" From 6bb50df591615bd168e0dda1e0a6710f66b5c677 Mon Sep 17 00:00:00 2001 From: Baka <48246993+quertc@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:11:06 +0300 Subject: [PATCH 12/13] fix: glitch in the empty block emoji Co-authored-by: Matt Ketmo --- pkg/watcher/block_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/watcher/block_test.go b/pkg/watcher/block_test.go index 46ac671..3845b3a 100644 --- a/pkg/watcher/block_test.go +++ b/pkg/watcher/block_test.go @@ -146,7 +146,7 @@ func TestBlockWatcher(t *testing.T) { `#41 1/2 validators ✅ Kiln`, `#42 2/2 validators ✅ Kiln`, `#43 2/2 validators 👑 Kiln`, - `#44 2/2 validators 🫧 Kiln`, + `#44 2/2 validators 🟡 Kiln`, }, "\n")+"\n", blockWatcher.writer.(*bytes.Buffer).String(), ) From 86b947898c47c9fe1753f82c06d32db8baa8fbfe Mon Sep 17 00:00:00 2001 From: Artem <48246993+quertc@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:21:14 +0300 Subject: [PATCH 13/13] docs: add empty_blocks metric --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 294a624..ee7509a 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Metrics (without prefix) | Description `node_synced` | Set to 1 is the node is synced (ie. not catching-up) `proposal_end_time` | Timestamp of the voting end time of a proposal `proposed_blocks` | Number of proposed blocks per validator (for a bonded validator) +`empty_blocks` | Number of empty blocks (blocks with zero transactions) proposed by validator `rank` | Rank of the validator `seat_price` | Min seat price to be in the active set (ie. bonded tokens of the latest validator) `signed_blocks_window` | Number of blocks per signing window