@cryptotaxi247 / kubo / commits / 7faa32459

metrics: fix peer number metric in offline mode

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Sep 6, 2016 at 09:49 UTC 7faa32459af68ee8b49b7ec2bf54030b31a0f139
1 file changed +3
core/corehttp/metrics.go
+3
@@ -53,6 +53,9 @@ func (c IpfsNodeCollector) Collect(ch chan<- prometheus.Metric) {
53
54 func (c IpfsNodeCollector) PeersTotalValues() map[string]float64 {
55 vals := make(map[string]float64)
56 + if c.Node.PeerHost == nil {
57 + return vals
58 + }
59 for _, conn := range c.Node.PeerHost.Network().Conns() {
60 tr := ""
61 for _, proto := range conn.RemoteMultiaddr().Protocols() {