You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2017/02/02 22:05:53 UTC
[2/4] incubator-trafficcontrol git commit: Fix TM2 negative PerSec to
assume rollover
Fix TM2 negative PerSec to assume rollover
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/1980d38b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/1980d38b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/1980d38b
Branch: refs/heads/master
Commit: 1980d38ba665f28cccbd126d3c92ac9b8c96a651
Parents: 5c0fd74
Author: Robert Butts <ro...@gmail.com>
Authored: Thu Feb 2 13:28:44 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Thu Feb 2 15:05:22 2017 -0700
----------------------------------------------------------------------
.../traffic_monitor/deliveryservice/stat.go | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1980d38b/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 b50f20e..dd1e87c 100644
--- a/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
+++ b/traffic_monitor_golang/traffic_monitor/deliveryservice/stat.go
@@ -138,11 +138,15 @@ func addLastStat(lastData dsdata.LastStatData, newStat int64, newStatTime time.T
}
if newStat < lastData.Stat {
- return lastData, fmt.Errorf("new stat '%d'@'%v' value less than last stat '%d'@'%v'", lastData.Stat, lastData.Time, newStat, newStatTime)
+ // if a new stat comes in lower than current, assume rollover, set the 'last stat' to the new one, but leave PerSec what it was (not negative).
+ lastData.Stat = newStat
+ lastData.Time = newStatTime
+ err := fmt.Errorf("new stat '%d'@'%v' value less than last stat '%d'@'%v'", newStat, newStatTime, lastData.Stat, lastData.Time)
+ return lastData, err
}
if newStatTime.Before(lastData.Time) {
- return lastData, fmt.Errorf("new stat '%d'@'%v' time less than last stat '%d'@'%v'", lastData.Stat, lastData.Time, newStat, newStatTime)
+ return lastData, fmt.Errorf("new stat '%d'@'%v' time less than last stat '%d'@'%v'", newStat, newStatTime, lastData.Stat, lastData.Time)
}
if lastData.Stat != 0 {
@@ -215,7 +219,7 @@ func addDSPerSecStats(dsName enum.DeliveryServiceName, stat dsdata.Stat, lastSta
if _, ok := precomputed[cacheName]; ok {
lastStat.Caches[cacheName], err = addLastStats(lastStat.Caches[cacheName], cacheStats, precomputed[cacheName].Time)
if err != nil {
- log.Warnf("%v adding kbps for cache %v: %v", dsName, cacheName, err)
+ log.Warnf("%v adding per-second stats for cache %v: %v", dsName, cacheName, err)
continue
}
}