Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mysql): add support for mysql-connector-python v9 #2751

Merged
merged 10 commits into from
Jul 31, 2024

Conversation

omikader
Copy link
Contributor

@omikader omikader commented Jul 29, 2024

Description

This PR adds support for mysql-connector-python v9.

Fixes #2720

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Ran unit tests locally on the new version

oabdelkader@oabdelkader-mlt opentelemetry-python-contrib % .tox/py312-test-instrumentation-mysql-1/bin/pytest instrumentation/opentelemetry-instrumentation-mysql
============================================================================================= test session starts ==============================================================================================
platform darwin -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 -- /Users/oabdelkader/GitLab/opentelemetry-python-contrib/.tox/py312-test-instrumentation-mysql-1/bin/python
cachedir: .pytest_cache
rootdir: /Users/oabdelkader/GitLab/opentelemetry-python-contrib
configfile: pytest.ini
collected 5 items

instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_custom_tracer_provider
------------------------------------------------------------------------------------------------ live log call -------------------------------------------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'db.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                                                                                                   [ 20%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection
------------------------------------------------------------------------------------------------ live log call -------------------------------------------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'db.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                                                                                                   [ 40%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection_no_op_tracer_provider PASSED                                       [ 60%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrumentor
------------------------------------------------------------------------------------------------ live log call -------------------------------------------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'db.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                                                                                                   [ 80%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_uninstrument_connection
------------------------------------------------------------------------------------------------ live log call -------------------------------------------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'db.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.name' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING  opentelemetry.attributes:__init__.py:101 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                                                                                                   [100%]

=============================================================================================== warnings summary ===============================================================================================
opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py:4
  /Users/oabdelkader/GitLab/opentelemetry-python-contrib/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import (

instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrumentor
  /Users/oabdelkader/GitLab/opentelemetry-python-contrib/.tox/py312-test-instrumentation-mysql-1/lib/python3.12/site-packages/opentelemetry/test/test_base.py:74: DeprecationWarning: Call to deprecated function (or staticmethod) instrumentation_info. (You should use instrumentation_scope) -- Deprecated since version 1.11.1.
    self.assertEqual(span.instrumentation_info.name, module.__name__)

instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrumentor
  /Users/oabdelkader/GitLab/opentelemetry-python-contrib/.tox/py312-test-instrumentation-mysql-1/lib/python3.12/site-packages/opentelemetry/test/test_base.py:75: DeprecationWarning: Call to deprecated function (or staticmethod) instrumentation_info. (You should use instrumentation_scope) -- Deprecated since version 1.11.1.
    self.assertEqual(span.instrumentation_info.version, module.__version__)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================== 5 passed, 3 warnings in 0.38s =========================================================================================

Does This PR Require a Core Repo Change?

  • 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

@omikader omikader requested a review from a team July 29, 2024 15:51
Copy link

linux-foundation-easycla bot commented Jul 29, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@omikader omikader force-pushed the support-mysql-connector-9 branch from ca401c3 to 6db9dcc Compare July 29, 2024 15:56
instrumentation/README.md Outdated Show resolved Hide resolved
@omikader omikader force-pushed the support-mysql-connector-9 branch from ee98e04 to 9fddfdc Compare July 29, 2024 16:57
Copy link
Member

@emdneto emdneto left a comment

Choose a reason for hiding this comment

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

I think would be nice a changelog entry

@lzchen lzchen merged commit dab664c into open-telemetry:main Jul 31, 2024
389 checks passed
@omikader omikader deleted the support-mysql-connector-9 branch July 31, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for mysql-connector-python v9
4 participants