You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by el...@apache.org on 2017/01/17 23:01:55 UTC

[3/4] incubator-trafficcontrol git commit: Change TM2 poll params to match TM1

Change TM2 poll params to match TM1

Changes Traffic Monitor 2.0 'stat' poll, which corresponds to the 1.0
'health' poll, to use the 'health.polling.interval' parameter, and
changes the 'health' poll to use a 'heartbeat.polling.interval' param.


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

Branch: refs/heads/master
Commit: 7e80e88c5458167d6778cf11b8fb7bf56c58b4d1
Parents: 8833d3e
Author: Robert Butts <ro...@gmail.com>
Authored: Tue Jan 17 14:03:21 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Tue Jan 17 16:00:43 2017 -0700

----------------------------------------------------------------------
 .../traffic_monitor/manager/monitorconfig.go    | 30 ++++++++------------
 1 file changed, 12 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7e80e88c/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go b/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
index c9d9005..b199b55 100644
--- a/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
+++ b/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
@@ -139,16 +139,6 @@ func trafficOpsHealthPollIntervalToDuration(t int) time.Duration {
 
 // getPollIntervals reads the Traffic Ops Client monitorConfig structure, and parses and returns the health, peer, and stat poll intervals
 func getHealthPeerStatPollIntervals(monitorConfig to.TrafficMonitorConfigMap, cfg config.Config) (time.Duration, time.Duration, time.Duration, error) {
-	healthPollIntervalI, healthPollIntervalExists := monitorConfig.Config["health.polling.interval"]
-	if !healthPollIntervalExists {
-		return 0, 0, 0, fmt.Errorf("Traffic Ops Monitor config missing 'health.polling.interval', not setting config changes.\n")
-	}
-	healthPollIntervalInt, healthPollIntervalIsInt := healthPollIntervalI.(float64)
-	if !healthPollIntervalIsInt {
-		return 0, 0, 0, fmt.Errorf("Traffic Ops Monitor config 'health.polling.interval' value '%v' type %T is not an integer, not setting config changes.\n", healthPollIntervalI, healthPollIntervalI)
-	}
-	healthPollInterval := trafficOpsHealthPollIntervalToDuration(int(healthPollIntervalInt))
-
 	peerPollIntervalI, peerPollIntervalExists := monitorConfig.Config["peers.polling.interval"]
 	if !peerPollIntervalExists {
 		return 0, 0, 0, fmt.Errorf("Traffic Ops Monitor config missing 'peers.polling.interval', not setting config changes.\n")
@@ -159,22 +149,26 @@ func getHealthPeerStatPollIntervals(monitorConfig to.TrafficMonitorConfigMap, cf
 	}
 	peerPollInterval := trafficOpsPeerPollIntervalToDuration(int(peerPollIntervalInt))
 
-	statPollIntervalI, statPollIntervalExists := monitorConfig.Config["stat.polling.interval"]
+	statPollIntervalI, statPollIntervalExists := monitorConfig.Config["health.polling.interval"]
 	if !statPollIntervalExists {
-		log.Warnf("Traffic Ops Monitor config missing 'stat.polling.interval', using health for stat.\n")
-		statPollIntervalI = healthPollIntervalI
+		return 0, 0, 0, fmt.Errorf("Traffic Ops Monitor config missing 'health.polling.interval', not setting config changes.\n")
 	}
 	statPollIntervalInt, statPollIntervalIsInt := statPollIntervalI.(float64)
 	if !statPollIntervalIsInt {
-		log.Warnf("Traffic Ops Monitor config 'stat.polling.interval' value '%v' type %T is not an integer, using health for stat\n", statPollIntervalI, statPollIntervalI)
-		statPollIntervalInt = healthPollIntervalInt
+		return 0, 0, 0, fmt.Errorf("Traffic Ops Monitor config 'health.polling.interval' value '%v' type %T is not an integer, not setting config changes.\n", statPollIntervalI, statPollIntervalI)
 	}
 	statPollInterval := trafficOpsStatPollIntervalToDuration(int(statPollIntervalInt))
 
-	// Formerly, only 'health' polling existed. If TO still has old configuration and doesn't have a 'stat' parameter, this allows us to assume the 'health' poll is slow, and sets it to the stat poll (which used to be the only poll, getting all astats data) to the given presumed-slow health poll, and set the now-fast-and-small health poll to a short fraction of that.
-	if healthPollIntervalExists && !statPollIntervalExists {
-		healthPollInterval = time.Duration(float64(healthPollInterval) / float64(cfg.HealthToStatRatio))
+	healthPollIntervalI, healthPollIntervalExists := monitorConfig.Config["heartbeat.polling.interval"]
+	healthPollIntervalInt, healthPollIntervalIsInt := healthPollIntervalI.(float64)
+	if !healthPollIntervalExists {
+		log.Warnf("Traffic Ops Monitor config missing 'heartbeat.polling.interval', using health for heartbeat.\n")
+		healthPollIntervalInt = statPollIntervalInt
+	} else if !healthPollIntervalIsInt {
+		log.Warnf("Traffic Ops Monitor config 'heartbeat.polling.interval' value '%v' type %T is not an integer, using health for heartbeat\n", statPollIntervalI, statPollIntervalI)
+		healthPollIntervalInt = statPollIntervalInt
 	}
+	healthPollInterval := trafficOpsHealthPollIntervalToDuration(int(healthPollIntervalInt))
 
 	return healthPollInterval, peerPollInterval, statPollInterval, nil
 }