Esempio n. 1
0
    def setUp(self):
        super(BaseUrllib3TestCase, self).setUp()

        patch()
        self.http = urllib3.PoolManager()
        Pin.override(urllib3.connectionpool.HTTPConnectionPool,
                     tracer=self.tracer)
Esempio n. 2
0
    def test_double_patch(self):
        """Ensure that double patch doesn't duplicate instrumentation"""
        patch()
        connpool = urllib3.connectionpool.HTTPConnectionPool(SOCKET)
        setattr(connpool, "datadog_tracer", self.tracer)

        out = connpool.urlopen("GET", URL_200)
        assert out.status == 200
        spans = self.pop_spans()
        assert len(spans) == 1
Esempio n. 3
0
def patch_urllib3():
    patch()
    try:
        yield
    finally:
        unpatch()