diff --git a/core/corehttp/metrics.go b/core/corehttp/metrics.go index 5e16d04f4ec..0ef0ba6f436 100644 --- a/core/corehttp/metrics.go +++ b/core/corehttp/metrics.go @@ -53,6 +53,9 @@ func (c IpfsNodeCollector) Collect(ch chan<- prometheus.Metric) { func (c IpfsNodeCollector) PeersTotalValues() map[string]float64 { vals := make(map[string]float64) + if c.Node.PeerHost == nil { + return vals + } for _, conn := range c.Node.PeerHost.Network().Conns() { tr := "" for _, proto := range conn.RemoteMultiaddr().Protocols() {