Giter Site home page Giter Site logo

Comments (4)

zdyj3170101136 avatar zdyj3170101136 commented on June 14, 2024

appear in 2.0.1.
not appear in 1.20.16.

assume this is a problem only in datadog >= 2.0.0

from dd-trace-py.

P403n1x87 avatar P403n1x87 commented on June 14, 2024

@zdyj3170101136 could you please try

import ddtrace.auto  # noqa

from ddtrace import patch
patch(gevent=True)

import gevent 
gevent.monkey.patch_all()

def test_context():
    def f():
        a = "foo"
    gevent.spawn(f).join()

More details about this are available from the docs.

However, I see that you are trying to patch gevent during a test run. In that case, I think your better option is to ensure the ddtrace plugin for pytest is enabled.

cc @romainkomorndatadog

from dd-trace-py.

zdyj3170101136 avatar zdyj3170101136 commented on June 14, 2024

@zdyj3170101136你可以试试吗

import ddtrace.auto  # noqa

from ddtrace import patch
patch(gevent=True)

import gevent 
gevent.monkey.patch_all()

def test_context():
    def f():
        a = "foo"
    gevent.spawn(f).join()

有关此内容的更多详细信息可以从文档中获得。

但是,我发现您正在尝试在测试运行期间修补 gevent。在这种情况下,我认为您更好的选择是确保启用ddtrace插件。pytest

抄送@romainkomorndatadog

after imported, event ddtrace 1.14.0 could not work.

 pytest y.py
========================================================================= test session starts =========================================================================
platform linux -- Python 3.7.7, pytest-7.4.4, pluggy-1.2.0
rootdir: /root
plugins: ddtrace-1.14.0
collected 0 items / 1 error

=============================================================================== ERRORS ================================================================================
________________________________________________________________________ ERROR collecting y.py ________________________________________________________________________
/usr/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:682: in _load_unlocked
    ???
/usr/lib/python3.7/site-packages/ddtrace/internal/module.py:246: in __getitem__
    return self._modules.__getitem__(item)
E   KeyError: 'root.y'
======================================================================= short test summary info =======================================================================
ERROR y.py - KeyError: 'root.y'

 python3.7 -m pytest y.py
========================================================================= test session starts =========================================================================
platform linux -- Python 3.7.7, pytest-7.4.4, pluggy-1.2.0
rootdir: /root
plugins: ddtrace-2.5.0
collected 0 items / 1 error

=============================================================================== ERRORS ================================================================================
________________________________________________________________________ ERROR collecting y.py ________________________________________________________________________
/usr/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:152: in __exit__
    ???
<frozen importlib._bootstrap>:107: in release
    ???
E   RuntimeError: cannot release un-acquired lock
======================================================================= short test summary info =======================================================================
ERROR y.py - RuntimeError: cannot release un-acquired loc

from dd-trace-py.

emmettbutler avatar emmettbutler commented on June 14, 2024

Closing as a duplicate of #8281

from dd-trace-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.