OpenTelemetry MySQL integration¶
The integration with MySQL supports the mysql-connector library and is specified
to trace_integration
using 'MySQL'
.
Usage¶
import mysql.connector
from opentelemetry.trace import tracer_provider
from opentelemetry.ext.mysql import trace_integration
trace_integration(tracer_provider())
cnx = mysql.connector.connect(database='MySQL_Database')
cursor = cnx.cursor()
cursor.execute("INSERT INTO test (testField) VALUES (123)"
cursor.close()
cnx.close()
References¶
Module contents¶
The opentelemetry-ext-mysql package allows tracing MySQL queries made by the MySQL Connector/Python library.
-
opentelemetry.ext.mysql.
trace_integration
(tracer)[source]¶ Integrate with MySQL Connector/Python library. https://dev.mysql.com/doc/connector-python/en/