Skip to content

Commit a130728

Browse files
Change logging, comment
1 parent 4002f7d commit a130728

File tree

1 file changed

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

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,9 @@ def cursor(self, *args, **kwargs):
414414
# then MySQL statements will be prepared and executed natively.
415415
# 1:1 sqlcomment and span correlation in instrumentation will
416416
# break, so sqlcomment is not supported for this use case.
417-
# This is here because a client app can use multiple cursors
418-
# and to not check cursor with every traced request.
417+
# This is here because wrapped cursor is not created until
418+
# application side creates cursor and it's only then that
419+
# the instrumentor knows what kind of cursor it is.
419420
is_prepared = False
420421
if (
421422
db_api_integration.database_system == "mysql"
@@ -428,7 +429,8 @@ def cursor(self, *args, **kwargs):
428429

429430
if is_prepared and db_api_integration.enable_commenter:
430431
_logger.warning(
431-
"sqlcomment is not supported for query statements executed with native prepared statement support. Disabling."
432+
"sqlcomment is not supported for query statements executed by cursors with native prepared statement support. Please check OpenTelemetry configuration. Disabling sqlcommenting for instrumentation of %s.",
433+
db_api_integration.connect_module.__name__,
432434
)
433435
db_api_integration.enable_commenter = False
434436

@@ -451,14 +453,11 @@ def is_mysql_connector_cursor_prepared(self, cursor): # pylint: disable=no-self
451453
CMySQLCursorPreparedNamedTuple,
452454
CMySQLCursorPreparedRaw,
453455
]:
454-
_logger.warning(
455-
"Adding sqlcomment to prepared MySQL statements is not supported. Please check OpenTelemetry configuration. Skipping."
456-
)
457456
return True
458457

459458
except ImportError as exc:
460459
_logger.warning(
461-
"Could not verify mysql.connector cursor, skipping prepared statement check: %s",
460+
"Could not verify mysql.connector cursor, skipping prepared cursor check: %s",
462461
exc,
463462
)
464463

0 commit comments

Comments
 (0)