MCPcopy Create free account
hub / github.com/PyMySQL/mysqlclient / _set_attributes

Method _set_attributes

src/MySQLdb/connections.py:247–260  ·  view source on GitHub ↗

set some attributes for otel

(self, host=None, user=None, password=None, database="", port=3306,
                        unix_socket=None, **kwargs)

Source from the content-addressed store, hash-verified

245 self.messages = []
246
247 def _set_attributes(self, host=None, user=None, password=None, database="", port=3306,
248 unix_socket=None, **kwargs):
249 """set some attributes for otel"""
250 if unix_socket and not host:
251 host = "localhost"
252 # support opentelemetry-instrumentation-dbapi
253 self.host = host
254 # _mysql.Connection provides self.port
255 self.user = user
256 self.database = database
257 # otel-inst-mysqlclient uses db instead of database.
258 self.db = database
259 # NOTE: We have not supported semantic conventions yet.
260 # https://opentelemetry.io/docs/specs/semconv/database/sql/
261
262 def __enter__(self):
263 return self

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected