Exemplo n.º 1
0
 def test_stress_logs(self):
     recorder = self.create_test_recorder()
     for i in range(1000):
         recorder.record_span(self.dummy_basic_span(recorder, i))
     self.assertTrue(recorder.flush(self.mock_connection))
     self.assertEqual(
         len(
             RecorderTest.decode_span_array(
                 self.mock_connection.reports[0].data)), 1000)
     self.check_spans(self.mock_connection.reports)
Exemplo n.º 2
0
    def test_send_spans_after_shutdown(self):
        recorder = self.create_test_recorder()

        # Send 10 spans
        for i in range(10):
            recorder.record_span(self.dummy_basic_span(recorder, i))
        self.assertTrue(recorder.flush(self.mock_connection))

        # Check 10 spans
        self.check_spans(self.mock_connection.reports)

        # Delete current logs and shutdown runtime
        self.mock_connection.clear()
        recorder.shutdown()

        # Send 10 spans, though none should get through
        for i in range(10):
            recorder.record_span(self.dummy_basic_span(recorder, i))
        self.assertFalse(recorder.flush(self.mock_connection))
        self.assertEqual(len(self.mock_connection.reports), 0)
Exemplo n.º 3
0
    def test_buffer_limits(self):
        self.runtime_args.update({
            'max_span_records': 88,
        })
        recorder = self.create_test_recorder()

        self.assertEqual(len(recorder._span_records), 0)
        for i in range(0, 10000):
            recorder.record_span(self.dummy_basic_span(recorder, i))
        self.assertEqual(len(recorder._span_records), 88)
        self.assertTrue(recorder.flush(self.mock_connection))