Skip to content

Commit

Permalink
added accounts write
Browse files Browse the repository at this point in the history
  • Loading branch information
freemanzMrojo committed Nov 26, 2024
1 parent 72493c4 commit 2a33805
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion state/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import (
"github.com/vechain/thor/v2/metrics"
)

var metricAccountWriteCounter = metrics.LazyLoadCounterVec("account_write_count", []string{"type"})
var metricAccountCounter = metrics.LazyLoadCounterVec("account_write_count", []string{"type"})
7 changes: 1 addition & 6 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 2a33805

Please sign in to comment.