Skip to content

Commit a4c2a49

Browse files
committed
support opentelemetry-instrumentation
1 parent 8103651 commit a4c2a49

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/MySQLdb/connections.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,19 @@ class object, used to create cursors (keyword only)
204204
if type(k) is not int # noqa: E721
205205
}
206206

207+
# support opentelemetry-instrumentation-dbapi
208+
self.host = host
209+
self.port = port
210+
self.user = user
207211
self.database = kwargs2.get("database", "")
212+
# otel-inst-mysqlclient uses db instead of database.
213+
self.db = self.database
214+
# NOTE: We have not supported semantic conventions yet.
215+
# https://opentelemetry.io/docs/specs/semconv/database/sql/
208216

209217
self._server_version = tuple(
210218
[numeric_part(n) for n in self.get_server_info().split(".")[:2]]
211219
)
212-
213220
self.encoding = "ascii" # overridden in set_character_set()
214221

215222
if not charset:

0 commit comments

Comments
 (0)