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

Extending SQLCommenter support of dbapi into psycopg2 #940

Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d6c6a15
Added configuration for sqlcommenter
Thiyagu55 Feb 21, 2022
305d893
Merge branch 'open-telemetry:main' into sqlcommenter-psycopg2-integra…
Thiyagu55 Mar 2, 2022
b902658
Fixed linting errors
Thiyagu55 Mar 2, 2022
cf72cb4
Merge remote-tracking branch 'origin/sqlcommenter-psycopg2-integratio…
Thiyagu55 Mar 2, 2022
e878f0a
Updated CHANGELOG.md
Thiyagu55 Mar 2, 2022
e80e9f9
Merge branch 'main' into sqlcommenter-psycopg2-integration-v2
srikanthccv Mar 4, 2022
bd8f208
Unit test case for sqlcommenter in psycopg2
Thiyagu55 Mar 11, 2022
da3378e
Merge conflict resolved
Thiyagu55 Mar 11, 2022
145e1bf
Merge conflict resolved
Thiyagu55 Mar 11, 2022
3e481d2
Update CHANGELOG.md
Thiyagu55 Mar 11, 2022
b27ec20
psycopg2 sqlcommenter integration test
Thiyagu55 Mar 14, 2022
f0bbeb7
Merge remote-tracking branch 'origin/sqlcommenter-psycopg2-integratio…
Thiyagu55 Mar 14, 2022
47d8180
linting changes
Thiyagu55 Mar 14, 2022
bc6c746
linting changes
Thiyagu55 Mar 14, 2022
e49fcd4
Merge branch 'open-telemetry:main' into sqlcommenter-psycopg2-integra…
Thiyagu55 Mar 14, 2022
7c86ec6
linting changes
Thiyagu55 Mar 14, 2022
db81dce
Merge remote-tracking branch 'origin/sqlcommenter-psycopg2-integratio…
Thiyagu55 Mar 14, 2022
fa62d9d
linting changes
Thiyagu55 Mar 14, 2022
28e332e
linting changes
Thiyagu55 Mar 14, 2022
0a0ea3f
Merge branch 'main' into sqlcommenter-psycopg2-integration-v2
lzchen Mar 14, 2022
36737e4
Resolving merge conflicts
Thiyagu55 Mar 16, 2022
abb1b15
version compatability issue fix
Thiyagu55 Mar 17, 2022
6912bf9
Merge branch 'main' into sqlcommenter-psycopg2-integration-v2
srikanthccv Mar 17, 2022
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
Prev Previous commit
Next Next commit
Unit test case for sqlcommenter in psycopg2
Thiyagu55 committed Mar 11, 2022
commit bd8f208133b53e74823a8e9565c4f6164de9435f
Original file line number Diff line number Diff line change
@@ -224,3 +224,23 @@ def test_uninstrument_connection_with_instrument_connection(self):

spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 1)

@mock.patch('opentelemetry.instrumentation.dbapi.wrap_connect')
def test_sqlcommenter_enabled(self, event_mocked):
cnx = psycopg2.connect(database="test")
Psycopg2Instrumentor().instrument(enable_commenter=True)
query = "SELECT * FROM test"
cursor = cnx.cursor()
cursor.execute(query)
args, kwargs = event_mocked.call_args
self.assertEqual(kwargs['enable_commenter'], True)

@mock.patch('opentelemetry.instrumentation.dbapi.wrap_connect')
def test_sqlcommenter_disabled(self, event_mocked):
cnx = psycopg2.connect(database="test")
Psycopg2Instrumentor().instrument()
query = "SELECT * FROM test"
cursor = cnx.cursor()
cursor.execute(query)
args, kwargs = event_mocked.call_args
self.assertEqual(kwargs['enable_commenter'], False)