QuokkaStake / cosmos-validators-exporter

A Prometheus exporter to fetch data about your validators in Cosmos-based blockchains.
GNU General Public License v3.0
12 stars 14 forks source link

Fix panic when the node is not synced on querying delegations #31

Closed freak12techno closed 1 year ago

freak12techno commented 1 year ago
12:51PM DBG Query is finished component=http duration=2.181219 url=https://api.jackal.quokkastake.io/cosmos/staking/v1beta1/validators/jklvaloper1ramqkapjkg0f58vypc43szaqp5juq0ly93t3hm/delegations?pagination.count_total=true&pagination.limit=1
panic: strconv.ParseInt: parsing "": invalid syntax
goroutine 876378 [running]:
main/pkg/utils.StrToInt64(...)
    /home/monitoring/cosmos-validators-exporter/pkg/utils/utils.go:29
main/pkg/queriers.(*DelegationsQuerier).GetMetrics.func1({0xc0011202c0, 0x31}, 0xc0022093e0?, {{0xc000fff8b0, 0x6}, {0xc000e7bf20, 0x21}, {0x0, 0x0}, {0xc000fff930, ...}, ...})
    /home/monitoring/cosmos-validators-exporter/pkg/queriers/delegations.go:72 +0x465
created by main/pkg/queriers.(*DelegationsQuerier).GetMetrics
    /home/monitoring/cosmos-validators-exporter/pkg/queriers/delegations.go:45 +0x2e5

Node response:

{
  "code": 2,
  "message": "runtime error: invalid memory address or nil pointer dereference: panic",
  "details": [
  ]
}