Ejemplo n.º 1
0
    def test_flush_with_append(self):
        output = StringIO()
        dest = Stream(output)
        dest.append = "+++"

        metrics = [('users', 800, 5678), ('cpu', 99, 1234)]
        dest.flush(metrics)
        self.assertEqual("users 800 5678+++cpu 99 1234+++", output.getvalue())
Ejemplo n.º 2
0
    def test_flush_with_append(self):
        output = StringIO()
        dest = Stream(output)
        dest.append = "+++"

        metrics = [('users', 800, 5678), ('cpu', 99, 1234)]
        dest.flush(metrics)
        self.assertEqual("users 800 5678+++cpu 99 1234+++", output.getvalue())
Ejemplo n.º 3
0
    def test_flush_with_partial_pattern_and_append(self):
        output = StringIO()
        dest = Stream(output)
        dest.pattern = "({name}:'{value}'"
        dest.append = ")"

        metrics = [('users', 800, 5678), ('cpu', 99, 1234)]
        dest.flush(metrics)
        self.assertEqual("(users:'800')(cpu:'99')", output.getvalue())
Ejemplo n.º 4
0
    def test_flush_with_partial_pattern_and_append(self):
        output = StringIO()
        dest = Stream(output)
        dest.pattern = "({name}:'{value}'"
        dest.append = ")"

        metrics = [('users', 800, 5678), ('cpu', 99, 1234)]
        dest.flush(metrics)
        self.assertEqual("(users:'800')(cpu:'99')", output.getvalue())