|
23 | 23 | The DB-API instrumentor and its utilities provide common, core functionality for |
24 | 24 | database framework or object relation mapper (ORM) instrumentations. Users will |
25 | 25 | typically instrument database client code with those framework/ORM-specific |
26 | | -instrumentations, instead of directly using this DB-API integration. See full list |
27 | | -at `instrumentation`_. |
| 26 | +instrumentations, instead of directly using this DB-API integration. Features |
| 27 | +such as sqlcommenter can be configured at framework/ORM level as well. See full |
| 28 | +list at `instrumentation`_. |
28 | 29 |
|
29 | 30 | .. _instrumentation: https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation |
30 | 31 |
|
|
57 | 58 |
|
58 | 59 | SQLCommenter |
59 | 60 | ************ |
60 | | -sqlcommenter is supported by several Python 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 | | -If using DB-API instrumentation directly, you can optionally enable sqlcommenter which |
66 | | -enriches the query with contextual information. Queries made after setting up |
67 | | -trace integration with sqlcommenter enabled will have configurable key-value pairs |
68 | | -appended to them, e.g. ``"select * from auth_users; /*traceparent=00-01234567-abcd-01*/"``. This |
| 61 | +You can optionally enable sqlcommenter which enriches the query with contextual |
| 62 | +information. Queries made after setting up trace integration with sqlcommenter |
| 63 | +enabled will have configurable key-value pairs appended to them, e.g. |
| 64 | +``"select * from auth_users; /*traceparent=00-01234567-abcd-01*/"``. This |
69 | 65 | supports context propagation between database client and server when database log |
70 | 66 | records are enabled. For more information, see: |
71 | 67 |
|
|
89 | 85 | ) |
90 | 86 |
|
91 | 87 |
|
92 | | -SQLComment customization |
93 | | -************************ |
94 | | -sqlcommenter is supported by several Python database client framework/ORM-specific |
95 | | -instrumentors. See their respective docs for how to configure this feature at |
96 | | -`instrumentation`_. There is no need to configure at the DB-API level unless setting up |
97 | | -its integration directly. |
98 | | -
|
99 | | -If using DB-API instrumentation directly, the key-value pairs appended to the query |
100 | | -can be configured using ``commenter_options``. When sqlcommenter is enabled, all |
101 | | -available KVs/tags are calculated by default. ``commenter_options`` supports *opting out* |
| 88 | +SQLCommenter with commenter_options |
| 89 | +*********************************** |
| 90 | +The key-value pairs appended to the query can be configured using |
| 91 | +``commenter_options``. When sqlcommenter is enabled, all available KVs/tags |
| 92 | +are calculated by default. ``commenter_options`` supports *opting out* |
102 | 93 | of specific KVs. |
103 | 94 |
|
104 | 95 | .. code:: python |
|
122 | 113 | } |
123 | 114 | ) |
124 | 115 |
|
125 | | -Available commenter options |
| 116 | +Available commenter_options |
126 | 117 | ########################### |
127 | 118 |
|
128 | 119 | The following sqlcomment key-values can be opted out of through ``commenter_options``: |
|
147 | 138 |
|
148 | 139 | SQLComment in span attribute |
149 | 140 | **************************** |
150 | | -sqlcommenter is supported by several Python database client framework/ORM-specific |
151 | | -instrumentors. See their respective docs for how to opt into this feature at |
152 | | -`instrumentation`_. There is no need to opt in at the DB-API level unless setting up |
153 | | -its integration directly. |
154 | | -
|
155 | | -If using DB-API instrumentation directly and sqlcommenter is enabled, you can opt into |
156 | | -the inclusion of sqlcomment in the query span ``db.statement`` attribute for your needs. |
157 | | -If ``commenter_options`` have been set, the span attribute comment will also be configured |
158 | | -by this setting. |
| 141 | +If sqlcommenter is enabled, you can opt into the inclusion of sqlcomment in |
| 142 | +the query span ``db.statement`` attribute for your needs. If ``commenter_options`` |
| 143 | +have been set, the span attribute comment will also be configured by this |
| 144 | +setting. |
159 | 145 |
|
160 | 146 | .. code:: python |
161 | 147 |
|
|
0 commit comments