--- id: opentelemetry-instrumentation-pymysql version: "0.65b0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # opentelemetry-instrumentation-pymysql — OpenTelemetry PyMySQL instrumentation License: permissive · Maintenance: active · Downloads: 4.0M/mo ## What it is and what it does This package is an OpenTelemetry instrumentation plugin that automatically captures tracing data from PyMySQL database connections. When installed and initialized, it hooks into PyMySQL's query execution layer to emit spans for each SQL operation, including query text, execution time, and result metadata. This allows distributed tracing systems to correlate database calls with upstream application requests and other service calls. The package is part of the OpenTelemetry Python contrib ecosystem and follows the standard instrumentation pattern: it depends on opentelemetry-api for the tracing API, opentelemetry-instrumentation for the base instrumentation framework, and opentelemetry-instrumentation-dbapi for database-specific span generation. It is actively maintained and supports Python 3.10 through 3.14. Use it for: - Add database query tracing to a web service to correlate slow SQL with upstream request latency in a distributed system. - Monitor PyMySQL connection pool behavior and query patterns across microservices using a centralized tracing backend. - Debug application performance by examining query execution spans alongside application logs and metrics in an observability platform. - Instrument legacy applications using PyMySQL to gain visibility into database operations without modifying application code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds OpenTelemetry tracing instrumentation to PyMySQL database connections, automatically capturing SQL queries and their execution metrics. Yes, if you are already using OpenTelemetry in your observability stack and need to trace PyMySQL queries. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a straightforward addition. The beta status (0.65b0) is worth noting—verify stability expectations for your use case before production deployment, but the recent release cadence and 1086 GitHub stars suggest it is reasonably mature. ## Install pip install opentelemetry-instrumentation-pymysql uv add opentelemetry-instrumentation-pymysql poetry add opentelemetry-instrumentation-pymysql ## Installing opentelemetry-instrumentation-pymysql Before you install: Low friction installation with a pure-Python wheel. Actively maintained as of 2026-08-14 with recent releases. Depends on three core OpenTelemetry packages (opentelemetry-api, opentelemetry-instrumentation, opentelemetry-instrumentation-dbapi) that are widely used in observability stacks. License in practice: Apache-2.0 permissive license allows use in commercial and proprietary projects without restriction, though derivative works must retain attribution. Quickstart: pip install opentelemetry-instrumentation-pymysql from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor PyMySQLInstrumentor().instrument() Requires Python 3.10 or later; PyMySQL must be installed separately for instrumentation to attach to actual database connections. Verify before relying: - Whether instrumentation works with PyMySQL versions prior to a specific release or has known compatibility gaps. - Whether the 0.65b0 beta version is production-ready or if stability issues are documented. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 4.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags opentelemetry pymysql tracing, database query instrumentation, pymysql observability, sql query tracing, mysql connection monitoring, opentelemetry dbapi instrumentation, distributed tracing mysql, observability, tracing, database-instrumentation [View on SkillFed](https://skillfed.io/packages/opentelemetry-instrumentation-pymysql) · [View on PyPI](https://pypi.org/project/opentelemetry-instrumentation-pymysql/)