示例#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)
 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)
示例#3
0
 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)
示例#4
0
 def process(self, tup):
     word = tup.values[0]
     self._increment(word, 10 if word == "heron" else 1)
     global_metrics.safe_incr('count')
示例#5
0
 def incr_worker():
     global_metrics.safe_incr("K")
     global_metrics.safe_incr("K", 2)
     global_metrics.safe_incr("K", 3)
 def incr_worker():
   global_metrics.safe_incr("K")
   global_metrics.safe_incr("K", 2)
   global_metrics.safe_incr("K", 3)