
    fia                         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	 Zd
 Zd ZdS )    N)MYPY)OP)Integration)AddressFamily
SocketKind)TupleOptionalUnionListSocketIntegrationc                   2    e Zd ZdZde Zed             ZdS )r   socketzauto.socket.c                  >    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     n/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/sentry_sdk/integrations/socket.py
setup_oncezSocketIntegration.setup_once   s"     	!"""r   N)__name__
__module____qualname__
identifieroriginstaticmethodr   r   r   r   r   r      s?        J(J((F  \  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)hostportdescriptions      r   _get_span_descriptionr$      s    {{}}/   {{}}/    "TT44(Ks    ++A AAc                  \    t           j        t           j        d ffd	} | t           _        d S )Nc                    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   addresstimeoutsource_address)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_connection2   s3    !+--==>OPP))'7NKKK"#&wqz71:>>$+
 
 
 	 MM)W---MM)W---MM*N;;;))  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ACC"%C")r   r7   _GLOBAL_DEFAULT_TIMEOUT)r7   r6   s    @r   r   r   .   sE    #5 .     .  1Fr   c                  D    t           j        dfd	} | t           _        d S )Nr   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 )Nr(   r!   r"   )
r.   r/   r0   r   r1   r   
SOCKET_DNSr$   r   r3   )	r!   r"   familytypeprotoflagsr4   r5   real_getaddrinfos	           r   getaddrinfoz'_patch_getaddrinfo.<locals>.getaddrinfoP   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   rA   )rA   r@   s    @r   r   r   L   s@    )L L L L L L  %Fr   )r   r.   sentry_sdk._typesr   sentry_sdk.constsr   sentry_sdk.integrationsr   r   r   typingr   r	   r
   r   __all__r   r$   r   r   r   r   r   <module>rG      s         " " " " " "             / / / / / / 400000000333333333333
         "1 1 1<% % % % %r   