Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 def process(self, tup):
     word = tup.values[0]
     self._increment(word, 1)
     global_metrics.safe_incr('count')
     self.ack(tup)
Ejemplo n.º 3
0
 def incr_worker():
     global_metrics.safe_incr("K")
     global_metrics.safe_incr("K", 2)
     global_metrics.safe_incr("K", 3)