Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/state: Add some state metrics #504

Open
wants to merge 1 commit into
base: pre-release
Choose a base branch
from

Conversation

c98tristan
Copy link
Contributor

@c98tristan c98tristan commented Jan 24, 2025

This pull request introduces several updates to the core/state and tomox/tradingstate packages, focusing on enhancing the Commit method to return an additional integer value representing the number of committed nodes. Additionally, it includes various code refactorings and improvements to metrics tracking.

Updates to core/state package:

  • Enhanced Commit method: Modified the Commit method in multiple files to return an additional integer value indicating the number of committed nodes. (core/state/database.go, core/state/state_object.go, core/state/statedb.go, light/postprocess.go, light/trie.go) [1] [2] [3] Ff568cf3L175R175, [4]
  • Metrics tracking: Introduced new metrics to track account and storage updates, deletions, and commits. (core/state/metrics.go, core/state/state_object.go, core/state/statedb.go) [1] [2] [3]
	accountUpdatedMeter   = metrics.NewRegisteredMeter("state/update/account", nil)
	storageUpdatedMeter   = metrics.NewRegisteredMeter("state/update/storage", nil)
	accountDeletedMeter   = metrics.NewRegisteredMeter("state/delete/account", nil)
	storageDeletedMeter   = metrics.NewRegisteredMeter("state/delete/storage", nil)
	accountCommittedMeter = metrics.NewRegisteredMeter("state/commit/account", nil)
	storageCommittedMeter = metrics.NewRegisteredMeter("state/commit/storage", nil)
# TYPE state_update_account gauge
state_update_account 7298

# TYPE state_update_storage gauge
state_update_storage 4004

# TYPE state_delete_account gauge
state_delete_account 2156

# TYPE state_delete_storage gauge
state_delete_storage 0

# TYPE state_commit_account gauge
state_commit_account 2405

# TYPE state_commit_storage gauge
state_commit_storage 10262

Updates to tomox/tradingstate package:

  • Enhanced Commit method: Updated the Commit method across various files to return an additional integer value for the number of committed nodes. (tomox/tradingstate/database.go, tomox/tradingstate/state_lendingbook.go, tomox/tradingstate/state_liquidationprice.go, tomox/tradingstate/state_orderList.go, tomox/tradingstate/state_orderbook.go, tomox/tradingstate/statedb.go, tomox/tradingstate/tomox_trie.go) [1] [2] [3] [4] [5] [6] [7]
  • Code refactoring: Improved code readability by reordering imports and adjusting comments. (tomox/tradingstate/state_lendingbook.go, tomox/tradingstate/state_liquidationprice.go, tomox/tradingstate/state_itemList.go, tomoxlending/lendingstate/state_lendingbook.go) [1] [2] [3] [4]

These changes collectively improve the functionality and maintainability of the codebase by providing more detailed commit information and enhancing metrics tracking.

Reference:

@c98tristan c98tristan changed the title Add some state metrics core/state: Add some state metrics Jan 24, 2025
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.

1 participant