示例#1
0
    def test_checksd_aggregation_perf(self):
        ma = MetricsAggregator('my.host')

        for _ in range(self.FLUSH_COUNT):
            for i in range(self.LOOPS_PER_FLUSH):
                # Counters
                for j in range(self.METRIC_COUNT):
                    ma.increment('counter.%s' % j, i)
                    ma.gauge('gauge.%s' % j, i)
                    ma.histogram('histogram.%s' % j, i)
                    ma.set('set.%s' % j, float(i))
            ma.flush()
class TestAggregator(unittest.TestCase):

    def setUp(self):
        self.aggr = MetricsAggregator('test-aggr')

    def test_dupe_tags(self):
        self.aggr.increment('test-counter', 1, dimensions={'a': 'avalue', 'b': 'bvalue'})
        self.aggr.increment(
            'test-counter', 1, dimensions={'a': 'avalue', 'b': 'bvalue', 'b': 'bvalue'})
        self.assertEqual(len(self.aggr.metrics), 1, self.aggr.metrics)
        metric = self.aggr.metrics.values()[0]
        self.assertEqual(metric.value, 2)
    def test_checksd_aggregation_perf(self):
        ma = MetricsAggregator('my.host')

        for _ in range(self.FLUSH_COUNT):
            for i in range(self.LOOPS_PER_FLUSH):
                # Counters
                for j in range(self.METRIC_COUNT):
                    ma.increment('counter.%s' % j, i)
                    ma.gauge('gauge.%s' % j, i)
                    ma.histogram('histogram.%s' % j, i)
                    ma.set('set.%s' % j, float(i))
            ma.flush()
示例#4
0
class TestAggregator(unittest.TestCase):
    def setUp(self):
        self.aggr = MetricsAggregator('test-aggr')

    def test_dupe_tags(self):
        self.aggr.increment('test-counter',
                            1,
                            dimensions={
                                'a': 'avalue',
                                'b': 'bvalue'
                            })
        self.aggr.increment('test-counter',
                            1,
                            dimensions={
                                'a': 'avalue',
                                'b': 'bvalue',
                                'b': 'bvalue'
                            })
        self.assertEqual(len(self.aggr.metrics), 1, self.aggr.metrics)
        metric = list(self.aggr.metrics.values())[0]
        self.assertEqual(metric.value, 2)