forked from TrueCloudLab/neoneo-go
core: add state height to prometheus metrics
This commit is contained in:
parent
ea17793aee
commit
25fdc62203
2 changed files with 13 additions and 0 deletions
|
@ -1840,6 +1840,7 @@ func (bc *Blockchain) updateStateHeight(newHeight uint32) error {
|
|||
if err != nil {
|
||||
return errors.WithMessage(err, "can't get current state root height")
|
||||
} else if newHeight == h+1 {
|
||||
updateStateHeightMetric(newHeight)
|
||||
return bc.dao.PutCurrentStateRootHeight(h + 1)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -30,6 +30,14 @@ var (
|
|||
Namespace: "neogo",
|
||||
},
|
||||
)
|
||||
//stateHeight prometheus metric.
|
||||
stateHeight = prometheus.NewGauge(
|
||||
prometheus.GaugeOpts{
|
||||
Help: "Current verified state height",
|
||||
Name: "current_state_height",
|
||||
Namespace: "neogo",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -51,3 +59,7 @@ func updateHeaderHeightMetric(hHeight int) {
|
|||
func updateBlockHeightMetric(bHeight uint32) {
|
||||
blockHeight.Set(float64(bHeight))
|
||||
}
|
||||
|
||||
func updateStateHeightMetric(sHeight uint32) {
|
||||
stateHeight.Set(float64(sHeight))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue