Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit and test opentelemetry-instrumentation-dbapi NoOpTracerProvider #1607

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ def test_custom_tracer_provider_dbapi(self):
self.assertEqual(span.resource.attributes["db-resource-key"], "value")
self.assertIs(span.status.status_code, trace_api.StatusCode.ERROR)

def test_no_op_tracer_provider(self):
db_integration = dbapi.DatabaseApiIntegration(
self.tracer, "testcomponent",
tracer_provider=trace_api.NoOpTracerProvider()
)

mock_connection = db_integration.wrapped_connection(
mock_connect, {}, {}
)
cursor = mock_connection.cursor()
cursor.executemany("Test query")
spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 0)

def test_executemany(self):
db_integration = dbapi.DatabaseApiIntegration(
"testname", "testcomponent"
Expand Down