Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master abb982e5f -> d6fa0523f


Fix case where peer becomes available and no error is present, resulting in an 
empty event description.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9ca99c7c
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9ca99c7c
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9ca99c7c

Branch: refs/heads/master
Commit: 9ca99c7cc2899d474c10ddfb7d244e172338830f
Parents: abb982e
Author: Jeff Elsloo <jeffrey_els...@cable.comcast.com>
Authored: Fri Feb 10 13:56:07 2017 -0700
Committer: Dave Neuman <neu...@apache.org>
Committed: Tue Feb 14 09:53:17 2017 -0700

----------------------------------------------------------------------
 traffic_monitor_golang/traffic_monitor/manager/peer.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9ca99c7c/traffic_monitor_golang/traffic_monitor/manager/peer.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/manager/peer.go 
b/traffic_monitor_golang/traffic_monitor/manager/peer.go
index 2472d17..f78b942 100644
--- a/traffic_monitor_golang/traffic_monitor/manager/peer.go
+++ b/traffic_monitor_golang/traffic_monitor/manager/peer.go
@@ -44,6 +44,14 @@ func StartPeerManager(
 
 func comparePeerState(events health.ThreadsafeEvents, result peer.Result, 
peerStates peer.CRStatesPeersThreadsafe) {
        if result.Available != peerStates.GetPeerAvailability(result.ID) {
-               events.Add(health.Event{Time: health.Time(result.Time), 
Description: util.JoinErrorsString(result.Errors), Name: result.ID.String(), 
Hostname: result.ID.String(), Type: "Peer", Available: result.Available})
+               description := util.JoinErrorsString(result.Errors)
+
+               if description == "" && result.Available {
+                       description = "Peer is reachable"
+               } else if description == "" && !result.Available {
+                       description = "Peer is unreachable"
+               }
+
+               events.Add(health.Event{Time: health.Time(result.Time), 
Description: description, Name: result.ID.String(), Hostname: 
result.ID.String(), Type: "Peer", Available: result.Available})
        }
 }

Reply via email to