diff --git a/state/metrics.go b/state/metrics.go new file mode 100644 index 000000000..e1667668a --- /dev/null +++ b/state/metrics.go @@ -0,0 +1,10 @@ +// Copyright (c) 2024 The VeChainThor developers +// +// Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying +// file LICENSE or + +package state + +import "github.com/vechain/thor/v2/metrics" + +var metricAccountChanges = metrics.LazyLoadCounter("account_state_changes_count") diff --git a/state/state.go b/state/state.go index 5312e297c..119546d3e 100644 --- a/state/state.go +++ b/state/state.go @@ -538,6 +538,8 @@ func (s *State) Stage(newVer trie.Version) (*Stage, error) { return err } } + // Just once for the account trie. + metricAccountChanges().Add(int64(len(changes))) return nil }, }, nil