Skip to content

Commit

Permalink
metrics: fix peer number metric in offline mode
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Sep 6, 2016
1 parent 17a84a1 commit 98bf4c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/corehttp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 98bf4c4

Please sign in to comment.