Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions logging/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ var ErrorCount = prometheus.NewCounter(
},
)

var DBBlockCount = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "juno_db_total_blocks",
Help: "Total number of blocks in database.",
},
[]string{"total_blocks_in_db"},
)

var RPCRequestErrors = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_rpc_errors_total",
Expand Down Expand Up @@ -101,7 +93,6 @@ func init() {
prometheus.MustRegister(WorkerCount)
prometheus.MustRegister(WorkerHeight)
prometheus.MustRegister(ErrorCount)
prometheus.MustRegister(DBBlockCount)
prometheus.MustRegister(DBLatestHeight)
prometheus.MustRegister(RPCRequestErrors)
prometheus.MustRegister(DBOperationErrors)
Expand Down
15 changes: 7 additions & 8 deletions parser/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (w Worker) HandleGenesis(genesisDoc *tmtypes.GenesisDoc, appState map[strin
// consensus public key. An error is returned if the public key cannot be Bech32
// encoded or if the DB write fails.
func (w Worker) SaveValidators(vals []*tmtypes.Validator) error {
var validators = make([]*types.Validator, len(vals))
validators := make([]*types.Validator, len(vals))
for index, val := range vals {
consAddr := sdk.NewConsAddress(val.Address).String()

Expand Down Expand Up @@ -372,14 +372,13 @@ func (w Worker) ExportTxs(txs []*types.Tx) error {
}
}

totalBlocks := w.db.GetTotalBlocks()
logging.DBBlockCount.WithLabelValues("total_blocks_in_db").Set(float64(totalBlocks))

dbLatestHeight, err := w.db.GetLastBlockHeight()
if err != nil {
return err
if w.cfg.Monitoring.Enabled {
dbLatestHeight, err := w.db.GetLastBlockHeight()
if err != nil {
return err
}
logging.DBLatestHeight.WithLabelValues("db_latest_height").Set(float64(dbLatestHeight))
}
logging.DBLatestHeight.WithLabelValues("db_latest_height").Set(float64(dbLatestHeight))

return nil
}
Loading