def test_metric_getter(self):
     mr = BaseMetricsReporter()
     mr.start()
     # increment a counter
     mr.registry[0].counter('test').inc()
     timestamp, metrics = mr.get_metrics()
     self.assertIsInstance(timestamp, integer_types)
     self.assertIsInstance(metrics, dict)
     self.assertEqual(len(metrics), 1)
     self.assertIn('test', metrics)
     self.assertIsInstance(metrics['test'], dict)
     self.assertEqual(metrics['test']['count'], 1)
     mr.stop()
Beispiel #2
0
    def test_metric_getter(self):
        mm = MetricManager()
        mr = BaseMetricsReporter()
        mm.setup_reporters(mr)
        mm.start()
        # increment counters
        for counter in mm.counters('test'):
            counter.inc()

        timestamp, metrics = mr.get_metrics()
        self.assertIsInstance(timestamp, integer_types)
        self.assertIsInstance(metrics, dict)
        self.assertEqual(len(metrics), 1)
        self.assertIn('test', metrics)
        self.assertIsInstance(metrics['test'], dict)
        self.assertEqual(metrics['test']['count'], 1)
        mm.stop()