
    fis                        d dl Z d dlZd dlZd dl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mZmZmZ d dlZd dlZd dlmZmZ d dlmZ d dlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' d d	l(m)Z) d d
l*m+Z+ d dl,m-Z-m.Z. d dl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 d dl6m7Z7m8Z8 d dl9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@ d dlAmBZBmCZCmDZD d dlEmFZF d dlGmHZH erqd dl
mIZI d dl
mJZJ d dl
mKZK d dl
mLZL d dl
mMZM d dl
mNZN d dl
mOZO d dlPmQZQmRZRmSZSmTZTmUZUmVZV d dl6mWZW d dlXmYZY d dlZm[Z[ d d l\m]Z] d d!l,m^Z^ d d"l_m`Z` d dlmZ  eOd#eW$          Za ed%          Zbd&e4d'e4d(gd)Zcd* Zd	 eeZfn# eg$ r ehZfY nw xY w G d+ d,          Zi G d- d.ei          Zj G d/ d0ei          Zkd d1l
mZ er( G d2 d3e5eeleIf                   Zm G d4 d5e5ek          ZndS  d6             Zm d7             ZndS )8    N)Mapping)datetimetimezone)import_module)TYPE_CHECKINGListDictcastoverload)PY37check_uwsgi_thread_support)MetricsBatcher)AnnotatedValue
ContextVarcapture_internal_exceptionscurrent_stacktraceenv_to_boolformat_timestampget_sdk_nameget_type_nameget_default_releasehandle_in_app	is_geventloggerget_before_send_logget_before_send_metrichas_logs_enabledhas_metrics_enabled)	serialize)trace)BaseHttpTransportmake_transport)SPANDATADEFAULT_MAX_VALUE_LENGTHDEFAULT_OPTIONSINSTRUMENTERVERSIONClientConstructor)_DEFAULT_INTEGRATIONSsetup_integrations)DedupeIntegration)SessionFlusher)Envelope)setup_continuous_profiler)has_profiling_enabledProfilesetup_profiler)EventScrubber)Monitor)Any)Callable)Optional)Sequence)Type)Union)TypeVar)EventHintSDKInfoLogMetricEventDataCategory)Integration)Scope)Session)SpotlightClient)	Transport
LogBatcherI)boundclient_init_debugzsentry.pythonzpypi:sentry-sdk)nameversion)rK   rL   packagesc                     | r=t          | d         t          t          f          s| d         | d         }| dd          } nd }t          |           dk    rt	          d          t          t                    }t          | i |}||                    d          ||d<   |                                D ] \  }}||vrt	          d|          |||<   !|d         "t          j
                            d          |d<   |d         t                      |d<   |d         $t          j
                            d	          pd
|d<   |d         3t          t          j
                            d          d          pd|d<   |d         +t          t          d          rt          j                    |d<   |d         t           j        |d<   |d         ,	 t          j                    }n# t&          $ r d }Y nw xY w||d<   |d         du r|d         d|d<   |d         #t)          |d         dn|d                   |d<   |d         r4t          |d         t*                    st-          j        d           d |d<   |d         3t          t          j
                            d          d          pd|d<   |d         t1          j        dt4          d            |S )!Nr      z+Only single positional argument is expecteddsnzUnknown option 
SENTRY_DSNreleaseenvironmentSENTRY_ENVIRONMENT
productiondebugSENTRY_DEBUGTstrictFserver_namegethostnameinstrumenterproject_rootenable_tracingtraces_sample_rate      ?event_scrubbersend_default_pii)rb   socket_optionszxIgnoring socket_options because of unexpected format. See urllib3.HTTPConnection.socket_options for the expected format.
keep_aliveSENTRY_KEEP_ALIVEzVThe `enable_tracing` parameter is deprecated. Please use `traces_sample_rate` instead.   )
stacklevel)
isinstancebytesstrlen	TypeErrordictr%   getitemsosenvironr   r   hasattrsocketr[   r&   SENTRYgetcwd	Exceptionr2   listr   warningwarningswarnDeprecationWarning)argskwargsrP   rvoptionskeyvaluer]   s           a/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/sentry_sdk/client.py_get_optionsr   V   s4    DGeS\22 d1go1gABBx
4yy1}}EFFF	o		BD#F##G
7;;u--5mmoo  
Ub==)3389993	%yJNN<005		)}+--9	- JNN+?@@PL=	'{!"*.."@"@NNNWRW7	- WV]%C%C ".00=	.!)0>	.!	 9;;LL 	  	  	 LLL	  *>	
t##+?(@(H#& 	
#,./7R@R=S 
  
  
 

 $Jr2B/CT$J$J $ G	
 	
 	
  $	,
':;;DIIIRU 	< 

'd	
 	
 	
 	
 Is   G& &G54G5c                       e Zd ZdZdZddZd Zd Zed             Z	d Z
d Zd	 Zd
 Zd Zd Zered             Zed             Zd Zd Zd Zd Zd ZdS )
BaseClientzp
    .. versionadded:: 2.0.0

    The basic definition of a client that is used for sending data to Sentry.
    Nc                 ^    ||nt           | _        d | _        d | _        d | _        d | _        d S N)r%   r   	transportmonitorlog_batchermetrics_batcher)selfr   s     r   __init__zBaseClient.__init__   s6    ")"5ww?#    c                 
    di iS Nr    r   r|   r}   s      r   __getstate__zBaseClient.__getstate__   s    2r   c                     d S r   r   r   s      r   __setstate__zBaseClient.__setstate__       r   c                     d S r   r   r   s    r   rP   zBaseClient.dsn   s	     tr   c                     dS )NFr   r   s    r   should_send_default_piiz"BaseClient.should_send_default_pii   s    ur   c                     dS )u
        .. versionadded:: 2.0.0

        Returns whether the client is active (able to send data to Sentry)
        Fr   r   s    r   	is_activezBaseClient.is_active   s	     ur   c                     d S r   r   r   s      r   capture_eventzBaseClient.capture_event       tr   c                     d S r   r   )r   logs     r   _capture_logzBaseClient._capture_log   r   r   c                     d S r   r   )r   metrics     r   _capture_metriczBaseClient._capture_metric   r   r   c                     d S r   r   r   s      r   capture_sessionzBaseClient.capture_session   r   r   c                     d S r   r   r   name_or_classs     r   get_integrationzBaseClient.get_integration   	     Cr   c                     d S r   r   r   s     r   r   zBaseClient.get_integration   r   r   c                     d S r   r   r   s     r   r   zBaseClient.get_integration   r   r   c                     d S r   r   r   s      r   closezBaseClient.close   r   r   c                     d S r   r   r   s      r   flushzBaseClient.flush   r   r   c                     | S r   r   r   s    r   	__enter__zBaseClient.__enter__      r   c                     d S r   r   r   exc_type	exc_valuetbs       r   __exit__zBaseClient.__exit__  r   r   r   )__name__
__module____qualname____doc__	spotlightr   r   r   propertyrP   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      sU         I$ $ $ $       X              
		 	 
	 
	 	 
	            r   r   c                       e Zd ZdZdS )NonRecordingClientz
    .. versionadded:: 2.0.0

    A client that does not send any events to Sentry. This is used as a fallback when the Sentry SDK is not yet initialized.
    N)r   r   r   r   r   r   r   r   r   
  s          	Dr   r   c                        e Zd ZdZ fdZd Zd Zd Zd Zd Z	d Z
ed	             Zd
 Zd Z	 ddZd Zd Z	 	 ddZd Zd Zd Zered             Zed             Zd Z	 	 ddZ	 	 ddZd Zd Z xZS )_ClientaI  
    The client is internally responsible for capturing the events and
    forwarding them to sentry through the configured transport.  It takes
    the client options as keyword arguments and optionally the DSN as first
    argument.

    Alias of :py:class:`sentry_sdk.Client`. (Was created for better intelisense support)
    c                     t          t          |                               t          |i |           |                                  d S )Nr   )superr   r   get_options
_init_impl)r   r|   r}   	__class__s      r   r   z_Client.__init__  sG    gt%%k4.J6.J.J%KKKr   c                     d| j         iS r   r   r   s    r   r   z_Client.__getstate__#  s    4<((r   c                 H    |d         | _         |                                  d S r   )r   r   )r   states     r   r   z_Client.__setstate__'  s$    Y'r   c                 ^   |D ]}d}|d         }|                     dd          \  }}	 t          |          }t          ||          }t          ||t	          |                     t          j        d|           z# t          $ r 	 |                     dd          \  }}t          |          }t          ||          }	t          |	|          }t          |	j	        |                   }
t	          |          }|
t          t          fv rt          |          }t          |	||           t          |||	           t          j        d|           n-# t          $ r }t          j        d||           Y d}~nd}~ww xY wY }t          $ r!}t          j        d||           Y d}~d}~ww xY wdS )z
        Instruments the functions given in the list `functions_to_trace` with the `@sentry_sdk.tracing.trace` decorator.
        Nqualified_name.rO   zEnabled tracing for %szWCan not enable tracing for '%s'. (%s) Please check your `functions_to_trace` parameter.)rsplitr   getattrsetattrr    r   rV   module_not_found_errortype__dict__staticmethodclassmethodrv   rx   )r   functions_to_tracefunction
class_namefunction_qualnamemodule_namefunction_name
module_objfunction_obj	class_objfunction_typetraced_functiones                r   _setup_instrumentationz_Client._setup_instrumentation,  s#   
 + ,	 ,	HJ ()9 :):)A)A#q)I)I&K' +;77
&z=AA
M53F3FGGG57HIIII)    /:.@.@a.H.H+K!.{!;!;J '
J ? ?I#*9m#D#DL$();M)J$K$KM&+L&9&9O${(CCC*6*G*GI}oFFFJ
I>>>L!9;LMMMM    Nq)           m%       O,	 ,	sI   AA==
F*CEF*
E:E50F*5E::F* 	F*	F%%F*c                     t                               d          } fd}	 d) fd	}	 t                                j        d                    t	           j                   _        d  _         j        r& j        d         rt           j                   _        t          |           _	        d  _
        t           j                  rdd	lm}  |||
           _
        d  _        t           j                  rt!          ||
           _        d} j        d         |vr"t#          d                    |                     j        d                             dd          rEt'          j        d           t*          j         j        d<   dt.          vrt/          j        d           t3           j        d          j        d          j        d          j        d          j                   _         j                            d          }|?dt6          j        v r1t6          j        d         }t;          |d          }||n| j        d<    j                            d          rSddlm}  | j                   _          j        d         s+d }	d j        d<   |	 j        d <   |	 j        d!<   |	 j        d"<   tC          tE           j        #                                                    }
|
tH          d#<   t'          j        d$|
           tK           j                  rB	 tM           j                   nv# tN          $ r}t'          j        d%|           Y d }~nRd }~ww xY w	 tQ           j        tH          |&           n,# tN          $ r}t'          j        d'|           Y d }~nd }~ww xY wt                               |           n# t                               |           w xY w )                     j                            d(g                       j        s5 j
        s.tK           j                  stU           j        tV                    rtY                       d S d S )*NFc                 N    j         j                             |            d S d S r   )r   capture_envelope)enveloper   s    r   _capture_envelopez-_Client._init_impl.<locals>._capture_envelopec  s/    ~)//99999 *)r   rO   c                 T    j         j                             | ||           d S d S )Nreasondata_categoryquantity)r   record_lost_event)r   r   r   r   s      r   _record_lost_eventz._Client._init_impl.<locals>._record_lost_eventh  sG     ~)00!"/% 1      *)r   rV   enable_backpressure_handling)capture_funcr   rF   )r   record_lost_func)alwaysneversmallmediummax_request_body_sizez:Invalid value for max_request_body_size. Must be one of {}_experimentsotel_powered_performancezA[OTel] Enabling experimental OTel-powered performance monitoring.r\   zJsentry_sdk.integrations.opentelemetry.integration.OpenTelemetryIntegrationintegrationsdefault_integrationsauto_enabling_integrationsdisabled_integrations)with_defaultswith_auto_enabling_integrationsr  r   r   SENTRY_SPOTLIGHTTrX   )setup_spotlightrP   c                      dS )Nr`   r   )_args_kwargss     r   <lambda>z$_Client._init_impl.<locals>.<lambda>  s    3 r   rb   error_samplertraces_samplerprofiles_samplerrK   zSetting SDK name to '%s'zCan not set up profiler. (%s))sdk_infor   z(Can not set up continuous profiler. (%s)r   )rO   )-_client_init_debugrn   setr   r"   r   r   r3   r,   session_flusherr   r   sentry_sdk._log_batcherrG   r   r   r   
ValueErrorformatr   rV   r&   OTELr)   appendr*   r   rp   rq   r   sentry_sdk.spotlightr  r   r   rw   keysSDK_INFOr/   r1   rv   r.   r   rh   r!   r   )r   	old_debugr   r   rG   r   spotlight_configspotlight_env_valuer  
sample_allsdk_namer   s   `           r   r   z_Client._init_impl_  s/   &**511		: 	: 	: 	: 	: 	 	 	 	 	 	f	.""4<#8999+DL99DNDL~ ;< >? ;#*4>#:#:DL#1?P#Q#Q#QD #D-- >>>>>>#-:!2%7$ $ $ 
 $(D "4<00 '5!2%7( ( ($
 %K!|34<QQQ PWW-    |N+//0JERR W   0</@^,`01 1 *0d   !3^,"l+AB0401 '+l3J&K! ! !D  $|//<<',>"*,L,L&(j1C&D##./B4#P#P#P  (3 %$, [) |,, B A@@@@@!0!>!>|E* B!>!>J7;DL!344>DL15?DL!127ADL!34#D):)?)?)A)A$B$BCCH'HVL3X>>>$T\22 PE"4<0000  E E EL!@!DDDDDDDDEP-!)%6    
 ! P P PL!KQOOOOOOOOP ""9----""9----##DL$4$45I2$N$NOOO L	)	) %T\22	) $.*;<<		) '(((((	) 	)s`   K<O &L; :O ;
M$MO M$$O (N O 
N.N)$O )N..O O(c                     dS )r   Tr   r   s    r   r   z_Client.is_active  s	     tr   c                 :    | j                             d          pdS )z
        .. versionadded:: 2.0.0

        Returns whether the client should send default PII (Personally Identifiable Information) data to Sentry.
        rb   F)r   rn   r   s    r   r   z_Client.should_send_default_pii  s      | 233<u<r   c                     | j         d         S )z%Returns the configured DSN as string.rP   r   r   s    r   rP   z_Client.dsn  s     |E""r   c                    d }d }|                     d          !t          j        t          j                  |d<   |                     d          dk    }|t          t          t          t          t          t          f                  |                     dg                               }|                    ||| j                  }|K| j        rB| j                            d|rdnd           |r | j                            dd|d	z   
           d S |}|t          t          t          t          t          t          f                  |                     dg                               z
  }	|r*|	dk    r$| j        | j                            dd|	
           |                    dd          |	z   }
|
dk    r||
z   }|j        dk    rZ|                     di           }t#          |t$                    s|                     dg           ng }t          |          |j        z   }|s| j        d         rd|vrd|vr|d|vrxt'                      5  dt)          | j                             dd          | j                             dt*                              dddgi|d<   d d d            n# 1 swxY w Y   dD ]S}|                     |          <| j        |         /t          | j        |                                                   ||<   T|                     d          Bt/          t0                    }t3          | j                                                  |d<   ||d<   |                     d          d|d<   t9          || j        d         | j        d         | j        d                    }|$| j        d!         }|r|                    |           ||j        r|                     dg           }t#          |t>                    r|D ]}|                     d"d           }|                     d#i           }|rQ||j        v rHt@          j!        |v r:t%          |t@          j!                 d$|j        |         i          |t@          j!        <   |)t%          |                     dg           d$|i          |d<   |+t%          |                     ddg i          d$|i          |d<   |wt          d%tE          t          d&|          | j                             d'          | j                             d          | j                             d(          )                    }| j        d*         }|||                     d          dk    rd }t'                      5   |||pi           }d d d            n# 1 swxY w Y   |_tG          j$        d+           | j        r| j                            d*d           |                     d          rtK          j&                     |}| j        d,         }|R|O|                     d          dk    r5d }t          t          t          t          t          t          f                  |                     dg                               }t'                      5   |||pi           }d d d            n# 1 swxY w Y   |XtG          j$        d-           | j        r<| j                            d*d.           | j                            d*d|d	z   /           nP|t          |                     dg                     z
  }	|	dk    r$| j        | j                            d*d|	/           |}|S )0N	timestampr   transactionspansevent_processorerrorr   spanrO   )r   r   r   _dropped_spansbreadcrumbsvaluesattach_stacktrace	exception
stacktracethreadsinclude_local_variablesTmax_value_length)r0  r1  F)r.  crashedcurrent)rR   rS   rZ   distsdkr   platformpythonin_app_excludein_app_includer]   ra   span_iddatark   r;   zDict[str, Any]r   custom_repr)r   r1  r<  before_sendzbefore send dropped eventbefore_send_transactionz%before send transaction dropped event)r   r   r   )'rn   r   nowr   utcrk   r
   r   r	   rj   objectapply_to_eventr   r   r   pop_n_breadcrumbs_truncatedrh   r   r   r   r$   striprm   r  sortedr   r  r   scrub_event_gen_ai_original_message_countrw   r#   GEN_AI_REQUEST_MESSAGESr   r   infor+   reset_last_seen)r   eventhintscopeprevious_total_spansprevious_total_breadcrumbsis_transactionspans_beforeevent_spans_deltadropped_spansr*  r+  r   r  ra   r$  r(  r:  	span_datar=  	new_eventr>  s                          r   _prepare_eventz_Client._prepare_event  s     $%)"99[!!)!)hl!;!;E+6**m;tDc6k):$;UYYwPR=S=STTUUL))%t|DDF ~> 
N44)8F'S}}G 5    & 88-*0%1A%5 9   
 tE&T$sF{+,eii.D.DEE* * K  +//dn6P00%Vk 1    "II&6::[HMq  '3m'C$-11#iir:: &k>BBKOOHb111  KK%"@@ +
 	01	 5((E))&&,..  *<8<8H8H$=t9" 9" 261A1A$68P2" 2"	+ + + (-'+ $i               $ C 	< 	<Cyy~~%$,s*;*G c!23399;;c
99U#H~~H'-d.?.D.D.F.F'G'GH^$#E%L99Z  ( (E*L)*L)*L(	
 
 !\*:;N 2**5111!EIIgr**E%&& !  D"hhy$77G $ 4 4I#u'KKK$<	IIFT%h&FG"E$H$QRG G	("BC  ++		'2&&0D(E E'N &1#1		-(B8823$ $E-  )511*.,*:*:;R*S*S%)\%5%56H%I%I $ 0 0 ? ?	   E l=1#!		&!!]22I,.. ; ;'Ktzr::	; ; ; ; ; ; ; ; ; ; ; ; ; ; ; 7888> N44%W 5    99[)) 8%5777E"&,/H"I#/!		&!!]22ItDc6k):$;UYYwPR=S=STTUUL,.. G G33E4:2FF	G G G G G G G G G G G G G G G CDDD> N44,M 5    N44,&,!-!1 5    +Sw1K1K-L-LL??t~'AN44,F[ 5    Es7   	AJ((J,/J,V11V58V5/[

[[c                 &   |                     d          }|dS |d         }t          |d                   }|d         j        d|}| j        d         D ]:}t	          |t
                    r||k    s||k    r dS 't          ||          r dS ;dS )Nexc_infoFr   r   ignore_errorsT)rn   r   r   r   rh   rj   
issubclass)r   rL  rM  rZ  r&  error_type_nameerror_full_nameignored_errors           r   _is_ignored_errorz_Client._is_ignored_error  s    88J''5'44%-a[%;%;%;__M!\/: 	  	 M ---   O33}7W7W44 8X e]33  44  ur   Nc                     |                     d          dk    }|rdS |d uo|j         }|rdS |                     ||          }|rdS dS )Nr   r#  TF)rn   _should_capturer`  )r   rL  rM  rN  rQ  ignoring_prevents_recursionignored_by_config_options          r   rb  z_Client._should_capture  sr     6**m; 	4&+4&7&U@U<U#& 	5#'#9#9%#F#F # 	5tr   c                 N   | j                             dd           }t          |          r3t                      5   |||          }d d d            n# 1 swxY w Y   n| j         d         }	 |dk     ot	          j                    |k    }nt# t
          $ r t          j        d           d}Y nRt          $ rF t          |          rdnd\  }}t          j        d|d	|d
t          |          d           d}Y nw xY w|r%| j
        r| j
                            dd           dS dS )Nr
  sample_rater`   zMThe provided error_sampler raised an error. Defaulting to sampling the event.F)r
  returned)rf  containszThe provided  z an invalid value of zJ. The value should be a float or a bool. Defaulting to sampling the event.r&  r'  T)r   rn   callabler   random	NameErrorr   rx   rl   reprr   r   )r   rL  rM  r
  rf  not_in_sample_rate	parameterverbs           r   _should_sample_errorz_Client._should_sample_error  s    (($??M"" 	6,.. 9 9+mE4889 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ,}5K	'!,s!2!Uv}+7U 	' 	' 	'N_   "' 	' 	' 	' M**1--0 It
 NN99dddD$5$5$5$57   "'	'  	~ W00g0VVV5ts*   AAA,B
 
 C;,AC;:C;c                    d}d}d }|                     d          pi                      d          }|rjd}|D ]e}t          |t                    r	|j        pi }|                     d          }t          |t                    r|                     d          du rd} nf|                     d          }	|j        y|                     d          pi                      d	          }
t          |
t                    r|
ni }|                                D ]!\  }}|                                d
k    r|} n"|	                    |rdnd |	||j
        |p|z              d S )NFr-  r+  T	mechanismhandleduserrequestheadersz
user-agentr2  )statusru  
user_agenterrors)rn   rh   r   r   r   ry  rm   ro   lowerupdaterz  )r   sessionrL  r2  erroredry  
exceptionsr&  rs  ru  rw  headers_dictkvs                 r   _update_session_from_eventz"_Client._update_session_from_event&  s    
ii,,277AA
 	G#  e^44 .!K-2E!IIk22	i11 immI6N6NRW6W6W"GEyy  %yy++1r66yAAG&0$&?&?G77RL$**,,  17799,,!"JE - 	 '199T!>W%78	 	 	
 	
 	
 	
 	
r   c                 D   t          |pd          }|                     |||          sdS |                    dd          }|                    d          }|t	          j                    j        x|d<   }|                     |||          }|dS |r|j        nd}|r| 	                    ||           |                    d          dk    }|                    d          dk    }	|s|	s| 
                    ||          sdS |                    d          }
|                    d	i                               d
          pi }|                    di           }|d         t          t          j        t          j                            d}|r||d
<   t!          |          }|rYt#          |t$                    r.|                    |                    || j                             |                    |           n-|	r|                    |           n|                    |           |
pdD ])}|                    |                                           *d}| j        r| j                            |           |}| j        | j                            |           |}|S )a  Captures an event.

        :param event: A ready-made event that can be directly sent to Sentry.

        :param hint: Contains metadata about the event that can be read from `before_send`, such as the original exception object or a HTTP request object.

        :param scope: An optional :py:class:`sentry_sdk.Scope` to apply to events.

        :returns: An event ID. May be `None` if there is no DSN set or of if the SDK decided to discard the event for other reasons. In such situations setting `debug=True` on `init()` may help.
        r   Nprofileevent_idr   r#  check_inattachmentscontextsr    dynamic_sampling_context)r  sent_at)rw  )rm   rb  rC  rn   uuiduuid4hexrX  _sessionr  rq  r   r   r?  r   r@  r-   rh   r0   add_profileto_jsonr   add_transactionadd_checkin	add_eventadd_itemto_envelope_itemr   r   r   )r   rL  rM  rN  r  r  	event_optr}  rQ  
is_checkinr  trace_contextr  rw  r   
attachmentreturn_values                    r   r   z_Client.capture_eventM  s   " DJB##E477 	4))It,,99Z((+/:<<+;;E*''tU;;	4 %*3%..t 	<++GU;;;"v..-?]]6**j8
 		 --eT::	
 4hh}--!j"5599'BBHb#0#4#45OQS#T#T  "*-'X\(B(BCC
 

 $ 	87GGG,,, 	*'7++ O$$W__Y%M%MNNN$$Y//// 	*  ++++y)))%+ 	= 	=Jj99;;<<<<> 	$N++H555#L>%N++H555#Lr   c                    t          | j                  r|d S t          j                    }t          j                    }t
          d         |d         d<   t
          d         |d         d<   | j                            d          }|)t          j        |d         vr||d         t          j        <   | j                            d          }|d|d         vr||d         d<   | j                            d	          }|d
|d         vr||d         d
<   |	                                }|                    d          }|                    d          }	||                    d          ||d<   |	d|d         vr|	|d         d<   |j
        1dD ].\  }
}||j
        v r |
|d         vr|j
        |         |d         |
<   /| j                            dd          }|r@t          j        d|                    d           d|                    d                      t          | j                  }| ||i           }|d S | j        r| j                            |           d S d S )NrK   
attributessentry.sdk.namerL   sentry.sdk.versionrZ   rS   sentry.environmentrR   sentry.releasetrace_idr:  zsentry.trace.parent_span_id)zuser.idid)z	user.nameusername)z
user.emailemailrV   Fz[Sentry Logs] [severity_text] body)r   r   
sentry_sdkget_current_scopeget_isolation_scoper  rn   r#   SERVER_ADDRESSget_trace_context_userr   rV   r   r   add)r   r   current_scopeisolation_scoperZ   rS   rR   r  r  r:  log_attributeuser_attributerV   before_send_logs                 r   r   z_Client._capture_log  s   -- 	F"466$8::/7/?L+,2:92EL./l&&}55"x'>c,FW'W'W9DCh56l&&}55"';3|CT'T'T6AC23,""9--#33|;L#L#L29C./%7799 $$Z00##I..CGGJ$7$7$?&C
O -S5FFF?FC;<  ,2  -~ #o&;;;%S->>>7F7L&8C%m4
   %00 	LO#''/":":OOcggfooOO   .dl;;&!/#r**C;F 	&  %%%%%	& 	&r   c           
         t          | j                  r|d S t          j                    }t          j                    }t
          d         |d         d<   t
          d         |d         d<   | j                            d          }|)t          j        |d         vr||d         t          j        <   | j                            d          }|d|d         vr||d         d<   | j                            d	          }|d
|d         vr||d         d
<   |	                                }|                    d          }|                    d          }	|pd|d<   |	|	|d<   |j
        1dD ].\  }
}||j
        v r |
|d         vr|j
        |         |d         |
<   /| j                            dd          }|rVt          j        d|                    d           d|                    d           d|                    d                      t          | j                  }| ||i           }|d S | j        r| j                            |           d S d S )NrK   r  r  rL   r  rZ   rS   r  rR   r  r  r:  z$00000000-0000-0000-0000-000000000000r  rV   Fz[Sentry Metrics] [r   r  z: r   )r   r   r  r  r  r  rn   r#   r  r  r  r   rV   r   r   r  )r   r   r  r  rZ   rS   rR   r  r  r:  metric_attributer  rV   before_send_metrics                 r   r   z_Client._capture_metric  s   "4<00 	FNF"466$8::2:62B|./5=i5H|12l&&}55#'vl/CCC<GF< !89l&&}55"';6,CW'W'W9DF< !56,""9--#36,;O#O#O5<F< !12%7799 $$Z00##I..%O)Oz 'F9 ,5  0 . #o&;;;(|0DDD=L=R&>F<()9:   %00 	LfVZZ%7%7ff6::f;M;MffQWQ[Q[\cQdQdff   4DLAA)''33F>F 	- $$V,,,,,	- 	-r   c                 t    |j         st          j        d           d S | j                            |           d S )Nz3Discarded session update because of missing release)rR   r   rJ  r  add_session)r   r}  s     r   r   z_Client.capture_session&  sB    
  	6KMNNNNN ,,W55555r   c                     d S r   r   r   s     r   r   z_Client.get_integration2  r   r   c                     d S r   r   r   s     r   r   z_Client.get_integration7  r   r   c                     t          |t                    r|}n|j        |j        }nt          d          | j                            |          S )zReturns the integration for this client by name or class.
        If the client does not have that integration then `None` is returned.
        NzIntegration has no name)rh   rj   
identifierr  r   rn   )r   r   integration_names      r   r   z_Client.get_integration<  s[     mS)) 	8,%1,76777 $$%5666r   c                 x   | j         |                     ||           | j                                         | j        | j                                         | j        | j                                         | j        r| j                                         | j                                          d| _         dS dS )z
        Close the client and shut down the transport. Arguments have the same
        semantics as :py:meth:`Client.flush`.
        Ntimeoutcallback)r   r   r  killr   r   r   r   r  r  s      r   r   z_Client.closeM  s     >%JJwJ::: %%'''+ %%'''#/$))+++| $!!###N!!!!DNNN &%r   c                     | j         || j        d         }| j                                         | j        | j                                         | j        | j                                         | j                             ||           dS dS )a#  
        Wait for the current events to be sent.

        :param timeout: Wait for at most `timeout` seconds. If no `timeout` is provided, the `shutdown_timeout` option value is used.

        :param callback: Is invoked with the number of pending events and the configured timeout.
        Nshutdown_timeoutr  )r   r   r  r   r   r   r  s      r   r   z_Client.flushc  s     >%,'9: &&(((+ &&(((#/$**,,,N  8 DDDDD &%r   c                     | S r   r   r   s    r   r   z_Client.__enter__z  r   r   c                 .    |                                   d S r   )r   r   s       r   r   z_Client.__exit__~  s    

r   r   )NN)r   r   r   r   r   r   r   r   r   r   r   r   rP   rX  r`  rb  rq  r  r   r   r   r   r   r   r   r   r   r   r   __classcell__)r   s   @r   r   r     s            
) ) )  
1 1 1fH) H) H)T  = = = # # X#
G G GR  4 	   ,. . .`%
 %
 %
T 	S S S SjB& B& B&H>- >- >-@6 6 6  
		 	 
	 
	 	 
	7 7 7& " " " "0 E E E E.        r   r   )r   c                       e Zd ZdS )r   Nr   r   r   r   r   r   r   r             r   r   c                       e Zd ZdS )ClientNr  r   r   r   r  r    r  r   r  c                      t           S r   )r   r   r   r   r	  r	    s    < r   c                      t           S r   )r   r   r   r   r	  r	    s    g r   )orp   r  rk  rs   collections.abcr   r   r   	importlibr   typingr   r   r	   r
   r   ry   r  sentry_sdk._compatr   r   sentry_sdk._metrics_batcherr   sentry_sdk.utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sentry_sdk.serializerr   sentry_sdk.tracingr    sentry_sdk.transportr!   r"   sentry_sdk.constsr#   r$   r%   r&   r'   r(   sentry_sdk.integrationsr)   r*   sentry_sdk.integrations.deduper+   sentry_sdk.sessionsr,   sentry_sdk.enveloper-   'sentry_sdk.profiler.continuous_profilerr.   (sentry_sdk.profiler.transaction_profilerr/   r0   r1   sentry_sdk.scrubberr2   sentry_sdk.monitorr3   r4   r5   r6   r7   r8   r9   r:   sentry_sdk._typesr;   r<   r=   r>   r?   r@   rA   sentry_sdk.scoperB   sentry_sdk.sessionrC   r  rD   rE   r  rG   rH   r  r  r   ModuleNotFoundErrorr   rv   ImportErrorr   r   r   rj   r   r  r   r   r   <module>r     s   				    # # # # # # ' ' ' ' ' ' ' ' # # # # # # < < < < < < < < < < < < < <      ? ? ? ? ? ? ? ? 6 6 6 6 6 6                                   $ , + + + + + $ $ $ $ $ $ B B B B B B B B                N M M M M M M M < < < < < < . . . . . . ( ( ( ( ( ( M M M M M M         
 . - - - - - & & & & & & (VVVVVVVVVVVVVVVV333333&&&&&&******444444......222222::::::;'''AZ 344  +@@A L L L^)0 ) ) )()
Z Z Z Z Z Z Z Zz	 	 	 	 	 	 	 	l l l l lj l l l^ !           !    'c3h       "G      (''**Koo  FFFs   E E E 