def test_get_all_counters(self): mm = MetricManager() mr = BaseMetricsReporter() mm.setup_reporters(mr) # test default implementation for counter in mm.counters(): self.assertIsNotNone(get_method_self(counter)) self.assertIsInstance(get_method_self(counter), MetricsRegistry) # test context aware for counter in mm.counters('test'): from pyformance.meters.counter import Counter self.assertIsInstance(counter, Counter)
def test_get_all_histograms(self): mm = MetricManager() mr = BaseMetricsReporter() mm.setup_reporters(mr) # test default implementation for hist in mm.histograms(): self.assertIsNotNone(get_method_self(hist)) self.assertIsInstance(get_method_self(hist), MetricsRegistry) # test context aware for hist in mm.histograms('test'): from pyformance.meters.histogram import Histogram self.assertIsInstance(hist, Histogram)