You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-mysqlclient/src/opentelemetry/instrumentation/mysqlclient/__init__.py
+8-1
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@
46
46
import MySQLdb
47
47
from opentelemetry.instrumentation.mysqlclient import MySQLClientInstrumentor
48
48
49
-
49
+
# Call instrument() to wrap all database connections
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-psycopg/src/opentelemetry/instrumentation/psycopg/__init__.py
+8-1
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@
88
88
import psycopg
89
89
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
90
90
91
-
91
+
# Call instrument() to wrap all database connections
92
92
PsycopgInstrumentor().instrument()
93
93
94
94
cnx = psycopg.connect(database='Database')
@@ -98,6 +98,13 @@
98
98
cursor.close()
99
99
cnx.close()
100
100
101
+
.. code-block:: python
102
+
103
+
import psycopg
104
+
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
105
+
106
+
# Alternatively, use instrument_connection for an individual connection
107
+
cnx = psycopg.connect(database='Database')
101
108
instrumented_cnx = instrument_connection(cnx)
102
109
cursor = instrumented_cnx.cursor()
103
110
cursor.execute("INSERT INTO test (testField) VALUES (123)")
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py
+8-1
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@
88
88
import psycopg2
89
89
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
90
90
91
-
91
+
# Call instrument() to wrap all database connections
92
92
Psycopg2Instrumentor().instrument()
93
93
94
94
cnx = psycopg2.connect(database='Database')
@@ -98,6 +98,13 @@
98
98
cursor.close()
99
99
cnx.close()
100
100
101
+
.. code-block:: python
102
+
103
+
import psycopg2
104
+
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
105
+
106
+
# Alternatively, use instrument_connection for an individual connection
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/__init__.py
+23-14
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@
26
26
import pymysql
27
27
from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor
28
28
29
+
# Call instrument() to wrap all database connections
29
30
PyMySQLInstrumentor().instrument()
30
31
31
32
cnx = pymysql.connect(database="MySQL_Database")
@@ -35,6 +36,28 @@
35
36
cursor.close()
36
37
cnx.close()
37
38
39
+
40
+
.. code:: python
41
+
42
+
import pymysql
43
+
from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor
44
+
45
+
# Alternatively, use instrument_connection for an individual connection
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/__init__.py
+8-1
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@
27
27
import sqlite3
28
28
from opentelemetry.instrumentation.sqlite3 import SQLite3Instrumentor
29
29
30
-
30
+
# Call instrument() to wrap all database connections
31
31
SQLite3Instrumentor().instrument()
32
32
33
33
cnx = sqlite3.connect(':memory:')
@@ -36,6 +36,13 @@
36
36
cursor.execute("INSERT INTO test (testField) VALUES (123)")
37
37
cursor.close()
38
38
cnx.close()
39
+
40
+
.. code:: python
41
+
42
+
import sqlite3
43
+
from opentelemetry.instrumentation.sqlite3 import SQLite3Instrumentor
44
+
45
+
# Alternatively, use instrument_connection for an individual connection
0 commit comments