From 2a33805d223c88fe5d62506090ea635fe0127203 Mon Sep 17 00:00:00 2001 From: Miguel Angel Rojo Fernandez Date: Tue, 26 Nov 2024 15:46:18 +0000 Subject: [PATCH] added accounts write --- state/metrics.go | 2 +- state/state.go | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/state/metrics.go b/state/metrics.go index 42cdc4c36..f7c1b38a5 100644 --- a/state/metrics.go +++ b/state/metrics.go @@ -4,4 +4,4 @@ import ( "github.com/vechain/thor/v2/metrics" ) -var metricAccountWriteCounter = metrics.LazyLoadCounterVec("account_write_count", []string{"type"}) \ No newline at end of file +var metricAccountCounter = metrics.LazyLoadCounterVec("account_write_count", []string{"type"}) \ No newline at end of file diff --git a/state/state.go b/state/state.go index e2df7c717..a1eca9479 100644 --- a/state/state.go +++ b/state/state.go @@ -519,11 +519,6 @@ func (s *State) Stage(newVer trie.Version) (*Stage, error) { root := trieCpy.Hash() tries = append(tries, trieCpy) - if len(changes) > 0 { - // If gets here, there are addresses with changes and saveAccount was successful - metricAccountWriteCounter().AddWithLabel(int64(len(changes)), map[string]string{"type": "trie"}) - } - return &Stage{ root: root, commit: func() error { @@ -544,7 +539,7 @@ func (s *State) Stage(newVer trie.Version) (*Stage, error) { } } // If gets here, all tries were committed successfully and the last one contains the updated accounts. - metricAccountWriteCounter().AddWithLabel(int64(len(changes)), map[string]string{"type": "state"}) + metricAccountCounter().AddWithLabel(int64(len(changes)), map[string]string{"type": "write"}) return nil }, }, nil