From: robk-tahoe Date: Thu, 10 Apr 2008 01:23:06 +0000 (-0700) Subject: stats gathering: fix storage server stats if not tracking consumed X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/%3C?a=commitdiff_plain;h=35319c3380d806ba33193218c87bcb0700b0b089;p=tahoe-lafs%2Ftahoe-lafs.git stats gathering: fix storage server stats if not tracking consumed the RIStatsProvider interface requires that counter and stat values be ChoiceOf(float, int, long) the recent changes to storage server to not track 'consumed' led to returning None as the value of a counter. this causes violations to be experienced by nodes whose stats are being gathered. this patch simply omits that stat if 'consumed' is not being tracked. --- diff --git a/src/allmydata/storage.py b/src/allmydata/storage.py index acbe1b72..60c643be 100644 --- a/src/allmydata/storage.py +++ b/src/allmydata/storage.py @@ -728,9 +728,10 @@ class StorageServer(service.MultiService, Referenceable): fileutil.rm_dir(self.incomingdir) def get_stats(self): - return { 'storage_server.consumed': self.consumed, - 'storage_server.allocated': self.allocated_size(), - } + stats = { 'storage_server.allocated': self.allocated_size(), } + if self.consumed is not None: + stats['storage_server.consumed'] = self.consumed + return stats def allocated_size(self): space = self.consumed or 0