From 1857aeed9352c4794d235207365b4a95d682a125 Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Mon, 24 Dec 2012 01:33:58 +0800 Subject: [PATCH] examples: python: added sets support --- examples/python_example.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/python_example.py b/examples/python_example.py index 259182a..d6835c1 100644 --- a/examples/python_example.py +++ b/examples/python_example.py @@ -25,7 +25,6 @@ class StatsdClient(object): >>> client = StatsdClient() >>> client.timing('example.timing', 500) >>> client.timing(('example.timing23', 'example.timing29'), 500) - """ stats = self.format(stats, time, self.SC_TIMING) self.send(stats, self.addr) @@ -41,6 +40,17 @@ class StatsdClient(object): stats = self.format(stats, value, self.SC_GAUGE) self.send(stats, self.addr) + def set(self, stats, value): + """ + Log set + + >>> client = StatsdClient() + >>> client.set('example.set', "set") + >>> client.set(('example.set61', 'example.set67'), "2701") + """ + stats = self.format(stats, value, self.SC_SET) + self.send(stats, self.addr) + def increment(self, stats, sample_rate=1): """ Increments one or more stats counters