Пример #1
0
    def test_env_var_disables_prevents_auto_instrument(self, env_var,
                                                       are_uninstrumented):
        os.environ['SIGNALFX_TRACING_ENABLED'] = env_var
        modules = [
            utils.get_module(l) for l in expected_auto_instrumentable_libraries
        ]
        assert self.all_are_uninstrumented(modules)

        auto_instrument()

        assert self.all_are_uninstrumented(modules) is are_uninstrumented
Пример #2
0
    def test_auto_instrument_instruments_all_available_libraries(self):
        modules = [(utils.get_module(l), l)
                   for l in expected_traceable_libraries]
        assert self.all_are_uninstrumented(modules)

        auto_instrument()

        for module, library in modules:
            if library in expected_auto_instrumentable_libraries:
                assert getattr(module, instrumented_attr) is True
            else:
                assert not hasattr(module, instrumented_attr)
Пример #3
0
    def test_env_var_disables_prevents_auto_instrument(self, env_var,
                                                       are_uninstrumented):
        os.environ[tracing_enabled_env_var] = env_var
        try:
            modules = [
                utils.get_module(l)
                for l in expected_auto_instrumentable_libraries
            ]
            assert self.all_are_uninstrumented(modules)

            auto_instrument()

            assert self.all_are_uninstrumented(modules) is are_uninstrumented
        finally:
            os.environ.pop(tracing_enabled_env_var)
Пример #4
0
    def test_instrumentation_env_var_disabled_prevents_auto_instrument(
            self, env_var, are_uninstrumented):
        enableds = [
            'SIGNALFX_{0}_ENABLED'.format(lib.upper())
            for lib in expected_auto_instrumentable_libraries
        ]
        for enabled in enableds:
            os.environ[enabled] = env_var
        try:
            modules = [
                utils.get_module(l)
                for l in expected_auto_instrumentable_libraries
            ]
            assert self.all_are_uninstrumented(modules)

            auto_instrument()

            assert self.all_are_uninstrumented(modules) is are_uninstrumented
        finally:
            for enabled in enableds:
                os.environ.pop(enabled)