Exemplo n.º 1
0
 def test_duplicated_instrumentation(self):
     AsyncPGInstrumentor().instrument()
     AsyncPGInstrumentor().instrument()
     AsyncPGInstrumentor().instrument()
     AsyncPGInstrumentor().uninstrument()
     for method_name in ["execute", "fetch"]:
         method = getattr(Connection, method_name, None)
         self.assertFalse(
             hasattr(method, "_opentelemetry_ext_asyncpg_applied"))
 def setUp(self):
     super().setUp()
     self._tracer = self.tracer_provider.get_tracer(__name__)
     AsyncPGInstrumentor().instrument(tracer_provider=self.tracer_provider)
     self._connection = async_call(
         asyncpg.connect(
             database=POSTGRES_DB_NAME,
             user=POSTGRES_USER,
             password=POSTGRES_PASSWORD,
             host=POSTGRES_HOST,
             port=POSTGRES_PORT,
         ))
 def setUpClass(cls):
     super().setUpClass()
     cls._connection = None
     cls._cursor = None
     cls._tracer = cls.tracer_provider.get_tracer(__name__)
     AsyncPGInstrumentor().instrument(tracer_provider=cls.tracer_provider)
     cls._connection = async_call(
         asyncpg.connect(
             database=POSTGRES_DB_NAME,
             user=POSTGRES_USER,
             password=POSTGRES_PASSWORD,
             host=POSTGRES_HOST,
             port=POSTGRES_PORT,
         ))
 def tearDownClass(cls):
     AsyncPGInstrumentor().uninstrument()
Exemplo n.º 5
0
 def test_instrumentation_flags(self):
     AsyncPGInstrumentor().instrument()
     self.assertTrue(hasattr(asyncpg, "_opentelemetry_tracer"))
     AsyncPGInstrumentor().uninstrument()
     self.assertFalse(hasattr(asyncpg, "_opentelemetry_tracer"))
 def tearDown(self):
     AsyncPGInstrumentor().uninstrument()
     super().tearDown()