Skip to content

Commit 2519223

Browse files
Akochavishalevrsrikanthccv
authored
Audit and test opentelemetry-instrumentation-aiopg NoOpTracerProvider (#1606)
* Audit and test opentelemetry-instrumentation-aiopg NoOpTracerProvider * Change line length --------- Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]>
1 parent a217682 commit 2519223

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py

+13
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,19 @@ def test_instrument_connection_after_instrument(self):
222222
spans_list = self.memory_exporter.get_finished_spans()
223223
self.assertEqual(len(spans_list), 1)
224224

225+
def test_no_op_tracer_provider(self):
226+
cnx = async_call(aiopg.connect(database="test"))
227+
AiopgInstrumentor().instrument_connection(
228+
cnx, tracer_provider=trace_api.NoOpTracerProvider()
229+
)
230+
231+
cursor = async_call(cnx.cursor())
232+
query = "SELECT * FROM test"
233+
async_call(cursor.execute(query))
234+
235+
spans_list = self.memory_exporter.get_finished_spans()
236+
self.assertEqual(len(spans_list), 0)
237+
225238
def test_custom_tracer_provider_instrument_connection(self):
226239
resource = resources.Resource.create(
227240
{"service.name": "db-test-service"}

0 commit comments

Comments
 (0)