Skip to content

Add DB-API sqlcomment mysql_client_version fallback#3729

Merged
xrmx merged 20 commits intoopen-telemetry:mainfrom
tammy-baylis-swi:mysql-client-comment-field-fallback
Jan 26, 2026
Merged

Add DB-API sqlcomment mysql_client_version fallback#3729
xrmx merged 20 commits intoopen-telemetry:mainfrom
tammy-baylis-swi:mysql-client-comment-field-fallback

Conversation

@tammy-baylis-swi
Copy link
Copy Markdown
Contributor

@tammy-baylis-swi tammy-baylis-swi commented Sep 2, 2025

Description

Stops stacktraces when programmatic instrumentation with sqlcommenting is enabled in some cases.

Fixes #3730

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@tammy-baylis-swi tammy-baylis-swi marked this pull request as ready for review September 2, 2025 20:03
@tammy-baylis-swi tammy-baylis-swi requested a review from a team as a code owner September 2, 2025 20:03
@tammy-baylis-swi tammy-baylis-swi moved this to Ready for review in Python PR digest Sep 2, 2025
Copy link
Copy Markdown
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some docker tests, I fixed a crash in the psycopg commenter code extracting the libpq version recently and the mocks were not matching reality.

@xrmx xrmx moved this from Ready for review to Reviewed PRs that need fixes in Python PR digest Oct 10, 2025
@tammy-baylis-swi
Copy link
Copy Markdown
Contributor Author

Please add some docker tests, I fixed a crash in the psycopg commenter code extracting the libpq version recently and the mocks were not matching reality.

@xrmx done, ptal.

I tried to add one for the unknown fallback in couple ways that won't work. Attempting a patch in docker-tests results in AttributeError: '_mysql_connector.MySQL' object attribute 'get_client_info' is read-only. Similarly, can't remove _cmysql from mysql.connector at test time. Unit test coverage is adequate I hope.

@tammy-baylis-swi tammy-baylis-swi requested a review from xrmx October 20, 2025 23:22
@tammy-baylis-swi tammy-baylis-swi moved this from Reviewed PRs that need fixes to Ready for review in Python PR digest Jan 15, 2026
@tammy-baylis-swi
Copy link
Copy Markdown
Contributor Author

Hi @xrmx , @emdneto what are your thoughts?

@tammy-baylis-swi tammy-baylis-swi force-pushed the mysql-client-comment-field-fallback branch from 3d7ecf8 to 3249647 Compare January 22, 2026 01:57
@tammy-baylis-swi tammy-baylis-swi requested a review from xrmx January 22, 2026 02:03
@xrmx xrmx enabled auto-merge (squash) January 26, 2026 16:46
@xrmx xrmx merged commit 3b357c0 into open-telemetry:main Jan 26, 2026
663 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Done in Python PR digest Jan 26, 2026
wikaaaaa pushed a commit to wikaaaaa/opentelemetry-python-contrib that referenced this pull request Feb 5, 2026
)

* Add dbapi comment mysql_client_version fallback

* Changelog

* Add docker test_mysql_sqlcommenter

* Update dbapi docker-tests

* Add test fetchall

* Add test case for cmysql unknown

* Change to patch

* Rm test attempt

* Changelog

* simplify commenter_data assn

* Add Pure Python mysql_client_version unknown test

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
sightseeker added a commit to sightseeker/opentelemetry-python-contrib that referenced this pull request Mar 11, 2026
)

* Add dbapi comment mysql_client_version fallback

* Changelog

* Add docker test_mysql_sqlcommenter

* Update dbapi docker-tests

* Add test fetchall

* Add test case for cmysql unknown

* Change to patch

* Rm test attempt

* Changelog

* simplify commenter_data assn

* Add Pure Python mysql_client_version unknown test

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

DB-API instrumentation errors if mysql-connector connection wrapper used for queries with sqlcomment enabled

3 participants