コード例 #1
0
 def setUp(self):
     self.timer = TimerMetricReporter('test')
     self.timer.update(10)
     self.timer.update(20)
     self.timer.update(20)
     self.timer.update(30)
     self.timer.update(40)
コード例 #2
0
    def test_httpinfo_fake_plugin(self):
        """Also works for plugins."""

        tmr = TimerMetricReporter('gorets')
        data = yield self.get_results("metrics/gorets",
            timer_metrics={}, plugin_metrics={'gorets': tmr})
        hist = json.loads(data)
        self.assertTrue(isinstance(hist, dict))
コード例 #3
0
    def test_httpinfo_timer3(self):
        """Returns a valid histogram with data."""

        tmr = TimerMetricReporter('gorets')
        for i in range(1, 1001):
            tmr.histogram.update(i)
        data = yield self.get_results("metrics/gorets",
            timer_metrics={'gorets': tmr})
        hist = json.loads(data)
        self.assertTrue(isinstance(hist, dict))
        self.assertEquals(sum(hist["histogram"]), 1000)
コード例 #4
0
 def test_httpinfo_timer2(self):
     """Returns the canonical empty histogram without data."""
     tmr = TimerMetricReporter('gorets')
     data = yield self.get_results("metrics/gorets",
         timer_metrics={'gorets': tmr})
     self.assertEquals(json.loads(data)["histogram"], [0.] * 10)
コード例 #5
0
 def setUp(self):
     self.timer = TimerMetricReporter('test')