open-telemetry / open-telemetry/opentelemetry-python-contrib

Flaky sqlalchemy tests with pypy 3.8 ubuntu

Open
#3,457 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Failure: https://github.com/open-telemetry/opentelemetry-python-contrib/actions/runs/14756804224/job/41427454203?pr=3448

=================================== FAILURES ===================================
______ TestSqlalchemyMetricsInstrumentation.test_metrics_two_connections _______

self = <tests.test_sqlalchemy_metrics.TestSqlalchemyMetricsInstrumentation testMethod=test_metrics_two_connections>

    def tearDown(self):
        super().tearDown()
>       SQLAlchemyInstrumentor().uninstrument()

instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py:31: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py:139: in uninstrument
    result = self._uninstrument(**kwargs)
instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/__init__.py:286: in _uninstrument
    EngineTracer.remove_all_event_listeners()
instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py:212: in remove_all_event_listeners
    remove(weak_ref_target(), identifier, func)
.tox/pypy3-test-instrumentation-sqlalchemy-1/lib/pypy3.8/site-packages/sqlalchemy/event/api.py:213: in remove
    _event_key(target, identifier, fn).remove()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

target = None, identifier = 'checkout'
fn = <bound method EngineTracer._pool_checkout of <opentelemetry.instrumentation.sqlalchemy.engine.EngineTracer object at 0x00007f752116c1a8>>

    def _event_key(target, identifier, fn):
        for evt_cls in _registrars[identifier]:
            tgt = evt_cls._accept_with(target)
            if tgt is not None:
                return _EventKey(target, identifier, fn, tgt)
        else:
>           raise exc.InvalidRequestError(
                "No such event '%s' for target '%s'" % (identifier, target)
            )
E           sqlalchemy.exc.InvalidRequestError: No such event 'checkout' for target 'None'

.tox/pypy3-test-instrumentation-sqlalchemy-1/lib/pypy3.8/site-packages/sqlalchemy/event/api.py:29: InvalidRequestError
_____ TestSqlalchemyMetricsInstrumentation.test_metrics_without_pool_name ______

self = <tests.test_sqlalchemy_metrics.TestSqlalchemyMetricsInstrumentation testMethod=test_metrics_without_pool_name>

    def test_metrics_without_pool_name(self):
        pool_name = "pool_test_name"
        engine = sqlalchemy.create_engine(
            "sqlite:///:memory:",
            pool_size=5,
            poolclass=QueuePool,
            pool_logging_name=pool_name,
        )
    
        self.assertIsNone(self.memory_metrics_reader.get_metrics_data())
    
        with engine.connect():
>           self.assert_pool_idle_used_expected(
                pool_name=pool_name, idle=0, used=1
            )

instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py:83: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py:35: in assert_pool_idle_used_expected
    self.assertEqual(len(metrics), 1)
E   AssertionError: 0 != 1
------------------------------ Captured log call -------------------------------

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py and reproduce the failures under PyPy 3.8 on Ubuntu. Then inspect EngineTracer.remove_all_event_listeners in instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py and the uninstrument path. Done means the reported metrics tests and teardown pass reliably in that environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
databases, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.