OpenTelemetry PyMySQL Integration

The integration with PyMySQL supports the PyMySQL library and can be enabled by using PyMySQLInstrumentor.

Usage

import pymysql
from opentelemetry import trace
from opentelemetry.ext.pymysql import PyMySQLInstrumentor
from opentelemetry.sdk.trace import TracerProvider

trace.set_tracer_provider(TracerProvider())

PyMySQLInstrumentor().instrument()

cnx = pymysql.connect(database="MySQL_Database")
cursor = cnx.cursor()
cursor.execute("INSERT INTO test (testField) VALUES (123)"
cnx.commit()
cursor.close()
cnx.close()

API

class opentelemetry.ext.pymysql.PyMySQLInstrumentor[source]

Bases: opentelemetry.auto_instrumentation.instrumentor.BaseInstrumentor