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

SQLite3 Instrumentation #719

Merged
merged 4 commits into from
May 21, 2020

Conversation

cnnradams
Copy link
Member

@cnnradams cnnradams commented May 21, 2020

Adds instrumentation for python sqlite3 library.

There is a lot of repeat code in the SQLite3Instrumentor (shared with every other DBAPI instrumentor), it could possibly be pulled out into a DBAPIInstrumentor that can be subclassed in this PR or another.

Resolves #683

@cnnradams cnnradams requested a review from a team May 21, 2020 13:50
@cnnradams cnnradams force-pushed the sqlite3-instrumentation branch 2 times, most recently from 11e94e5 to c906159 Compare May 21, 2020 14:28
@cnnradams cnnradams force-pushed the sqlite3-instrumentation branch from c906159 to ece7b41 Compare May 21, 2020 15:02
Copy link
Member

@c24t c24t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!


cnx = sqlite3.connect('example.db')
cursor = cnx.cursor()
cursor.execute("INSERT INTO test (testField) VALUES (123)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing ")"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

tox.ini Outdated
@@ -192,6 +197,7 @@ commands_pre =
flask,django: pip install {toxinidir}/opentelemetry-auto-instrumentation
flask: pip install {toxinidir}/ext/opentelemetry-ext-flask[test]

dbapi: pip install {toxinidir}/opentelemetry-auto-instrumentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the auto-instrumentation module for this test suite?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not anymore; removed

Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some non-blocking comments

Copy link
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it would be nice to add docker tests for this integration, maybe creating an issue for it so we don't forget.

@toumorokoshi
Copy link
Member

There is a lot of repeat code in the SQLite3Instrumentor (shared with every other DBAPI instrumentor), it could possibly be pulled out into a DBAPIInstrumentor that can be subclassed in this PR or another.

@cnnradams if that's the case, can you file a ticket and pick this up as a followup PR? Would love to pay down this debt as we go along.

Regarding where to put this code, I'm open to either a more specific shared package (e.g. opentelemetry-instrumentation-dbapi), or a mega-shared package for all shared utils across all instrumentations.

@codeboten @c24t for their thoughts. In the meantime I'll merge this PR. Thanks!

@toumorokoshi toumorokoshi merged commit 58b7bcc into open-telemetry:master May 21, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add instrumentation for sqlite3
5 participants