diff --git a/aggregator.py b/aggregator.py index 9bbbefd5aa..247652e60a 100644 --- a/aggregator.py +++ b/aggregator.py @@ -399,6 +399,8 @@ class Aggregator(object): """ # Types of metrics that allow strings ALLOW_STRINGS = ['s', ] + # Types that are not implemented and ignored + IGNORE_TYPES = ['d', ] def __init__(self, hostname, interval=1.0, expiry_seconds=300, formatter=None, recent_point_threshold=None, @@ -472,6 +474,8 @@ def parse_metric_packet(self, packet): if metric_type in self.ALLOW_STRINGS: value = raw_value + elif metric_type in self.IGNORE_TYPES: + continue else: # Try to cast as an int first to avoid precision issues, then as a # float. diff --git a/tests/core/test_aggregator.py b/tests/core/test_aggregator.py index b2d58d9808..8b95205b49 100644 --- a/tests/core/test_aggregator.py +++ b/tests/core/test_aggregator.py @@ -288,6 +288,18 @@ def test_string_sets(self): # Assert there are no more sets assert not stats.flush() + def test_ignore_distribution(self): + stats = MetricsAggregator('myhost') + stats.submit_packets('my.dist:5.0|d') + stats.submit_packets('my.gauge:1|g') + + # Assert that it's treated normally, and that the distribution is ignored + metrics = stats.flush() + nt.assert_equal(len(metrics), 1) + m = metrics[0] + nt.assert_equal(m['metric'], 'my.gauge') + nt.assert_equal(m['points'][0][1], 1) + @attr(requires='core_integration') def test_rate(self): stats = MetricsAggregator('myhost')