Python redis.VERSION Examples

The following are 4 code examples of redis.VERSION(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module redis , or try the search function .
Example #1
Source File: __init__.py    From opentelemetry-python with Apache License 2.0 6 votes vote down vote up
def _uninstrument(self, **kwargs):
        if redis.VERSION < (3, 0, 0):
            unwrap(redis.StrictRedis, "execute_command")
            unwrap(redis.StrictRedis, "pipeline")
            unwrap(redis.Redis, "pipeline")
            unwrap(
                redis.client.BasePipeline,  # pylint:disable=no-member
                "execute",
            )
            unwrap(
                redis.client.BasePipeline,  # pylint:disable=no-member
                "immediate_execute_command",
            )
        else:
            unwrap(redis.Redis, "execute_command")
            unwrap(redis.Redis, "pipeline")
            unwrap(redis.client.Pipeline, "execute")
            unwrap(redis.client.Pipeline, "immediate_execute_command") 
Example #2
Source File: test_app_redis.py    From agentless-system-crawler with Apache License 2.0 5 votes vote down vote up
def test_redis_module(self):
        import redis
        v = redis.VERSION
        self.assertIsNotNone(v, "redis module does not exist") 
Example #3
Source File: __init__.py    From opentelemetry-python with Apache License 2.0 5 votes vote down vote up
def _instrument(self, **kwargs):
        tracer_provider = kwargs.get(
            "tracer_provider", trace.get_tracer_provider()
        )
        setattr(
            redis,
            "_opentelemetry_tracer",
            tracer_provider.get_tracer(_DEFAULT_SERVICE, __version__),
        )

        if redis.VERSION < (3, 0, 0):
            wrap_function_wrapper(
                "redis", "StrictRedis.execute_command", _traced_execute_command
            )
            wrap_function_wrapper(
                "redis.client",
                "BasePipeline.execute",
                _traced_execute_pipeline,
            )
            wrap_function_wrapper(
                "redis.client",
                "BasePipeline.immediate_execute_command",
                _traced_execute_command,
            )
        else:
            wrap_function_wrapper(
                "redis", "Redis.execute_command", _traced_execute_command
            )
            wrap_function_wrapper(
                "redis.client", "Pipeline.execute", _traced_execute_pipeline
            )
            wrap_function_wrapper(
                "redis.client",
                "Pipeline.immediate_execute_command",
                _traced_execute_command,
            ) 
Example #4
Source File: redis.py    From apm-agent-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_instrument_list(self):
        try:
            from redis import VERSION

            if VERSION[0] >= 3:
                return self.instrument_list_3
            return self.instrument_list
        except ImportError:
            return self.instrument_list