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
-`opentelemetry-instrumentation-psycopg2`, `opentelemetry-instrumentation-psycopg`, `opentelemetry-instrumentation-mysqlclient`, `opentelemetry-instrumentation-pymysql`: including sqlcomment in `db.statement` span attribute value is now opt-in
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-mysqlclient/src/opentelemetry/instrumentation/mysqlclient/__init__.py
+26
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,26 @@
126
126
::
127
127
Enabling this flag will add traceparent values /*traceparent='00-03afa25236b8cd948fa853d67038ac79-405ff022e8247c46-01'*/
128
128
129
+
SQLComment in span attribute
130
+
****************************
131
+
If sqlcommenter is enabled, you can optionally configure MySQLClient instrumentation to append sqlcomment to query span attribute for convenience of your platform.
132
+
133
+
.. code:: python
134
+
135
+
from opentelemetry.instrumentation.mysqlclient import MySQLClientInstrumentor
136
+
137
+
MySQLClientInstrumentor().instrument(
138
+
enable_commenter=True,
139
+
enable_attribute_commenter=True,
140
+
)
141
+
142
+
143
+
For example,
144
+
::
145
+
146
+
Invoking cursor.execute("select * from auth_users") will lead to sql query "select * from auth_users" but when SQLCommenter and attribute_commenter are enabled
147
+
the query will get appended with some configurable tags like "select * from auth_users /*tag=value*/;" for both server query and `db.statement` span attribute.
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-psycopg/src/opentelemetry/instrumentation/psycopg/__init__.py
+26
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,26 @@
80
80
::
81
81
Enabling this flag will add traceparent values /*traceparent='00-03afa25236b8cd948fa853d67038ac79-405ff022e8247c46-01'*/
82
82
83
+
SQLComment in span attribute
84
+
****************************
85
+
If sqlcommenter is enabled, you can optionally configure psycopg instrumentation to append sqlcomment to query span attribute for convenience of your platform.
86
+
87
+
.. code:: python
88
+
89
+
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
90
+
91
+
PsycopgInstrumentor().instrument(
92
+
enable_commenter=True,
93
+
enable_attribute_commenter=True,
94
+
)
95
+
96
+
97
+
For example,
98
+
::
99
+
100
+
Invoking cursor.execute("select * from auth_users") will lead to postgresql query "select * from auth_users" but when SQLCommenter and attribute_commenter are enabled
101
+
the query will get appended with some configurable tags like "select * from auth_users /*tag=value*/;" for both server query and `db.statement` span attribute.
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py
+24
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,26 @@
80
80
::
81
81
Enabling this flag will add traceparent values /*traceparent='00-03afa25236b8cd948fa853d67038ac79-405ff022e8247c46-01'*/
82
82
83
+
SQLComment in span attribute
84
+
****************************
85
+
If sqlcommenter is enabled, you can optionally configure psycopg2 instrumentation to append sqlcomment to query span attribute for convenience of your platform.
86
+
87
+
.. code:: python
88
+
89
+
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
90
+
91
+
Psycopg2Instrumentor().instrument(
92
+
enable_commenter=True,
93
+
enable_attribute_commenter=True,
94
+
)
95
+
96
+
97
+
For example,
98
+
::
99
+
100
+
Invoking cursor.execute("select * from auth_users") will lead to postgresql query "select * from auth_users" but when SQLCommenter and attribute_commenter are enabled
101
+
the query will get appended with some configurable tags like "select * from auth_users /*tag=value*/;" for both server query and `db.statement` span attribute.
0 commit comments