diff --git a/config.yaml b/config.yaml index 596b14d..5eb3574 100644 --- a/config.yaml +++ b/config.yaml @@ -35,7 +35,7 @@ rpc: url: https://noble-rpc.polkachu.com:443 - chainName: nois chainId: nois-1 - url: https://rpc.cosmos.directory/nois:443 + url: https://nois.rpc.kjnodes.com:443 - chainName: osmosistestnet chainId: osmo-test-5 url: https://rpc.osmotest5.osmosis.zone:443 diff --git a/pkg/collector/collector.go b/pkg/collector/collector.go index 6caab59..f0b73a9 100644 --- a/pkg/collector/collector.go +++ b/pkg/collector/collector.go @@ -111,6 +111,20 @@ func (cc IBCCollector) Collect(ch chan<- prometheus.Metric) { log.Error(err.Error()) } + ch <- prometheus.MustNewConstMetric( + clientExpiry, + prometheus.GaugeValue, + float64(ci.ChainAClientExpiration.Unix()), + []string{(*cc.RPCs)[path.Chain1.ChainName].ChainID, path.Chain1.ClientID, (*cc.RPCs)[path.Chain2.ChainName].ChainID, status}..., + ) + + ch <- prometheus.MustNewConstMetric( + clientExpiry, + prometheus.GaugeValue, + float64(ci.ChainBClientExpiration.Unix()), + []string{(*cc.RPCs)[path.Chain2.ChainName].ChainID, path.Chain2.ClientID, (*cc.RPCs)[path.Chain1.ChainName].ChainID, status}..., + ) + stuckPackets, err := ibc.GetChannelInfo(path, cc.RPCs) if err != nil { status = errorStatus @@ -155,20 +169,6 @@ func (cc IBCCollector) Collect(ch chan<- prometheus.Metric) { }..., ) } - - ch <- prometheus.MustNewConstMetric( - clientExpiry, - prometheus.GaugeValue, - float64(ci.ChainAClientExpiration.Unix()), - []string{(*cc.RPCs)[path.Chain1.ChainName].ChainID, path.Chain1.ClientID, (*cc.RPCs)[path.Chain2.ChainName].ChainID, status}..., - ) - - ch <- prometheus.MustNewConstMetric( - clientExpiry, - prometheus.GaugeValue, - float64(ci.ChainBClientExpiration.Unix()), - []string{(*cc.RPCs)[path.Chain2.ChainName].ChainID, path.Chain2.ClientID, (*cc.RPCs)[path.Chain1.ChainName].ChainID, status}..., - ) }(p) } diff --git a/pkg/ibc/ibc.go b/pkg/ibc/ibc.go index ab0b83b..da5dd64 100644 --- a/pkg/ibc/ibc.go +++ b/pkg/ibc/ibc.go @@ -90,6 +90,12 @@ func GetChannelInfo(ibc *relayer.IBCdata, rpcs *map[string]config.RPC) (Channels ctx := context.Background() channelInfo := ChannelsInfo{} + if (*rpcs)[ibc.Chain1.ChainName].ChainID == "" || (*rpcs)[ibc.Chain2.ChainName].ChainID == "" { + return ChannelsInfo{}, fmt.Errorf( + "Error: RPC data is missing, cannot retrieve channel data", + ) + } + cdA := chain.Info{ ChainID: (*rpcs)[ibc.Chain1.ChainName].ChainID, RPCAddr: (*rpcs)[ibc.Chain1.ChainName].URL,