From 35319c3380d806ba33193218c87bcb0700b0b089 Mon Sep 17 00:00:00 2001 From: robk-tahoe Date: Wed, 9 Apr 2008 18:23:06 -0700 Subject: [PATCH] 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. --- src/allmydata/storage.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.45.2