commit | d7e2b45d0c23ef4afcc611f8ca665fe2cb0279f6 | [log] [tgz] |
---|---|---|
author | Sapan Bhatia <sapanb@cs.princeton.edu> | Sat Jan 10 04:55:54 2015 +0000 |
committer | Sapan Bhatia <sapanb@cs.princeton.edu> | Sat Jan 10 04:55:54 2015 +0000 |
tree | bb9147ff77e32e47fc22e6474824147f63b0a1a5 | |
parent | 3bc8ba45cdc8749dc84ea78c6c553eacc79a86a3 [diff] |
Set average to zero when no statistics are returned
diff --git a/planetstack/openstack_observer/ceilometer.py b/planetstack/openstack_observer/ceilometer.py index 6875ae8..00c1238 100644 --- a/planetstack/openstack_observer/ceilometer.py +++ b/planetstack/openstack_observer/ceilometer.py
@@ -77,7 +77,10 @@ stats['average']+=m.sum stats['unit'] = 'ns' - stats['average']/=len(meters) + if (len(meters)): + stats['average']/=len(meters) + else: + stats['average']=0 return stats