U 췀g @sdZddlmZmZddlmZddlmZddlm Z ddl m Z e r|ddl m Z ddl mZdd lmZmZdd lmZd d Zd dZddZddZdS)z Instrumentation for RedisCluster This is part of the main redis-py client. https://github.com/redis/redis-py/blob/master/redis/cluster.py )patch_redis_clientpatch_redis_pipeline)_set_db_data_on_span)_parse_rediscluster_command)capture_internal_exceptions) TYPE_CHECKING)Any) RedisCluster)r ClusterPipeline)SpancCs*|}|dk r&|jdk r&t||jdSN)get_default_nodeZconnection_kwargsr)spanZasync_redis_cluster_instance default_noderY/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/redis/redis_cluster.py_set_async_cluster_db_datasrc Cs"tt||jW5QRXdSr )rrZ_client)rZ%async_redis_cluster_pipeline_instancerrr#_set_async_cluster_pipeline_db_data$s rcCs,|}|dk r(|j|jd}t||dS)N)hostport)r rrr)rZredis_cluster_instancerZconnection_paramsrrr_set_cluster_db_data/s rcCszddlm}m}Wntk r(Yn"Xt|dtdt|jdttdzddl m}Wntk rnYn4Xddl m }m }||jdt d||jdttddS) zLPatches the cluster module on redis SDK (as opposed to rediscluster library)r)r clusterT) is_clusterset_db_data_fn)rZget_command_args_fnr)r)patch_redis_async_clientpatch_redis_async_pipelineN)redisr r ImportErrorrrrr rZ redis.asyncioZ+sentry_sdk.integrations.redis._async_commonrrrr)r rZ async_clusterrrrrr_patch_redis_cluster;s>rN)__doc__Z*sentry_sdk.integrations.redis._sync_commonrrZ-sentry_sdk.integrations.redis.modules.queriesrZ#sentry_sdk.integrations.redis.utilsrZsentry_sdk.utilsrtypingrrrr Zredis.asyncio.clusterZAsyncRedisClusterr ZAsyncClusterPipelineZsentry_sdk.tracingr rrrrrrrrs