Browse Source

set uptime only when node is connected

Abhishek Kondur 2 years ago
parent
commit
a40f8b2878
1 changed files with 2 additions and 3 deletions
  1. 2 3
      logic/metrics/metrics.go

+ 2 - 3
logic/metrics/metrics.go

@@ -46,10 +46,9 @@ func Collect(iface, server, network string, peerMap models.PeerMap) (*models.Met
 		newMetric.TotalSent = int64(proxyMetrics.TrafficSent)
 		newMetric.Latency = int64(proxyMetrics.LastRecordedLatency)
 		newMetric.Connected = proxyMetrics.NodeConnectionStatus[id]
-		if !newMetric.Connected {
-			newMetric.Latency = 999
+		if newMetric.Connected {
+			newMetric.Uptime = 1
 		}
-		newMetric.Uptime = 1
 		// check device peer to see if WG is working if ping failed
 		if !newMetric.Connected {
 			if currPeer.ReceiveBytes > 0 &&