관리-도구
편집 파일: redis.cpython-37.pyc
B T a � @ s� d dl mZ d dlmZ d dlmZmZ d dlmZ d dl m Z e rPd dlmZ e ddd d ddd dddg �Ze dddg�Zdd� ZG dd� de�Zdd� ZdS )� )�absolute_import)�Hub)�capture_internal_exceptions�logger)�Integration)�MYPY)�AnyZdecrZdecrby�getZincrZincrbyZpttl�setZsetexZsetnxZttl�delZtouch�unlinkc C s` ydd l } W n tk r d S X t| j� t| d| j�}d| k rNdk r\n n t| j� d S )Nr �VERSION)r � r )r r r )�rediscluster�ImportError�patch_redis_clientZRedisCluster�getattr�__version__ZStrictRedisCluster)r �version� r �N/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/redis.py�_patch_rediscluster s r c @ s e Zd ZdZedd� �ZdS )�RedisIntegration�redisc C s� dd l } t| j� ydd l}W n tk r2 Y n&X t|jj� t|jj� t|jj� y t � W n t k r� t�d� Y nX d S )Nr z4Error occurred while patching `rediscluster` library) r r ZStrictRedisZ rb.clientsr ZclientsZFanoutClientZ MappingClientZ RoutingClientr � Exceptionr � exception)r �rbr r r � setup_once( s zRedisIntegration.setup_onceN)�__name__� __module__�__qualname__� identifier�staticmethodr r r r r r % s r c s | j � � fdd�}|| _ dS )z` This function can be used to instrument custom redis client classes or subclasses. c s� t j}|�t�d kr&� | |f|�|�S |}t� �D |g}x,t|�D ] \}}|dkrTP |�t|�� qBW d�|�}W d Q R X |j d|d��`} |r�| � d|� |r�|r�|�� } | tks�| t kr�t|�dkr�| � d|d � � | |f|�|�S Q R X d S ) N� � r )�op�descriptionz redis.command� z redis.keyr )r �currentZget_integrationr r � enumerate�append�repr�joinZ start_spanZset_tag�lower�_SINGLE_KEY_COMMANDS�_MULTI_KEY_COMMANDS�len)�self�name�args�kwargsZhubr&