Ejemplo n.º 1
0
def register_datadog_if_module_patched(module: str, *args, **kwargs) -> bool:
    """Register the datadog integration if ddtrace is already used.

    This can be used to enable datadog for Spinach only if datadog
    is enabled for Django.

    :param module: Name of the module that must already be patched
    :return: boolean telling if the integration was registered
    """
    try:
        from ddtrace.monkey import get_patched_modules
    except ImportError:
        return False

    if module not in get_patched_modules():
        return False

    register_datadog(*args, **kwargs)
    return True
from ddtrace import monkey
from ddtrace import tracer


if __name__ == "__main__":
    assert not tracer.enabled
    assert len(monkey.get_patched_modules()) == 0
    print("Test success")
Ejemplo n.º 3
0
from __future__ import print_function

from ddtrace import tracer, monkey

from nose.tools import ok_, eq_

if __name__ == '__main__':
    ok_(not tracer.enabled)
    eq_(len(monkey.get_patched_modules()), 0)
    print("Test success")
Ejemplo n.º 4
0
from ddtrace import monkey

if __name__ == "__main__":
    assert "redis" in monkey.get_patched_modules()
    print("Test success")
from __future__ import print_function

from ddtrace import monkey

from nose.tools import ok_

if __name__ == '__main__':
    ok_('redis' in monkey.get_patched_modules())
    print("Test success")
from __future__ import print_function

from ddtrace import monkey

from nose.tools import ok_

if __name__ == '__main__':
    ok_('redis' in monkey.get_patched_modules())
    ok_('celery' in monkey.get_patched_modules())
    print("Test success")
Ejemplo n.º 7
0
from ddtrace import monkey

if __name__ == '__main__':
    assert 'redis' in monkey.get_patched_modules()
    print('Test success')