Skip to content

Expose capture_parameters in opentelemetry-instrumentation-mysql - #4913

Open
saisharan0103 wants to merge 1 commit into
open-telemetry:mainfrom
saisharan0103:mergepath/issue-4789-opentelemetry-instrumentation-mysql-expo
Open

Expose capture_parameters in opentelemetry-instrumentation-mysql#4913
saisharan0103 wants to merge 1 commit into
open-telemetry:mainfrom
saisharan0103:mergepath/issue-4789-opentelemetry-instrumentation-mysql-expo

Conversation

@saisharan0103

Copy link
Copy Markdown

The MySQL instrumentor delegates span creation to the shared dbapi instrumentation, but it did not accept or forward dbapi's capture_parameters option. This meant MySQLInstrumentor().instrument(capture_parameters=True) silently dropped the option before dbapi.wrap_connect(...), and instrument_connection(..., capture_parameters=True) could not enable the shared dbapi parameter-capture behavior for mysql-connector users.

This change mirrors the option threading used by other dbapi-backed instrumentors:

  • reads capture_parameters from _instrument kwargs with a False default and passes it to dbapi.wrap_connect
  • adds capture_parameters to MySQLInstrumentor.instrument_connection with the same default and forwards it to dbapi.instrument_connection
  • documents the option in the MySQL instrumentation module docstring
  • extends existing dbapi-forwarding tests to assert default and enabled values
  • adds a semconv opt-in regression test showing MySQL emits the parameter attribute when the option is enabled

Fixes #4789

ruff check instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/__init__.py instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py reports no new findings on the changed files.
Ran pytest -x locally with no new failures.

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ❌ The email address for the commit (3a3a200) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

opentelemetry-instrumentation-mysql: expose capture_parameters

1 participant