opentelemetry-instrumentation-mysqlclient
OpenTelemetry mysqlclient instrumentation
What it is and what it does
This package integrates OpenTelemetry tracing into mysqlclient, the pure-Python MySQL client library. When installed and initialized, it automatically wraps database connections to emit span data for each SQL query executed, including timing, query text, and connection details. This allows you to see database activity in your distributed tracing system without modifying application code that uses mysqlclient.
The instrumentation builds on OpenTelemetry's dbapi instrumentation layer, which provides a standardized approach to database tracing. It requires Python 3.10 or later and depends on opentelemetry-api, opentelemetry-instrumentation, and opentelemetry-instrumentation-dbapi. The package is in beta status (0.65b0) but actively maintained, with recent releases and no known security vulnerabilities.
Use it for:
- Trace database queries in a distributed system to identify slow or problematic SQL execution
- Monitor MySQL connection pool usage and query latency across microservices
- Correlate database activity with application logs and metrics in a centralized observability platform
- Debug performance issues by seeing which queries run during a specific request or transaction
- Collect database metrics for SLO monitoring and alerting on query performance
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds OpenTelemetry tracing instrumentation to mysqlclient database connections, automatically capturing SQL queries and performance metrics.
Yes, if you are already using OpenTelemetry in your application and need visibility into mysqlclient database calls. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a straightforward addition to an observability stack. Not necessary if you don't use OpenTelemetry or don't need database-level tracing.
Install
opentelemetry-instrumentation-mysqlclient on PyPI
pip
pip install opentelemetry-instrumentation-mysqlclientuv
uv add opentelemetry-instrumentation-mysqlclientpoetry
poetry add opentelemetry-instrumentation-mysqlclientInstalling opentelemetry-instrumentation-mysqlclient
Before you install
Low install friction with a pure-Python wheel. Actively maintained as of 2026-08-14 with recent releases. Depends on three OpenTelemetry core packages (opentelemetry-api, opentelemetry-instrumentation, opentelemetry-instrumentation-dbapi), all part of the same ecosystem.
License in practice
Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restriction.
Quickstart
pip install opentelemetry-instrumentation-mysqlclient
from opentelemetry.instrumentation.mysqlclient import MySQLClientInstrumentor
MySQLClientInstrumentor().instrument()
Requires Python 3.10 or later. Requires an active OpenTelemetry SDK and exporter configured in your application to actually export traces.
Verify before relying
- Whether this instrumentation works with all mysqlclient versions or has specific version constraints
- Performance overhead of instrumentation in production workloads
- Whether automatic instrumentation captures query parameters or only query structure
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — opentelemetry-api, opentelemetry-instrumentation-dbapi, opentelemetry-instrumentation |
| Maintenance | actively maintained — 29 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,656,719/month — #2,538 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_instrumentation_mysqlclient-0.65b0-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-dbapiAdds automatic tracing and observability…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-mysqlAdds distributed tracing to MySQL database…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-pymysqlAdds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-sqlite3Adds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-pymssqlAdds automatic tracing and monitoring of…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-tortoiseormAdds distributed tracing to Tortoise ORM…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-psycopgAdds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-psycopg2Adds distributed tracing instrumentation to…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-sqlalchemyAdds distributed tracing to SQLAlchemy database…
permissive · top 1,000 on PyPI
myclimycli is a command-line client for MySQL and…
permissive · top 15,000 on PyPI