bg ddlmZddlZddlmZddlmZddlmZddl m Z erddlm Z m Z ddl mZmZmZmZd gZGd d e Zd Zd Zd ZdS))absolute_importN)Hub)MYPY)OP) Integration) AddressFamily SocketKind)TupleOptionalUnionListSocketIntegrationc(eZdZdZedZdS)rsocketc>ttdS)zs patches two of the most used functions of socket: create_connection and getaddrinfo(dns resolver) N)_patch_create_connection_patch_getaddrinfoo/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/sentry_sdk/integrations/socket.py setup_oncezSocketIntegration.setup_onces" !"""rN)__name__ __module__ __qualname__ identifier staticmethodrrrrrrs2J\rcn |}n#ttf$rYnwxYw|d|}|S)N:)decodeUnicodeDecodeErrorAttributeError)hostport descriptions r_get_span_descriptionr%sS {{}}  /     "TT44(K s ++c\tjtjdffd }|t_dS)Nctj}|t|||S|t jt|d|d5}|d||d||d||||cdddS#1swxYwYdS)N)addresstimeoutsource_addressropr$r(r)r*) rcurrentget_integrationr start_spanrSOCKET_CONNECTIONr%set_data)r(r)r*hubspanreal_create_connections rcreate_connectionz3_patch_create_connection..create_connection.s5 k   0 1 1 9)) ^^#-gaj'!*EE   MM)W - - - MM)W - - - MM*N ; ; ;))                  s1ACCC)rr6_GLOBAL_DEFAULT_TIMEOUT)r6r5s @rrr*sE#5.0 1FrcDtjdfd }|t_dS)Nrc ztj}|t||||||S|t jt||5}|d||d|||||||cdddS#1swxYwYdS)Nr,r"r#) rr.r/rr0r SOCKET_DNSr%r2) r"r#familytypeprotoflagsr3r4real_getaddrinfos r getaddrinfoz'_patch_getaddrinfo..getaddrinfoMsk   0 1 1 9##D$eUKK K ^^}*?d*K*K   L  MM&$ ' ' ' MM&$ ' ' '##D$eUKK  L L L L L L L L L L L L L L L L L Ls'rHs&&&&&& """""" //////400000000333333333333             111>%%%%%r