Skip to content

Commit f288ed6

Browse files
committed
Address doc comments
1 parent 9d81680 commit f288ed6

File tree

5 files changed

+7
-11
lines changed
  • instrumentation
    • opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql
    • opentelemetry-instrumentation-mysqlclient/src/opentelemetry/instrumentation/mysqlclient
    • opentelemetry-instrumentation-psycopg/src/opentelemetry/instrumentation/psycopg
    • opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2
    • opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3

5 files changed

+7
-11
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def instrument_connection(self, connection, tracer_provider=None):
109109
configured tracer provider will be automatically used.
110110
111111
Returns:
112-
An instrumented MySQL connection with OpenTelemetry tracing enabled,
112+
An instrumented MySQL connection with OpenTelemetry tracing enabled.
113113
"""
114114
return dbapi.instrument_connection(
115115
__name__,

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
6464
# Alternatively, use instrument_connection for an individual connection
6565
cnx = MySQLdb.connect(database="MySQL_Database")
66-
instrumented_cnx = MySQLClientInstrumentor.instrument_connection(
66+
instrumented_cnx = MySQLClientInstrumentor().instrument_connection(
6767
cnx,
6868
enable_commenter=True,
6969
commenter_options={
@@ -195,8 +195,8 @@ def instrument_connection(
195195
SQL queries will be enriched with contextual information (e.g., database client details).
196196
Default is `None`.
197197
commenter_options:
198-
A dictionary of configuration options for SQLCommenter. This allows you to customize
199-
metadata appended to queries. Possible options include:
198+
A dictionary of configuration options for SQLCommenter. All options are enabled (True) by default.
199+
This allows you to customize metadata appended to queries. Possible options include:
200200
201201
- `db_driver`: Adds the database driver name and version.
202202
- `dbapi_threadsafety`: Adds threadsafety information.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
106106
# Alternatively, use instrument_connection for an individual connection
107107
cnx = psycopg.connect(database='Database')
108-
instrumented_cnx = instrument_connection(cnx)
108+
instrumented_cnx = PsycopgInstrumentor().instrument_connection(cnx)
109109
cursor = instrumented_cnx.cursor()
110110
cursor.execute("INSERT INTO test (testField) VALUES (123)")
111111
cursor.close()

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
106106
# Alternatively, use instrument_connection for an individual connection
107107
cnx = psycopg2.connect(database='Database')
108-
instrumented_cnx = Psycopg2Instrumentor.instrument_connection(cnx)
108+
instrumented_cnx = Psycopg2Instrumentor().instrument_connection(cnx)
109109
cursor = instrumented_cnx.cursor()
110110
cursor.execute("INSERT INTO test (testField) VALUES (123)")
111111
cursor.close()

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
4545
# Alternatively, use instrument_connection for an individual connection
4646
conn = sqlite3.connect(":memory:")
47-
instrumented_connection = SQLite3Instrumentor.instrument_connection(conn)
47+
instrumented_connection = SQLite3Instrumentor().instrument_connection(conn)
4848
cursor = instrumented_connection.cursor()
4949
cursor.execute("CREATE TABLE test (testField INTEGER)")
5050
cursor.execute("INSERT INTO test (testField) VALUES (123)")
@@ -122,10 +122,6 @@ def instrument_connection(
122122
An instrumented SQLite connection that supports
123123
telemetry for tracing database operations.
124124
125-
Notes:
126-
- Instrumentation must be explicitly applied to the connection object
127-
for tracing to work. This is not done automatically by simply calling
128-
`SQLite3Instrumentor().instrument()`.
129125
"""
130126
return dbapi.instrument_connection(
131127
__name__,

0 commit comments

Comments
 (0)