Skip to content

opentelemetry-instrumentation-mysql: warnings on attributes with wrong type in tests #4114

@xrmx

Description

@xrmx

tox -e py310-test-instrumentation-mysql-1 raises the following warnings in mysql instrumentation integrations tests. It should be doable to provide proper values for these attributes in the mocks so that no warning is raised.

instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_custom_tracer_provider 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [  6%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 13%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection_enable_commenter_dbapi_kwargs PASSED [ 20%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection_no_op_tracer_provider PASSED [ 26%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection_with_dbapi_sqlcomment_enabled 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 33%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection_with_dbapi_sqlcomment_enabled_stmt_enabled 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 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_with_dbapi_sqlcomment_enabled_with_options 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 46%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_connection_with_dbapi_sqlcomment_not_enabled_default 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 53%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_enable_commenter_dbapi_kwargs PASSED [ 60%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_with_dbapi_sqlcomment_enabled 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 66%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_with_dbapi_sqlcomment_enabled_stmt_enabled 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 73%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrument_with_dbapi_sqlcomment_enabled_with_options 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 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_instrument_with_dbapi_sqlcomment_not_enabled_default 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 86%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_instrumentor 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
PASSED                                                                                                                               [ 93%]
instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py::TestMysqlIntegration::test_uninstrument_connection 
-------------------------------------------------------------- live log call ---------------------------------------------------------------
WARNING  opentelemetry.attributes:__init__.py:111 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:111 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:111 Invalid type MagicMock for attribute 'net.peer.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions