
    tni                         d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ erddl
mZ ddlmZ dd	lmZmZ dd
lmZ 	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZddZdS )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_clientpatch_redis_pipeline)_set_db_data_on_span)_parse_rediscluster_command)capture_internal_exceptions)TYPE_CHECKING)Any)RedisCluster)r
   ClusterPipeline)Spanspanr   async_redis_cluster_instanceAsyncRedisCluster[Any]returnNc                 r    |                                 }||j        t          | |j                   d S d S d S )N)get_default_nodeconnection_kwargsr   )r   r   default_nodes      h/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/sentry_sdk/integrations/redis/redis_cluster.py_set_async_cluster_db_datar      sJ     0@@BBLL$B$NT<#ABBBBB  $N$N    %async_redis_cluster_pipeline_instanceAsyncClusterPipeline[Any]c                     t                      5  t          |dd           }||j        }t          | |           d d d            d S # 1 swxY w Y   d S )Ncluster_client)r   getattr_clientr   )r   r   clients      r   #_set_async_cluster_pipeline_db_datar   %   s     
%	&	& 
 
>@PRVWW> 6=  	#	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   +AAAredis_cluster_instanceRedisCluster[Any]c                 t    |                                 }|!|j        |j        d}t          | |           d S d S )N)hostport)r   r#   r$   r   )r   r    r   connection_paramss       r   _set_cluster_db_datar&   9   sU     *::<<L % %
 
 	T#455555  r   c                  X   	 ddl m} m} t          | dt                     t          |j        dt          t                     n# t          $ r Y nw xY w	 ddl	m} ddl
m}m}  ||j        dt                      ||j        dt          t                     dS # t          $ r Y dS w xY w)	zLPatches the cluster module on redis SDK (as opposed to rediscluster library)r   )r
   clusterT)
is_clusterset_db_data_fn)r)   get_command_args_fnr*   )r(   )patch_redis_async_clientpatch_redis_async_pipelineN)redisr
   r(   r   r&   r   r   r   ImportErrorredis.asyncio+sentry_sdk.integrations.redis._async_commonr,   r-   r   r   )r
   r(   async_clusterr,   r-   s        r   _patch_redis_clusterr3   F   sP   
//////// 	/	
 	
 	
 	

 	# ;/		
 	
 	
 	
 	
    
::::::	
 	
 	
 	
 	
 	
 	
 	

 	! &5	
 	
 	
 	

 	#") ;>		
 	
 	
 	
 	
 	
    s#   A 
AAB 
B)(B))r   r   r   r   r   N)r   r   r   r   r   N)r   r   r    r!   r   N)r   N)__doc__*sentry_sdk.integrations.redis._sync_commonr   r   -sentry_sdk.integrations.redis.modules.queriesr   #sentry_sdk.integrations.redis.utilsr   sentry_sdk.utilsr   typingr   r	   r.   r
   redis.asyncio.clusterAsyncRedisClusterr   AsyncClusterPipelinesentry_sdk.tracingr   r   r   r&   r3    r   r   <module>r?      s           O N N N N N K K K K K K 8 8 8 8 8 8             (""""""        ('''''C
C0HC	C C C C


9T
	
 
 
 
(
6

6*=
6	
6 
6 
6 
6'
 '
 '
 '
 '
 '
r   