Example #1
0
 def test_remote_recorder_flush(self):
     recorder = RemoteRecorder(self.endpoint, 5)
     serialized_span = {
         "traceId": "test-id",
         "name": "test-span",
         "id": "span-id",
         "timestamp": 0,
         "duration": 0,
         "annotations": [],
         "binaryAnnotations": [],
     }
     func_mock = mock.Mock()
     with mock.patch.object(recorder.session, "post", func_mock):
         recorder.flush_func([serialized_span])
         func_mock.assert_called_with(
             recorder.endpoint,
             data=json.dumps([serialized_span]).encode("utf8"),
             headers={"Content-Type": "application/json"},
             timeout=1,
         )
Example #2
0
 def test_init(self):
     recorder = RemoteRecorder(self.endpoint, 5)
     self.assertEqual(recorder.endpoint, "http://test:1111/api/v1/spans")