Ejemplo n.º 1
0
    def test_incr_with_tags(self):
        mock_time.return_value = float(1234)
        dd = DataDogMetrics('test')

        expected = 'MONITORING|1234|1|count|test.test_metric|#tag1,tag2'
        for tags in (['tag1', 'tag2'], ('tag1', 'tag2')):
            actual = dd.incr('test_metric', tags=tags)
            self.assertEqual(expected, actual)

        expected_alt_order = 'MONITORING|1234|1|count|test.test_metric|#tag2,tag1'
        for tags in ({'tag1', 'tag2'}, frozenset({'tag1', 'tag2'})):
            actual = dd.incr('test_metric', tags=tags)
            self.assertLess({actual}, {expected, expected_alt_order})
        return
Ejemplo n.º 2
0
    def test_incr_with_count(self):
        mock_time.return_value = float(1234)
        dd = DataDogMetrics('test')
        actual = dd.incr('test_metric', 5)

        expected = 'MONITORING|1234|5|count|test.test_metric'
        self.assertEqual(expected, actual)
Ejemplo n.º 3
0
    def test_incr_with_stats_group(self):
        mock_time.return_value = float(1234)
        dd = DataDogMetrics('test', 'test_group')
        actual = dd.incr('test_metric')

        expected = 'MONITORING|1234|1|count|test.test_metric|#group:test_group'

        self.assertEqual(expected, actual)
    def test_incr_with_tags(self):
        mock_time.return_value = float(1234)
        dd = DataDogMetrics('test')
        actual = dd.incr('test_metric', tags=['tag1', 'tag2'])

        expected = 'MONITORING|1234|1|count|test.test_metric|#tag1,tag2'

        self.assertEqual(expected, actual)
Ejemplo n.º 5
0
    def test_incr_with_tag(self):
        mock_time.return_value = float(1234)
        dd = DataDogMetrics('test')

        expected = 'MONITORING|1234|1|count|test.test_metric|#tag'
        for tags in (['tag'], ('tag', ), {'tag'}, frozenset({'tag'})):
            actual = dd.incr('test_metric', tags=tags)
            self.assertEqual(expected, actual)

        return