Skip to content

Commit 6160090

Browse files
Emphasize framework/orm-specific instrumentors first
1 parent d042691 commit 6160090

File tree

1 file changed

+23
-6
lines changed
  • instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi

1 file changed

+23
-6
lines changed

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
# Example: pyodbc
4848
trace_integration(pyodbc, "Connection", "odbc")
4949
50-
# Or, directly call wrap_connect for more configurability
50+
# Or, directly call wrap_connect for more configurability.
5151
wrap_connect(__name__, mysql.connector, "connect", "mysql")
5252
wrap_connect(__name__, pyodbc, "Connection", "odbc")
5353
@@ -57,7 +57,14 @@
5757
5858
SQLCOMMENTER
5959
************
60-
You can optionally configure DB-API instrumentation to enable sqlcommenter which
60+
sqlcommenter is supported by several database client framework/ORM-specific
61+
instrumentors. See their respective docs for how to opt into this feature at
62+
`instrumentation`_. There is no need to opt in at the DB-API level unless setting up
63+
its integration directly.
64+
65+
.. _instrumentation: https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation
66+
67+
If using DB-API instrumentation directly, you can optionally enable sqlcommenter which
6168
enriches the query with contextual information. Queries made after setting up
6269
trace integration with sqlcommenter enabled will have configurable key-value pairs
6370
appended to them, e.g. ``"select * from auth_users; /*metrics=value*/"``. This
@@ -74,7 +81,7 @@
7481
from opentelemetry.instrumentation.dbapi import wrap_connect
7582
7683
77-
# Opts into sqlcomment for MySQL trace integration
84+
# Opts into sqlcomment for MySQL trace integration.
7885
wrap_connect(
7986
__name__,
8087
mysql.connector,
@@ -86,7 +93,17 @@
8693
8794
SQLCommenter Configurations
8895
***************************
89-
When using ``wrap_connect`` for DB-API trace integration, the key-value pairs appended to the query can be configured using ``commenter_options``. When sqlcommenter is enabled, all available KVs/tags calculated by default. ``commenter_options`` supports opting out of specific KVs.
96+
sqlcommenter is supported by several database client framework/ORM-specific
97+
instrumentors. See their respective docs for how to configure this feature at
98+
`instrumentation`_. There is no need to configure at the DB-API level unless setting up
99+
its integration directly.
100+
101+
.. _instrumentation: https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation
102+
103+
If using DB-API instrumentation directly, the key-value pairs appended to the query
104+
can be configured using ``commenter_options``. When sqlcommenter is enabled, all
105+
available KVs/tags are calculated by default. ``commenter_options`` supports *opting out*
106+
of specific KVs.
90107
91108
.. code:: python
92109
@@ -95,8 +112,8 @@
95112
from opentelemetry.instrumentation.dbapi import wrap_connect
96113
97114
98-
# Opts into sqlcomment for MySQL trace integration
99-
# Opts out of tags for libpq_version
115+
# Opts into sqlcomment for MySQL trace integration.
116+
# Opts out of tags for libpq_version, db_driver.
100117
wrap_connect(
101118
__name__,
102119
mysql.connector,

0 commit comments

Comments
 (0)