
    tni\                         d dl Z d dlZd dlmZ d dlmZ d dlmZ erd dl mZm	Z	 d dl
mZmZmZmZ dgZ G d de          Zd	d
dddefdZddZddZdS )    N)MYPY)OP)Integration)AddressFamily
SocketKind)TupleOptionalUnionListSocketIntegrationc                   4    e Zd ZdZde Zedd            ZdS )r   socketzauto.socket.returnNc                  >    t                       t                       dS )zs
        patches two of the most used functions of socket: create_connection and getaddrinfo(dns resolver)
        N)_patch_create_connection_patch_getaddrinfo     [/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/sentry_sdk/integrations/socket.py
setup_oncezSocketIntegration.setup_once   s"    
 	!"""r   r   N)__name__
__module____qualname__
identifieroriginstaticmethodr   r   r   r   r   r      sD        J(J((F   \  r   hostUnion[bytes, str, None]portUnion[bytes, str, int, None]r   c                     	 |                                  } n# t          t          f$ r Y nw xY w	 |                                 }n# t          t          f$ r Y nw xY w| d|}|S )N:)decodeUnicodeDecodeErrorAttributeError)r   r    descriptions      r   _get_span_descriptionr(      s    {{}}/   {{}}/    "TT44(Ks    ++A AAc                  l    t           j        t           j        d f	 	 	 	 	 	 	 d
fd	} | t           _        d S )NaddressTuple[Optional[str], int]timeoutOptional[float]source_address2Optional[Tuple[Union[bytearray, bytes, str], int]]r   socket.socketc                    t          j                                        t                    }| | ||          S t          j        t
          j        t          | d         | d                   t          j                  5 }|	                    d|            |	                    d|           |	                    d|            | ||          cd d d            S # 1 swxY w Y   d S )Nr      opnamer   r*   r,   r.   )r*   r,   r.   )

sentry_sdk
get_clientget_integrationr   
start_spanr   SOCKET_CONNECTIONr(   r   set_data)r*   r,   r.   integrationspanreal_create_connections        r   create_connectionz3_patch_create_connection.<locals>.create_connection0   s3   
 !+--==>OPP))'7NKKK"#&wqz71:>>$+
 
 
 	 MM)W---MM)W---MM*N;;;))  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ACC"%C")r*   r+   r,   r-   r.   r/   r   r0   )r   r?   _GLOBAL_DEFAULT_TIMEOUT)r?   r>   s    @r   r   r   -   sj    #5 &,%COS," M 
	     ,  1Fr   c                      t           j        	 	 	 	 ddddddt          dt          dt          d	t          d
dffd} | t           _        d S )Nr   r   r   r    r!   familytypeprotoflagsr   zvList[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int], Tuple[int, bytes]]]]c           	         t          j                                        t                    }| | |||||          S t          j        t
          j        t          | |          t          j                  5 }|	                    d|            |	                    d|            | |||||          cd d d            S # 1 swxY w Y   d S )Nr3   r   r    )
r6   r7   r8   r   r9   r   
SOCKET_DNSr(   r   r;   )	r   r    rB   rC   rD   rE   r<   r=   real_getaddrinfos	           r   getaddrinfoz'_patch_getaddrinfo.<locals>.getaddrinfoL   s*    !+--==>OPP##D$eUKKK"}&tT22$+
 
 
 	L MM&$'''MM&$'''##D$eUKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	Ls   8<CCC)r   r   r   r   )r   rI   int)rI   rH   s    @r   r   r   I   s    )
 L L'L,L L 	L
 L L 
BL L L L L L, %Fr   r   )r   r6   sentry_sdk._typesr   sentry_sdk.constsr   sentry_sdk.integrationsr   r   r   typingr   r	   r
   r   __all__r   strr(   r   r   r   r   r   <module>rQ      s$        " " " " " "             / / / / / / 400000000333333333333

 
 
 
 
 
 
 

#+I   "1 1 1 18% % % % % %r   