open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
695 stars 575 forks source link

Please add support for mysqlclient connector #1649

Closed bigon closed 1 year ago

bigon commented 1 year ago

Hello,

ATM it seems that the mysql instrumentation only support pymysql and mysql-connector-python, but for what I can see SQLAlchemy uses, by default mysqldb (aka mysqlclient)

Shouldn't mysqlclient be added so instrumentation works OOTB?

Note that SQLAlchemy explicitly says that mysql-connector-python is not supported:

    The MySQL Connector/Python DBAPI has had many issues since its release,
    some of which may remain unresolved, and the mysqlconnector dialect is
    **not tested as part of SQLAlchemy's continuous integration**.
    The recommended MySQL dialects are mysqlclient and PyMySQL.
rahuldimri commented 1 year ago

We want to try on this. Could you please assign this task to me. Thanks

Fenkiou commented 1 year ago

Hello, I've created a PR to address that issue because I need this at work.

But I realized that I could just use the dbapi instrumentation like this

trace_integration(MySQLdb, "connect", "mysql")

So I am wondering, why do we need dedicated instrumentation librairies if the dbapi one is able to handle those that complies with PEP-0249?