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

[mysql] distinguish mysql-python instrumentation #263

Merged
merged 1 commit into from
May 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions ddtrace/contrib/mysql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
"""
from ..util import require_modules

# check `MySQL-python` availability
required_modules = ['_mysql']

with require_modules(required_modules) as missing_modules:
if not missing_modules:
# MySQL python package is not supported at the moment;
# here we raise an import error so that the external
# loader knows that the integration is not available
raise ImportError('No module named mysql-python')
Copy link
Author

Choose a reason for hiding this comment

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

The error must be an ImportError because it's like if we're trying to import a module that is not here. However, the message may be different?


# check `mysql-connector` availability
required_modules = ['mysql.connector']

with require_modules(required_modules) as missing_modules:
Expand Down