skillfed

opentelemetry-instrumentation-mysqlclient

OpenTelemetry mysqlclient instrumentation

opentelemetry-instrumentation-mysqlclient v0.65b0 3.7M downloads/30d#2,538 on PyPI1,086
Permissive license Apache-2.0 Active released

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-mysqlclient

uv

uv add opentelemetry-instrumentation-mysqlclient

poetry

poetry add opentelemetry-instrumentation-mysqlclient

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

opentelemetry mysqlclient tracingmysql instrumentation observabilitydatabase query tracingmysql performance monitoringopentelemetry dbapi instrumentationsql query observabilitymysql connection tracing
observabilitydistributed-tracingdatabase-instrumentation

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation-dbapi

Adds automatic tracing and observability…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation-mysql

Adds distributed tracing to MySQL database…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-pymysql

Adds OpenTelemetry tracing instrumentation to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-sqlite3

Adds OpenTelemetry tracing instrumentation to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-pymssql

Adds automatic tracing and monitoring of…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-tortoiseorm

Adds distributed tracing to Tortoise ORM…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-psycopg

Adds OpenTelemetry tracing instrumentation to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-psycopg2

Adds distributed tracing instrumentation to…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation-sqlalchemy

Adds distributed tracing to SQLAlchemy database…

permissive · top 1,000 on PyPI

mycli

mycli is a command-line client for MySQL and…

permissive · top 15,000 on PyPI