MySQL Instrumentation

Installation

Don't forget to install the AppSignal for Python package in your application first.

The installation instructions differ based on the MySQL adapter package you are using:

When using SQLAlchemy, do not install these instrumentation packages. The instrumentation for SQLAlchemy will automatically instrument queries to the underlying database. Installing both instrumentation packages will result in duplicate events.

Using mysql

AppSignal for PythonThis feature requires version 1.3.2 or higher.
mysql-connector-pythonThis feature requires version 8.0.0 or higher.

When using the mysql-connector-python MySQL adapter package (which is imported as mysql), install the opentelemetry-instrumentation-mysql package. To add it to your project, add the following line to your requirements.txt file:

shell
# requirements.txt opentelemetry-instrumentation-mysql

Using mysqlclient

AppSignal for PythonThis feature requires version 1.3.2 or higher.

When using the mysqlclient MySQL adapter package, install the opentelemetry-instrumentation-mysqlclient package. To add it to your project, add the following line to your requirements.txt file:

shell
# requirements.txt opentelemetry-instrumentation-mysqlclient

Using pymysql

AppSignal for PythonThis feature requires version 1.3.2 or higher.

When using the pymysql MySQL adapter package, install the opentelemetry-instrumentation-pymysql package. To add it to your project, add the following line to your requirements.txt file:

shell
# requirements.txt opentelemetry-instrumentation-pymysql

The AppSignal for Python integration will automatically use this instrumentation when the corresponding package is installed. To disable this instrumentation without uninstalling the package, use the disable_default_instrumentations configuration option.