Skip to content

Commit edca781

Browse files
committed
replace the redis version checks with defines
1 parent 1f99507 commit edca781

File tree

1 file changed

+6
-6
lines changed
  • instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis

1 file changed

+6
-6
lines changed

instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def _instrument(
466466
f"{pipeline_class}.immediate_execute_command",
467467
_traced_execute_command,
468468
)
469-
if redis.VERSION >= _REDIS_CLUSTER_VERSION:
469+
if _CLIENT_CLUSTER_SUPPORT:
470470
wrap_function_wrapper(
471471
"redis.cluster",
472472
"RedisCluster.execute_command",
@@ -484,7 +484,7 @@ def _instrument(
484484
_async_traced_execute_pipeline = _async_traced_execute_pipeline_factory(
485485
tracer, request_hook, response_hook
486486
)
487-
if redis.VERSION >= _REDIS_ASYNCIO_VERSION:
487+
if _CLIENT_ASYNCIO_SUPPORT:
488488
wrap_function_wrapper(
489489
"redis.asyncio",
490490
f"{redis_class}.execute_command",
@@ -500,7 +500,7 @@ def _instrument(
500500
f"{pipeline_class}.immediate_execute_command",
501501
_async_traced_execute_command,
502502
)
503-
if redis.VERSION >= _REDIS_ASYNCIO_CLUSTER_VERSION:
503+
if _CLIENT_ASYNCIO_CLUSTER_SUPPORT:
504504
wrap_function_wrapper(
505505
"redis.asyncio.cluster",
506506
"RedisCluster.execute_command",
@@ -639,15 +639,15 @@ def _uninstrument(self, **kwargs: Any):
639639
unwrap(redis.Redis, "pipeline")
640640
unwrap(redis.client.Pipeline, "execute")
641641
unwrap(redis.client.Pipeline, "immediate_execute_command")
642-
if redis.VERSION >= _REDIS_CLUSTER_VERSION:
642+
if _CLIENT_CLUSTER_SUPPORT:
643643
unwrap(redis.cluster.RedisCluster, "execute_command")
644644
unwrap(redis.cluster.ClusterPipeline, "execute")
645-
if redis.VERSION >= _REDIS_ASYNCIO_VERSION:
645+
if _CLIENT_ASYNCIO_SUPPORT:
646646
unwrap(redis.asyncio.Redis, "execute_command")
647647
unwrap(redis.asyncio.Redis, "pipeline")
648648
unwrap(redis.asyncio.client.Pipeline, "execute")
649649
unwrap(redis.asyncio.client.Pipeline, "immediate_execute_command")
650-
if redis.VERSION >= _REDIS_ASYNCIO_CLUSTER_VERSION:
650+
if _CLIENT_ASYNCIO_CLUSTER_SUPPORT:
651651
unwrap(redis.asyncio.cluster.RedisCluster, "execute_command")
652652
unwrap(redis.asyncio.cluster.ClusterPipeline, "execute")
653653

0 commit comments

Comments
 (0)