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/02/03 18:18:11 UTC
[1/5] incubator-trafficcontrol git commit: fix bad syntax
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master 567167fc6 -> 224eab5c1
fix bad syntax
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/bcd90eb8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/bcd90eb8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/bcd90eb8
Branch: refs/heads/master
Commit: bcd90eb86531010f292b8d8020692d040bef97e5
Parents: 9f56284
Author: David Neuman <da...@gmail.com>
Authored: Fri Feb 3 10:12:40 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Fri Feb 3 11:17:37 2017 -0700
----------------------------------------------------------------------
traffic_monitor_golang/traffic_monitor/health/cache.go | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bcd90eb8/traffic_monitor_golang/traffic_monitor/health/cache.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/health/cache.go b/traffic_monitor_golang/traffic_monitor/health/cache.go
index 9c30d12..552157d 100644
--- a/traffic_monitor_golang/traffic_monitor/health/cache.go
+++ b/traffic_monitor_golang/traffic_monitor/health/cache.go
@@ -260,8 +260,7 @@ func calculateDeliveryServiceState(deliveryServiceServers map[enum.DeliveryServi
}
deliveryServiceState.DisabledLocations = []enum.CacheName{} // it's important this isn't nil, so it serialises to the JSON `[]` instead of `null`
for _, server := range deliveryServiceServers[deliveryServiceName] {
- deliveryServiceState.DisabledLocations = append(deliveryServiceState.DisabledLocations, server)
- }
+ deliveryServiceState.DisabledLocations = append(deliveryServiceState.DisabledLocations, server)
}
states.SetDeliveryService(deliveryServiceName, deliveryServiceState)
}
[2/5] incubator-trafficcontrol git commit: add comment to make clear
why return is being ignored
Posted by el...@apache.org.
add comment to make clear why return is being ignored
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9f562845
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9f562845
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9f562845
Branch: refs/heads/master
Commit: 9f56284504ec768991f125d5797d864bed445262
Parents: 31b022e
Author: David Neuman <da...@gmail.com>
Authored: Fri Feb 3 10:10:07 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Fri Feb 3 11:17:37 2017 -0700
----------------------------------------------------------------------
traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9f562845/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go b/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
index 20e676d..49f0b0c 100644
--- a/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
+++ b/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
@@ -244,6 +244,7 @@ func addDSPerSecStats(dsName enum.DeliveryServiceName, stat dsdata.Stat, lastSta
stat.CommonStats.ErrorStr.Value = dsErr.Error()
}
+ //it's ok to ignore the 'ok' return here. If the DS doesn't exist, an empty struct will be returned and we can use it.
dsState, _ := states.GetDeliveryService(dsName)
dsState.IsAvailable = stat.CommonStats.IsAvailable.Value
states.SetDeliveryService(dsName, dsState)
[5/5] incubator-trafficcontrol git commit: This closes #250.
Posted by el...@apache.org.
This closes #250.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/224eab5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/224eab5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/224eab5c
Branch: refs/heads/master
Commit: 224eab5c10d8b5e0ebedf18edfb375e0f3c0cff0
Parents: bcd90eb
Author: Jeff Elsloo <je...@cable.comcast.com>
Authored: Fri Feb 3 11:17:58 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Fri Feb 3 11:17:58 2017 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------
[4/5] incubator-trafficcontrol git commit: add disabledLocation
functionality back, remove setting DS status
Posted by el...@apache.org.
add disabledLocation functionality back, remove setting DS status
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/31b022ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/31b022ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/31b022ed
Branch: refs/heads/master
Commit: 31b022edd14e8cae9d578fac3bb41a608c49d9a6
Parents: a326d64
Author: David Neuman <da...@gmail.com>
Authored: Fri Feb 3 09:48:22 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Fri Feb 3 11:17:37 2017 -0700
----------------------------------------------------------------------
.../traffic_monitor/health/cache.go | 38 +++++++++-----------
1 file changed, 17 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/31b022ed/traffic_monitor_golang/traffic_monitor/health/cache.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/health/cache.go b/traffic_monitor_golang/traffic_monitor/health/cache.go
index 0014f90..9c30d12 100644
--- a/traffic_monitor_golang/traffic_monitor/health/cache.go
+++ b/traffic_monitor_golang/traffic_monitor/health/cache.go
@@ -201,7 +201,7 @@ func CalcAvailability(results []cache.Result, pollerName string, statResultHisto
localStates.SetCache(result.ID, peer.IsAvailable{IsAvailable: isAvailable})
}
- // calculateDeliveryServiceState(toData.DeliveryServiceServers, localStates)
+ calculateDeliveryServiceState(toData.DeliveryServiceServers, localStates)
localCacheStatusThreadsafe.Set(localCacheStatuses)
}
@@ -250,23 +250,19 @@ func eventDesc(status enum.CacheStatus, message string) string {
return fmt.Sprintf("%s - %s", status, message)
}
-// calculateDeliveryServiceState calculates the state of delivery services from the new cache state data `cacheState` and the CRConfig data `deliveryServiceServers` and puts the calculated state in the outparam `deliveryServiceStates`
-// func calculateDeliveryServiceState(deliveryServiceServers map[enum.DeliveryServiceName][]enum.CacheName, states peer.CRStatesThreadsafe) {
-// deliveryServices := states.GetDeliveryServices()
-// for deliveryServiceName, deliveryServiceState := range deliveryServices {
-// if _, ok := deliveryServiceServers[deliveryServiceName]; !ok {
-// // log.Errorf("CRConfig does not have delivery service %s, but traffic monitor poller does; skipping\n", deliveryServiceName)
-// continue
-// }
-// deliveryServiceState.IsAvailable = false
-// deliveryServiceState.DisabledLocations = []enum.CacheName{} // it's important this isn't nil, so it serialises to the JSON `[]` instead of `null`
-// for _, server := range deliveryServiceServers[deliveryServiceName] {
-// if available, _ := states.GetCache(server); available.IsAvailable {
-// deliveryServiceState.IsAvailable = true
-// } else {
-// deliveryServiceState.DisabledLocations = append(deliveryServiceState.DisabledLocations, server)
-// }
-// }
-// states.SetDeliveryService(deliveryServiceName, deliveryServiceState)
-// }
-// }
+//calculateDeliveryServiceState calculates the state of delivery services from the new cache state data `cacheState` and the CRConfig data `deliveryServiceServers` and puts the calculated state in the outparam `deliveryServiceStates`
+func calculateDeliveryServiceState(deliveryServiceServers map[enum.DeliveryServiceName][]enum.CacheName, states peer.CRStatesThreadsafe) {
+ deliveryServices := states.GetDeliveryServices()
+ for deliveryServiceName, deliveryServiceState := range deliveryServices {
+ if _, ok := deliveryServiceServers[deliveryServiceName]; !ok {
+ log.Infof("CRConfig does not have delivery service %s, but traffic monitor poller does; skipping\n", deliveryServiceName)
+ continue
+ }
+ deliveryServiceState.DisabledLocations = []enum.CacheName{} // it's important this isn't nil, so it serialises to the JSON `[]` instead of `null`
+ for _, server := range deliveryServiceServers[deliveryServiceName] {
+ deliveryServiceState.DisabledLocations = append(deliveryServiceState.DisabledLocations, server)
+ }
+ }
+ states.SetDeliveryService(deliveryServiceName, deliveryServiceState)
+ }
+}
[3/5] incubator-trafficcontrol git commit: set DS isAvailable in
CrStates
Posted by el...@apache.org.
set DS isAvailable in CrStates
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a326d64d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a326d64d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a326d64d
Branch: refs/heads/master
Commit: a326d64d7312e484c08d1f9b017b88808f9c699d
Parents: 567167f
Author: David Neuman <da...@gmail.com>
Authored: Thu Feb 2 15:18:08 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Fri Feb 3 11:17:37 2017 -0700
----------------------------------------------------------------------
.../traffic_monitor/deliveryservice/stat.go | 21 ++++++----
.../traffic_monitor/health/cache.go | 40 ++++++++++----------
.../traffic_monitor/manager/stat.go | 2 +-
3 files changed, 34 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a326d64d/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go b/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
index a70cabb..20e676d 100644
--- a/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
+++ b/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
@@ -208,7 +208,7 @@ func addLastDSStatTotals(lastStat dsdata.LastDSStat, cachesReporting map[enum.Ca
}
// addDSPerSecStats calculates and adds the per-second delivery service stats to both the Stats and LastStats structures, and returns the augmented structures.
-func addDSPerSecStats(dsName enum.DeliveryServiceName, stat dsdata.Stat, lastStats dsdata.LastStats, dsStats dsdata.Stats, serverCachegroups map[enum.CacheName]enum.CacheGroupName, serverTypes map[enum.CacheName]enum.CacheType, mc to.TrafficMonitorConfigMap, events health.ThreadsafeEvents, precomputed map[enum.CacheName]cache.PrecomputedData) (dsdata.Stats, dsdata.LastStats) {
+func addDSPerSecStats(dsName enum.DeliveryServiceName, stat dsdata.Stat, lastStats dsdata.LastStats, dsStats dsdata.Stats, serverCachegroups map[enum.CacheName]enum.CacheGroupName, serverTypes map[enum.CacheName]enum.CacheType, mc to.TrafficMonitorConfigMap, events health.ThreadsafeEvents, precomputed map[enum.CacheName]cache.PrecomputedData, states peer.CRStatesThreadsafe) (dsdata.Stats, dsdata.LastStats) {
err := error(nil)
lastStat, lastStatExists := lastStats.DeliveryServices[dsName]
if !lastStatExists {
@@ -241,8 +241,12 @@ func addDSPerSecStats(dsName enum.DeliveryServiceName, stat dsdata.Stat, lastSta
if dsErr != nil {
stat.CommonStats.IsAvailable.Value = false
stat.CommonStats.IsHealthy.Value = false
- stat.CommonStats.ErrorStr.Value = err.Error()
+ stat.CommonStats.ErrorStr.Value = dsErr.Error()
+
}
+ dsState, _ := states.GetDeliveryService(dsName)
+ dsState.IsAvailable = stat.CommonStats.IsAvailable.Value
+ states.SetDeliveryService(dsName, dsState)
getEvent := func(desc string) health.Event {
return health.Event{
@@ -259,6 +263,7 @@ func addDSPerSecStats(dsName enum.DeliveryServiceName, stat dsdata.Stat, lastSta
} else if stat.CommonStats.IsAvailable.Value == true && lastStat.Available == false {
events.Add(getEvent("REPORTED - available"))
}
+
lastStat.Available = stat.CommonStats.IsAvailable.Value
lastStats.DeliveryServices[dsName] = lastStat
@@ -298,9 +303,9 @@ func addCachePerSecStats(cacheName enum.CacheName, precomputed cache.Precomputed
// we set the (new - old) / lastChangedTime as the KBPS, and update the recorded LastChangedTime and LastChangedValue
//
// TODO handle ATS byte rolling (when the `out_bytes` overflows back to 0)
-func addPerSecStats(precomputed map[enum.CacheName]cache.PrecomputedData, dsStats dsdata.Stats, lastStats dsdata.LastStats, serverCachegroups map[enum.CacheName]enum.CacheGroupName, serverTypes map[enum.CacheName]enum.CacheType, mc to.TrafficMonitorConfigMap, events health.ThreadsafeEvents) (dsdata.Stats, dsdata.LastStats) {
+func addPerSecStats(precomputed map[enum.CacheName]cache.PrecomputedData, dsStats dsdata.Stats, lastStats dsdata.LastStats, serverCachegroups map[enum.CacheName]enum.CacheGroupName, serverTypes map[enum.CacheName]enum.CacheType, mc to.TrafficMonitorConfigMap, events health.ThreadsafeEvents, states peer.CRStatesThreadsafe) (dsdata.Stats, dsdata.LastStats) {
for dsName, stat := range dsStats.DeliveryService {
- dsStats, lastStats = addDSPerSecStats(dsName, stat, lastStats, dsStats, serverCachegroups, serverTypes, mc, events, precomputed)
+ dsStats, lastStats = addDSPerSecStats(dsName, stat, lastStats, dsStats, serverCachegroups, serverTypes, mc, events, precomputed, states)
}
for cacheName, precomputedData := range precomputed {
lastStats = addCachePerSecStats(cacheName, precomputedData, lastStats)
@@ -310,7 +315,7 @@ func addPerSecStats(precomputed map[enum.CacheName]cache.PrecomputedData, dsStat
}
// CreateStats aggregates and creates statistics from given precomputed stat history. It returns the created stats, information about these stats necessary for the next calculation, and any error.
-func CreateStats(precomputed map[enum.CacheName]cache.PrecomputedData, toData todata.TOData, crStates peer.Crstates, lastStats dsdata.LastStats, now time.Time, mc to.TrafficMonitorConfigMap, events health.ThreadsafeEvents) (dsdata.Stats, dsdata.LastStats, error) {
+func CreateStats(precomputed map[enum.CacheName]cache.PrecomputedData, toData todata.TOData, crStates peer.Crstates, lastStats dsdata.LastStats, now time.Time, mc to.TrafficMonitorConfigMap, events health.ThreadsafeEvents, states peer.CRStatesThreadsafe) (dsdata.Stats, dsdata.LastStats, error) {
start := time.Now()
dsStats := dsdata.NewStats()
for deliveryService := range toData.DeliveryServiceServers {
@@ -361,7 +366,7 @@ func CreateStats(precomputed map[enum.CacheName]cache.PrecomputedData, toData to
}
}
- perSecStats, lastStats := addPerSecStats(precomputed, dsStats, lastStats, toData.ServerCachegroups, toData.ServerTypes, mc, events)
+ perSecStats, lastStats := addPerSecStats(precomputed, dsStats, lastStats, toData.ServerCachegroups, toData.ServerTypes, mc, events, states)
log.Infof("CreateStats took %v\n", time.Since(start))
perSecStats.Time = time.Now()
return perSecStats, lastStats, nil
@@ -369,10 +374,10 @@ func CreateStats(precomputed map[enum.CacheName]cache.PrecomputedData, toData to
func getDSErr(dsName enum.DeliveryServiceName, dsStats dsdata.StatCacheStats, monitorConfig to.TrafficMonitorConfigMap) error {
if tpsThreshold := monitorConfig.DeliveryService[dsName.String()].TotalTPSThreshold; tpsThreshold > 0 && dsStats.TpsTotal.Value > float64(tpsThreshold) {
- return fmt.Errorf("total.tps_total too high (%v > %v)", dsStats.TpsTotal.Value, tpsThreshold)
+ return fmt.Errorf("total.tps_total too high (%.2f > %v)", dsStats.TpsTotal.Value, tpsThreshold)
}
if kbpsThreshold := monitorConfig.DeliveryService[dsName.String()].TotalKbpsThreshold; kbpsThreshold > 0 && dsStats.Kbps.Value > float64(kbpsThreshold) {
- return fmt.Errorf("total.kbps too high (%v > %v)", dsStats.Kbps.Value, kbpsThreshold)
+ return fmt.Errorf("total.kbps too high (%.2f > %v)", dsStats.Kbps.Value, kbpsThreshold)
}
return nil
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a326d64d/traffic_monitor_golang/traffic_monitor/health/cache.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/health/cache.go b/traffic_monitor_golang/traffic_monitor/health/cache.go
index 42ce5a9..0014f90 100644
--- a/traffic_monitor_golang/traffic_monitor/health/cache.go
+++ b/traffic_monitor_golang/traffic_monitor/health/cache.go
@@ -201,7 +201,7 @@ func CalcAvailability(results []cache.Result, pollerName string, statResultHisto
localStates.SetCache(result.ID, peer.IsAvailable{IsAvailable: isAvailable})
}
- calculateDeliveryServiceState(toData.DeliveryServiceServers, localStates)
+ // calculateDeliveryServiceState(toData.DeliveryServiceServers, localStates)
localCacheStatusThreadsafe.Set(localCacheStatuses)
}
@@ -251,22 +251,22 @@ func eventDesc(status enum.CacheStatus, message string) string {
}
// calculateDeliveryServiceState calculates the state of delivery services from the new cache state data `cacheState` and the CRConfig data `deliveryServiceServers` and puts the calculated state in the outparam `deliveryServiceStates`
-func calculateDeliveryServiceState(deliveryServiceServers map[enum.DeliveryServiceName][]enum.CacheName, states peer.CRStatesThreadsafe) {
- deliveryServices := states.GetDeliveryServices()
- for deliveryServiceName, deliveryServiceState := range deliveryServices {
- if _, ok := deliveryServiceServers[deliveryServiceName]; !ok {
- // log.Errorf("CRConfig does not have delivery service %s, but traffic monitor poller does; skipping\n", deliveryServiceName)
- continue
- }
- deliveryServiceState.IsAvailable = false
- deliveryServiceState.DisabledLocations = []enum.CacheName{} // it's important this isn't nil, so it serialises to the JSON `[]` instead of `null`
- for _, server := range deliveryServiceServers[deliveryServiceName] {
- if available, _ := states.GetCache(server); available.IsAvailable {
- deliveryServiceState.IsAvailable = true
- } else {
- deliveryServiceState.DisabledLocations = append(deliveryServiceState.DisabledLocations, server)
- }
- }
- states.SetDeliveryService(deliveryServiceName, deliveryServiceState)
- }
-}
+// func calculateDeliveryServiceState(deliveryServiceServers map[enum.DeliveryServiceName][]enum.CacheName, states peer.CRStatesThreadsafe) {
+// deliveryServices := states.GetDeliveryServices()
+// for deliveryServiceName, deliveryServiceState := range deliveryServices {
+// if _, ok := deliveryServiceServers[deliveryServiceName]; !ok {
+// // log.Errorf("CRConfig does not have delivery service %s, but traffic monitor poller does; skipping\n", deliveryServiceName)
+// continue
+// }
+// deliveryServiceState.IsAvailable = false
+// deliveryServiceState.DisabledLocations = []enum.CacheName{} // it's important this isn't nil, so it serialises to the JSON `[]` instead of `null`
+// for _, server := range deliveryServiceServers[deliveryServiceName] {
+// if available, _ := states.GetCache(server); available.IsAvailable {
+// deliveryServiceState.IsAvailable = true
+// } else {
+// deliveryServiceState.DisabledLocations = append(deliveryServiceState.DisabledLocations, server)
+// }
+// }
+// states.SetDeliveryService(deliveryServiceName, deliveryServiceState)
+// }
+// }
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a326d64d/traffic_monitor_golang/traffic_monitor/manager/stat.go
----------------------------------------------------------------------
diff --git a/traffic_monitor_golang/traffic_monitor/manager/stat.go b/traffic_monitor_golang/traffic_monitor/manager/stat.go
index bb03397..54eaacb 100644
--- a/traffic_monitor_golang/traffic_monitor/manager/stat.go
+++ b/traffic_monitor_golang/traffic_monitor/manager/stat.go
@@ -194,7 +194,7 @@ func processStatResults(
statResultHistoryThreadsafe.Set(statResultHistory)
statMaxKbpsesThreadsafe.Set(statMaxKbpses)
- newDsStats, newLastStats, err := ds.CreateStats(precomputedData, toData, combinedStates, lastStats.Get().Copy(), time.Now(), mc, events)
+ newDsStats, newLastStats, err := ds.CreateStats(precomputedData, toData, combinedStates, lastStats.Get().Copy(), time.Now(), mc, events, localStates)
if err != nil {
errorCount.Inc()
log.Errorf("getting deliveryservice: %v\n", err)