Author: justi9
Date: 2009-01-15 15:38:16 -0500 (Thu, 15 Jan 2009)
New Revision: 3046
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Fetch another sample past the end of the period so there's no left-hand gap in charts
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-01-15 15:57:43 UTC (rev 3045)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-01-15 20:38:16 UTC (rev 3046)
@@ -339,18 +339,29 @@
def samples(self, object, secs):
stats = object.stats
+ now = datetime.now()
+
col = self.cumin_class.mint_stats_class.q.qmfUpdateTime
- dt = datetime.now() - timedelta(seconds=secs)
+ dt = now - timedelta(seconds=int(secs * 1.5))
stats = stats.filter(col >= dt)
stats = stats.orderBy("-qmfUpdateTime")
samples = list()
+ limit = now - timedelta(seconds=secs)
+ next_is_last = False
+
for stat in stats:
value = getattr(stat, self.name, 0)
samples.append((stat.qmfUpdateTime, value))
+ if next_is_last:
+ break
+
+ if stat.qmfUpdateTime < limit:
+ next_is_last = True
+
return samples
def value_html(self, object):