Fix state/storage counter metrics. (#8)
The counters for state, storage, and code node no longer work after 00141776bf
.
The structure is sufficiently different I did not see a simple way to restore the code counters, but I did restore the state and storage counters.
Reviewed-on: #8
This commit is contained in:
parent
0c323433af
commit
bb49906860
@ -33,9 +33,6 @@ var (
|
|||||||
|
|
||||||
stateNodeCount prometheus.Counter
|
stateNodeCount prometheus.Counter
|
||||||
storageNodeCount prometheus.Counter
|
storageNodeCount prometheus.Counter
|
||||||
codeNodeCount prometheus.Counter
|
|
||||||
|
|
||||||
activeIteratorCount prometheus.Gauge
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init() {
|
func Init() {
|
||||||
@ -54,20 +51,6 @@ func Init() {
|
|||||||
Name: "storage_node_count",
|
Name: "storage_node_count",
|
||||||
Help: "Number of storage nodes processed",
|
Help: "Number of storage nodes processed",
|
||||||
})
|
})
|
||||||
|
|
||||||
codeNodeCount = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Namespace: namespace,
|
|
||||||
Subsystem: statsSubsystem,
|
|
||||||
Name: "code_node_count",
|
|
||||||
Help: "Number of code nodes processed",
|
|
||||||
})
|
|
||||||
|
|
||||||
activeIteratorCount = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Namespace: namespace,
|
|
||||||
Subsystem: statsSubsystem,
|
|
||||||
Name: "active_iterator_count",
|
|
||||||
Help: "Number of active iterators",
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterGaugeFunc(name string, function func() float64) {
|
func RegisterGaugeFunc(name string, function func() float64) {
|
||||||
@ -94,31 +77,10 @@ func IncStateNodeCount() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IncStorageNodeCount increments the number of storage nodes processed
|
// AddStorageNodeCount increments the number of storage nodes processed
|
||||||
func IncStorageNodeCount() {
|
func AddStorageNodeCount(count int) {
|
||||||
if metrics {
|
if metrics && count > 0 {
|
||||||
storageNodeCount.Inc()
|
storageNodeCount.Add(float64(count))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// IncCodeNodeCount increments the number of code nodes processed
|
|
||||||
func IncCodeNodeCount() {
|
|
||||||
if metrics {
|
|
||||||
codeNodeCount.Inc()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// IncActiveIterCount increments the number of active iterators
|
|
||||||
func IncActiveIterCount() {
|
|
||||||
if metrics {
|
|
||||||
activeIteratorCount.Inc()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DecActiveIterCount decrements the number of active iterators
|
|
||||||
func DecActiveIterCount() {
|
|
||||||
if metrics {
|
|
||||||
activeIteratorCount.Dec()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +124,8 @@ func (s *Service) CreateSnapshot(params SnapshotParams) error {
|
|||||||
nodeSink := func(node types.StateLeafNode) error {
|
nodeSink := func(node types.StateLeafNode) error {
|
||||||
nodeMtx.Lock()
|
nodeMtx.Lock()
|
||||||
defer nodeMtx.Unlock()
|
defer nodeMtx.Unlock()
|
||||||
|
prom.IncStateNodeCount()
|
||||||
|
prom.AddStorageNodeCount(len(node.StorageDiff))
|
||||||
return s.indexer.PushStateNode(tx, node, headerid)
|
return s.indexer.PushStateNode(tx, node, headerid)
|
||||||
}
|
}
|
||||||
ipldSink := func(c types.IPLD) error {
|
ipldSink := func(c types.IPLD) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user