Don't explode if we have no snapshots yet

This commit is contained in:
Erik Johnston 2016-07-20 16:59:52 +01:00
parent 742056be0d
commit d36b1d849d

View file

@ -180,6 +180,9 @@ class MemoryUsageMetric(object):
self.memory_snapshots[:] = self.memory_snapshots[-max_size:] self.memory_snapshots[:] = self.memory_snapshots[-max_size:]
def render(self): def render(self):
if not self.memory_snapshots:
return []
max_rss = max(self.memory_snapshots) max_rss = max(self.memory_snapshots)
min_rss = min(self.memory_snapshots) min_rss = min(self.memory_snapshots)
sum_rss = sum(self.memory_snapshots) sum_rss = sum(self.memory_snapshots)