Beispiel #1
0
 def test_no_tracing_without_sampling(self):
     client = make_client("test-service", sample_rate=0)
     baseplate_observer = TraceBaseplateObserver(client)
     context_mock = mock.Mock()
     span = ServerSpan("test-id", "test-parent-id", "test-span-id", False,
                       0, "test", self.mock_context)
     baseplate_observer.on_server_span_created(context_mock, span)
     self.assertEqual(len(span.observers), 0)
Beispiel #2
0
 def test_register_server_span_observer(self):
     client = make_client("test-service")
     baseplate_observer = TraceBaseplateObserver(client)
     context_mock = mock.Mock()
     span = ServerSpan("test-id", "test-parent-id", "test-span-id", True, 0,
                       "test", self.mock_context)
     baseplate_observer.on_server_span_created(context_mock, span)
     self.assertEqual(len(span.observers), 1)
     self.assertEqual(type(span.observers[0]), TraceServerSpanObserver)