Skip to content

Commit 9846f75

Browse files
Rm unused factory
1 parent e67337e commit 9846f75

File tree

1 file changed

+1
-43
lines changed
  • instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql

1 file changed

+1
-43
lines changed

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

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113

114114
import mysql.connector
115115
import wrapt
116-
from mysql.connector.cursor_cext import CMySQLCursor
117116

118117
from opentelemetry import trace as trace_api
119118
from opentelemetry.instrumentation import dbapi
@@ -222,7 +221,7 @@ def wrapped_connection(
222221
args: typing.Tuple[typing.Any, typing.Any],
223222
kwargs: typing.Dict[typing.Any, typing.Any],
224223
):
225-
"""Add object proxy to connection object."""
224+
"""Add object proxy to connection object that checks cursor type."""
226225
connection = connect_method(*args, **kwargs)
227226
self.get_connection_attributes(connection)
228227
return get_traced_connection_proxy(connection, self)
@@ -363,44 +362,3 @@ def __exit__(self, *args, **kwargs):
363362
self.__wrapped__.__exit__(*args, **kwargs)
364363

365364
return TracedCursorProxy(cursor, *args, **kwargs)
366-
367-
368-
def _new_cursor_factory(
369-
db_api: DatabaseApiIntegration = None,
370-
cursor_factory: CMySQLCursor = None,
371-
tracer_provider: trace_api.TracerProvider = None,
372-
enable_commenter: bool = False,
373-
):
374-
if not db_api:
375-
db_api = DatabaseApiIntegration(
376-
__name__,
377-
MySQLInstrumentor._DATABASE_SYSTEM,
378-
MySQLInstrumentor._CONNECTION_ATTRIBUTES,
379-
version=__version__,
380-
tracer_provider=tracer_provider,
381-
)
382-
383-
# Latter is base class for all mysql-connector cursors
384-
cursor_factory = cursor_factory or CMySQLCursor
385-
_cursor_tracer = CursorTracer(
386-
db_api,
387-
enable_commenter,
388-
)
389-
390-
class TracedCursorFactory(cursor_factory):
391-
def execute(self, *args, **kwargs):
392-
return _cursor_tracer.traced_execution(
393-
self, super().execute, *args, **kwargs
394-
)
395-
396-
def executemany(self, *args, **kwargs):
397-
return _cursor_tracer.traced_execution(
398-
self, super().executemany, *args, **kwargs
399-
)
400-
401-
def callproc(self, *args, **kwargs):
402-
return _cursor_tracer.traced_execution(
403-
self, super().callproc, *args, **kwargs
404-
)
405-
406-
return TracedCursorFactory

0 commit comments

Comments
 (0)