Ë
    S>{i  ã                   ó
  — d dl Z d dlmZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZmZ d dlmZmZ erd dlmZmZmZ d d	lmZ 	 d d
lmZmZ 	 d dlZdZ G d„ de«      Zd„ Zd„ Zy# e	$ r	  e	d«      ‚w xY w# e$ r	  e	d«      ‚w xY w)é    N)Údeepcopy)ÚTYPE_CHECKING)ÚHubÚ_should_send_default_pii)ÚDidNotEnable)ÚSOURCE_FOR_STYLEÚTRANSACTION_SOURCE_ROUTE)Útransaction_from_functionÚlogger)ÚAnyÚCallableÚDict)ÚScope)ÚStarletteIntegrationÚStarletteRequestExtractorzStarlette is not installedzFastAPI is not installedzgeneric FastAPI requestc                   ó    — e Zd ZdZed„ «       Zy)ÚFastApiIntegrationÚfastapic                  ó   — t        «        y ©N)Úpatch_get_request_handler© ó    ú]/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sentry_sdk/integrations/fastapi.pyÚ
setup_oncezFastApiIntegration.setup_once"   s
   € ô 	"Õ#r   N)Ú__name__Ú
__module__Ú__qualname__Ú
identifierÚstaticmethodr   r   r   r   r   r      s   „ Ø€Jàñ$ó ñ$r   r   c                 óV  — d}|dk(  r-|j                   j                  d«      }|rCt        |«      xs d}n3|dk(  r.|j                   j                  d«      }|rt        |dd «      }|�|}|st        }t
        }n	t        |   }| j                  ||¬«       t        j                  d||«       y )NÚ ÚendpointÚurlÚrouteÚpath)Úsourcez;[FastAPI] Set transaction name and source on scope: %s / %s)
ÚscopeÚgetr
   ÚgetattrÚ_DEFAULT_TRANSACTION_NAMEr	   r   Úset_transaction_namer   Údebug)r(   Útransaction_styleÚrequestÚnamer#   r%   r&   r'   s           r   Ú _set_transaction_name_and_sourcer1   (   s«   € à€Dà˜JÒ&Ø—=‘=×$Ñ$ ZÓ0ˆÙÜ,¨XÓ6Ò<¸"‰Dà	˜eÒ	#Ø—‘×!Ñ! 'Ó*ˆÙÜ˜5 &¨$Ó/ˆDØÐØ�áÜ(ˆÜ)‰ä!Ð"3Ñ4ˆà	×Ñ˜t¨FÐÔ3Ü
‡L�LØEÀtÈVõr   c                  ón   ‡— t         j                  j                  Šˆfd„} | t         j                  _        y )Nc                  óÒ   •‡‡— |j                  d«      }|rC|j                  �7t        j                  |j                  «      s|j                  Šˆfd„}||_         ‰| i |¤ŽŠˆfd„}|S )NÚ	dependantc                  óÌ   •— t         j                  }|j                  «       5 }|j                  �|j                  j	                  «         ‰| i |¤Žcd d d «       S # 1 sw Y   y xY wr   )r   ÚcurrentÚconfigure_scopeÚprofileÚupdate_active_thread_id)ÚargsÚkwargsÚhubÚsentry_scopeÚold_calls       €r   Ú_sentry_callzTpatch_get_request_handler.<locals>._sentry_get_request_handler.<locals>._sentry_callR   sZ   ø€ ä—k‘k�Ø×(Ñ(Ó*ð 5¨lØ#×+Ñ+Ð7Ø$×,Ñ,×DÑDÔFÙ# TÐ4¨VÑ4÷5÷ 5ò 5ús   ¢.AÁA#c               Ÿ   óÔ  •‡K  — t         j                  }|j                  t        «      }|€ ‰	| i |¤Žƒ d {  –—† S |j	                  «       5 }| d   }t        ||j                  |«       t        |«      }|j                  «       ƒ d {  –—† Šˆfd„}t        j                  |_
        |j                   |||«      «       d d d «        ‰	| i |¤Žƒ d {  –—† S 7 Œž7 ŒP# 1 sw Y   ŒxY w7 Œ­w)Nr   c                 ó   •— ˆfd„}|S )Nc                 ó�   •— | j                  di «      }‰r"d‰v rt        «       r‰d   |d<   d‰v r‰d   |d<   t        |«      | d<   | S )Nr/   ÚcookiesÚdata)r)   r   r   )ÚeventÚhintÚrequest_infoÚinfos      €r   Úevent_processorz“patch_get_request_handler.<locals>._sentry_get_request_handler.<locals>._sentry_app.<locals>._make_request_event_processor.<locals>.event_processorq   s]   ø€ ð (-§y¡y°¸BÓ'?˜ÙØ(¨DÑ0Ô5MÔ5OØ:>¸y¹/ ¨YÑ 7Ø%¨™~Ø7;¸F±| ¨VÑ 4Ü+3°LÓ+A˜˜iÑ(à$˜r   r   )ÚreqÚintegrationrI   rH   s      €r   Ú_make_request_event_processorzzpatch_get_request_handler.<locals>._sentry_get_request_handler.<locals>._sentry_app.<locals>._make_request_event_processoro   s   ø€ ô%ð +Ð*r   )r   r6   Úget_integrationr   r7   r1   r.   r   Úextract_request_infor   Ú_nameÚadd_event_processor)
r:   r;   r<   rK   r=   r/   Ú	extractorrL   rH   Úold_apps
           @€r   Ú_sentry_appzSpatch_get_request_handler.<locals>._sentry_get_request_handler.<locals>._sentry_app^   sî   ùè ø€ ä—+‘+ˆCØ×-Ñ-Ô.@ÓAˆKØÐ"Ù$ dÐ5¨fÑ5×5Ð5à×$Ñ$Ó&ð ¨,Ø˜q™'�ä0Ø  +×"?Ñ"?Àôô 6°gÓ>�	Ø&×;Ñ;Ó=×=�ô+ô$ &8×%BÑ%B�Ô"Ø×0Ñ0Ù1°'¸;ÓGô÷;ñB ! $Ð1¨&Ñ1×1Ð1ðG 6øð >ø÷ð úðB 2úsE   „3C(·C¸C(Á;CÂCÂ6CÂ>C(ÃC&ÃC(ÃCÃC#ÃC()r)   ÚcallÚasyncioÚiscoroutinefunction)r:   r;   r4   r?   rS   rR   r>   Úold_get_request_handlers        @@€r   Ú_sentry_get_request_handlerz>patch_get_request_handler.<locals>._sentry_get_request_handlerH   sd   ú€ à—J‘J˜{Ó+ˆ	áØ—‘Ð*Ü×/Ñ/°	·±Ô?à —~‘~ˆHô5ð *ˆIŒNá)¨4Ð:°6Ñ:ˆô(	2ðT Ðr   )r   ÚroutingÚget_request_handler)rX   rW   s    @r   r   r   D   s)   ø€ ä%Ÿo™o×AÑAÐô@ðD +F„G‡O�OÕ'r   )rU   Úcopyr   Úsentry_sdk._typesr   Úsentry_sdk.hubr   r   Úsentry_sdk.integrationsr   Úsentry_sdk.tracingr   r	   Úsentry_sdk.utilsr
   r   Útypingr   r   r   Úsentry_sdk.scoper   Ú!sentry_sdk.integrations.starletter   r   r   ÚImportErrorr+   r   r1   r   r   r   r   ú<module>re      s“   ðÛ Ý å +ß 8Ý 0ß Iß >áß*Ñ*Ý&ð5÷ð3Ûð
 6Ð ô$Ð-ô $òó8FFøðc ò 5Ù
Ð3Ó
4Ð4ð5ûð
 ò 3Ù
Ð1Ó
2Ð2ð3ús   ÁA# ÁA4 Á#A1Á4B