Skip to content

Commit 9d41f9b

Browse files
andremmxrmx
andauthored
Improve mysqlclient instrumentation examples (#3470)
Co-authored-by: Riccardo Magliocchetti <[email protected]>
1 parent 02dc87e commit 9d41f9b

File tree

1 file changed

+4
-4
lines changed
  • instrumentation/opentelemetry-instrumentation-mysqlclient/src/opentelemetry/instrumentation/mysqlclient

1 file changed

+4
-4
lines changed

instrumentation/opentelemetry-instrumentation-mysqlclient/src/opentelemetry/instrumentation/mysqlclient/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
import MySQLdb
2727
from opentelemetry.instrumentation.mysqlclient import MySQLClientInstrumentor
2828
29-
3029
MySQLClientInstrumentor().instrument()
3130
3231
cnx = MySQLdb.connect(database="MySQL_Database")
3332
cursor = cnx.cursor()
34-
cursor.execute("INSERT INTO test (testField) VALUES (123)"
33+
cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
34+
cursor.execute("INSERT INTO test (testField) VALUES (123)")
3535
cnx.commit()
3636
cursor.close()
3737
cnx.close()
@@ -52,7 +52,7 @@
5252
cnx = MySQLdb.connect(database="MySQL_Database")
5353
cursor = cnx.cursor()
5454
cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
55-
cursor.execute("INSERT INTO test (testField) VALUES (123)"
55+
cursor.execute("INSERT INTO test (testField) VALUES (123)")
5656
cnx.commit()
5757
cursor.close()
5858
cnx.close()
@@ -75,7 +75,7 @@
7575
)
7676
cursor = instrumented_cnx.cursor()
7777
cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
78-
cursor.execute("INSERT INTO test (testField) VALUES (123)"
78+
cursor.execute("INSERT INTO test (testField) VALUES (123)")
7979
instrumented_cnx.commit()
8080
cursor.close()
8181
instrumented_cnx.close()

0 commit comments

Comments
 (0)