Skip to content

Commit

Permalink
test_sqlite3.py
Browse files Browse the repository at this point in the history
Added test case for test_no_op_tracer_provider
  • Loading branch information
Sunilwali679 committed Jun 18, 2024
1 parent b94c590 commit 260ee1d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,15 @@ def test_callproc(self):
):
self._cursor.callproc("test", ())
self.validate_spans("test")

def test_no_op_tracer_provider(self):
"""Should not create any spans when using NoOpTracerProvider"""
SQLite3Instrumentor().uninstrument()
SQLite3Instrumentor().instrument(tracer_provider=trace_api.NoOpTracerProvider())
self._create_tables()
stmt = "INSERT INTO test (id) VALUES (?)"
data = [("1",), ("2",), ("3",)]
with self._tracer.start_as_current_span("rootSpan"):
self._cursor.executemany(stmt, data)
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)

0 comments on commit 260ee1d

Please sign in to comment.