def test_normal(self): global_metrics.incr("mycounter_a") global_metrics.incr("mycounter_b", 3) global_metrics.safe_incr("mycounter_c", 5) counter = global_metrics.metricsContainer d = counter.get_value_and_reset() self.assertTrue("mycounter_a" in d) self.assertTrue("mycounter_b" in d) self.assertTrue("mycounter_c" in d) self.assertEqual(d["mycounter_a"], 1) self.assertEqual(d["mycounter_b"], 3) self.assertEqual(d["mycounter_c"], 5)
def process(self, tup): word = tup.values[0] self._increment(word, 10 if word == "heron" else 1) global_metrics.safe_incr("count") self.ack(tup)
def process(self, tup): word = tup.values[0] self._increment(word, 10 if word == "heron" else 1) global_metrics.safe_incr('count')
def incr_worker(): global_metrics.safe_incr("K") global_metrics.safe_incr("K", 2) global_metrics.safe_incr("K", 3)