From 001dadd0e75dead077086a4d4e1d08cd55c0190f Mon Sep 17 00:00:00 2001 From: Sean Reifschneider Date: Wed, 15 Dec 2010 20:02:51 -0700 Subject: Bug #633553: Add stat arguments support. --- memcache.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/memcache.py b/memcache.py index 2f066fc..f7bc013 100644 --- a/memcache.py +++ b/memcache.py @@ -198,9 +198,12 @@ class Client(local): self.servers = [_Host(s, self.debug) for s in servers] self._init_buckets() - def get_stats(self): + def get_stats(self, stat_args = None): '''Get statistics from each of the servers. + @param stat_args: Additional arguments to pass to the memcache + "stats" command. + @return: A list of tuples ( server_identifier, stats_dictionary ). The dictionary contains a number of name/value pairs specifying the name of the status field and the string value associated with @@ -213,7 +216,10 @@ class Client(local): name = '%s:%s (%s)' % ( s.ip, s.port, s.weight ) else: name = 'unix:%s (%s)' % ( s.address, s.weight ) - s.send_cmd('stats') + if not stat_args: + s.send_cmd('stats') + else: + s.send_cmd('stats ' + stat_args) serverData = {} data.append(( name, serverData )) readline = s.readline -- cgit v1.2.1