Skip to content

MX-17032 Added Metrics for Tracked Blocks#7331

Merged
AdoAdoAdo merged 12 commits into
rc/supernovafrom
termui-added-metrics-update
Nov 20, 2025
Merged

MX-17032 Added Metrics for Tracked Blocks#7331
AdoAdoAdo merged 12 commits into
rc/supernovafrom
termui-added-metrics-update

Conversation

@mradian1

Copy link
Copy Markdown

Reasoning behind the pull request

  • Added metrics for Number of Tracked Blocks
  • Exposed new metric in Termui

Proposed changes

Testing procedure

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@mradian1 mradian1 self-assigned this Oct 10, 2025
@mradian1 mradian1 requested a review from Copilot October 10, 2025 08:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds metrics for tracking the number of blocks in the transaction pool to enhance observability. The implementation exposes the tracked blocks count through metrics and displays it in the terminal UI.

  • Added a new metric MetricNumTrackedBlocks to track the number of blocks monitored by the transaction pool
  • Implemented GetNumTrackedBlocks() method across the transaction pool interfaces and implementations
  • Updated terminal UI to display the tracked blocks metric in the block info widget

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
common/constants.go Added metric constant for number of tracked blocks
dataRetriever/interface.go Extended interface with GetNumTrackedBlocks method
dataRetriever/txpool/shardedTxPool.go Implemented GetNumTrackedBlocks method delegation
dataRetriever/shardedData/shardedData.go Added stub implementation with warning log
process/block/shardblock.go Added metric update during block commit
cmd/termui/view/interface.go Extended presenter interface
cmd/termui/presenter/blockInfoGetters.go Implemented metric getter
cmd/termui/view/termuic/termuiRenders/widgetsRender.go Added display of tracked blocks count
testscommon/*.go Updated test stubs and mocks
Tests Added test coverage and updated existing tests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

durationSentOrReceivedBlockToReceivedSignatures),
}

rows[9] = []string{fmt.Sprintf("Num tracked blocks: %d", wr.presenter.GetNumTrackedBlocks())}

Copilot AI Oct 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded index 9 for the tracked blocks row makes the code fragile. Consider inserting this row sequentially after row 8 or using a variable to track the current row index.

Suggested change
rows[9] = []string{fmt.Sprintf("Num tracked blocks: %d", wr.presenter.GetNumTrackedBlocks())}
// Insert tracked blocks row after the last used index (which is 8)
rowIdx := 9
rows[rowIdx] = []string{fmt.Sprintf("Num tracked blocks: %d", wr.presenter.GetNumTrackedBlocks())}

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to sequential order of rows

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

sstanculeanu
sstanculeanu previously approved these changes Oct 10, 2025
Comment on lines 349 to 352
rows[6] = []string{
fmt.Sprintf("Received proposed block: %.6f sec | Received signatures: %.6f sec",
fmt.Sprintf("Received proposed block: %.6f sec | Received proof: %.6f sec",
durationStartRoundToSentOrReceivedBlock,
durationSentOrReceivedBlockToReceivedSignatures),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change ok? we're still printing durationSentOrReceivedBlockToReceivedSignatures

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made changes, so now the correct term is Proof, I forgot to change here. I have also changed the names of the variables accordingly, now

Comment thread process/block/shardblock.go Outdated
return err
}

log.Debug("Number of tracked blocks Metrics updated", "num", sp.dataPool.Transactions().GetNumTrackedBlocks())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to log this here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

}

log.Debug("Number of tracked blocks Metrics updated", "num", sp.dataPool.Transactions().GetNumTrackedBlocks())
sp.appStatusHandler.SetUInt64Value(common.MetricNumTrackedBlocks, sp.dataPool.Transactions().GetNumTrackedBlocks())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be called also for metaBlock ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is no Mempool on meta, so there is no SelectTransactions. We wouldn't have what to track here

Base automatically changed from termui-new-metrics to rc/supernova October 14, 2025 09:48
@sstanculeanu sstanculeanu dismissed their stale review October 14, 2025 09:48

The base branch was changed.

@codecov

codecov Bot commented Oct 15, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.57143% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.81%. Comparing base (e75d454) to head (54d9872).
⚠️ Report is 13 commits behind head on rc/supernova.

Files with missing lines Patch % Lines
dataRetriever/shardedData/shardedData.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           rc/supernova    #7331      +/-   ##
================================================
- Coverage         76.81%   76.81%   -0.01%     
================================================
  Files               846      846              
  Lines            113162   113181      +19     
================================================
+ Hits              86930    86935       +5     
- Misses            20392    20404      +12     
- Partials           5840     5842       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: c1594cfba313c1393572e5115371a5293501ae19
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_15__09_52_39
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 2ef401cddd45b502abbe60363e37e736c7b0f9bd
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_15__16_22_23
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 2ef401cddd45b502abbe60363e37e736c7b0f9bd
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_15__19_13_00
  • PYTEST_EXIT_CODE: ``

sstanculeanu
sstanculeanu previously approved these changes Oct 16, 2025
func (wr *WidgetsRender) prepareBlockInfo() {
// 8 rows and one column
numRows := 9
numRows := 10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update comment as well on L302

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ssd04
ssd04 previously approved these changes Oct 16, 2025
@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: b9e30708486d65bb09643ff761e7142a3dcc8e64
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_16__14_23_52
  • PYTEST_EXIT_CODE: 1

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: b9e30708486d65bb09643ff761e7142a3dcc8e64
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 7eb0e778a2d1a9d7dd6e49e005ad1fc7e0aea307

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_16__15_50_50
  • PYTEST_EXIT_CODE: 1

sstanculeanu
sstanculeanu previously approved these changes Oct 17, 2025
@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 6beffcebbf1b3049252735904076333875c4f24f
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 6eb2769b5e919b7729ae46c74011debf82ddd962

🚀 Environment Variables:

  • TIMESTAMP: 2025_OCTOBER_20__08_40_46
  • PYTEST_EXIT_CODE: 1

"github.com/multiversx/mx-chain-core-go/data/block"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-core-go/marshal"
"github.com/multiversx/mx-chain-go/config"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ssd04

ssd04 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

no other things from me

@github-actions

Copy link
Copy Markdown

Integration Tests completed with failures or errors.

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 54d98721c028240cea284effac0cdf7d1aeba76c
  • Current Branch: termui-added-metrics-update
  • mx-chain-go Target Branch: rc/supernova
  • mx-chain-simulator-go Target Branch: rc/supernova
  • mx-chain-testing-suite Target Branch: rc/supernova
  • mx-chain-simulator-go Commit Hash: 16860d51e88167e90f21d2342349a05ebe07b450

🚀 Environment Variables:

  • TIMESTAMP: 2025_NOVEMBER_11__10_34_06
  • PYTEST_EXIT_CODE: 1

@AdoAdoAdo AdoAdoAdo merged commit ffd06b7 into rc/supernova Nov 20, 2025
11 of 14 checks passed
@AdoAdoAdo AdoAdoAdo deleted the termui-added-metrics-update branch November 20, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants