From 690bc9a1c2cf588dc747f9684027bc139e571c68 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 17 Oct 2024 16:07:23 -0700 Subject: [PATCH] Update docstring --- .../src/opentelemetry/instrumentation/pymysql/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/__init__.py b/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/__init__.py index 459e0b1e87..698666dc9c 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/__init__.py @@ -26,7 +26,6 @@ import pymysql from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor - PyMySQLInstrumentor().instrument() cnx = pymysql.connect(database="MySQL_Database") @@ -41,6 +40,9 @@ You can optionally configure PyMySQL instrumentation to enable sqlcommenter which enriches the query with contextual information. +Usage +----- + .. code:: python import MySQLdb @@ -55,11 +57,14 @@ cursor.close() cnx.close() + For example, :: + Invoking cursor.execute("INSERT INTO test (testField) VALUES (123)") will lead to sql query "INSERT INTO test (testField) VALUES (123)" but when SQLCommenter is enabled the query will get appended with some configurable tags like "INSERT INTO test (testField) VALUES (123) /*tag=value*/;" + SQLCommenter Configurations *************************** We can configure the tags to be appended to the sqlquery log by adding configuration inside commenter_options(default:{}) keyword