
    \j                     d   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZm	Z	 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 dlmZ d dlZd dlmZmZmZ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) d d	l*m+Z, d d
lm-Z- e-r6d dlm.Z. d dlm/Z/ d dlm0Z0 d dlm1Z1 d dlm2Z2 d dlm3Z3 d dlm4Z4 d dl5m6Z6 d dl7m8Z8  ejr                  d      Z:dZ; G d de      Z<ddde=fdZ>ddde=fdZ?e j                  	 	 dwddd dd!dd"d#d$e=d%e=d&eAdd'fd(       ZBe j                  	 	 dwddd dd!dd"d#d$e=d%e=d&eAdd)fd*       ZC	 	 	 	 	 	 dxd.ZDdyd/ZEd0e=d1d#d2d3d4d3d5d#d6d#de=fd7ZF	 	 	 	 	 	 	 	 	 	 dzd8ZG	 	 	 	 d{d9ZH	 	 	 	 d{d:ZI	 	 	 	 d|d;ZJddd<eAdd#fd=ZK G d> d?      ZL G d@ dA      ZMdBdCdDeAde=fdEZNd}dFZOdddej                  f	 	 	 	 	 	 	 	 	 d~dJZQ	 	 	 ddGd#dHddKe=ddfdLZR	 d	 	 	 ddMZSdddNZTdOdPdQd#dRdSdeUfdTZV	 	 	 	 	 	 ddUZWdVddWeAddXfdYZX	 ddIdZdGeAd[ddeAfd\ZYdIdZdeAfd]ZZdIdZd^e=d_d`d[daddaf
dbZ[ddcZ\dIdZd^e=dddddafdeZ]d-dfdIdZd^e=dGeAdgdd_d`d[daddfdhZ^d-dfdIdZd^e=dddddf
diZ_djdkde=fdlZ`dmdndoeAddfdpZadGeAdHdqd+d,ddrfdsZbdGeAdHdqde=fdtZcd dul*mdZdmeZemfZfm+Z+ d dvlgmhZhmiZimjZk e-rd d	l*m+Z+ yy# e$ r
 d dlmZ Y fw xY w)    N)MappingMutableMapping)datetime	timedeltatimezone)Random)quoteunquote)Pattern)OPSPANDATA
SPANSTATUSSPANTEMPLATE)capture_internal_exceptionsfilename_for_moduleloggermatch_regex_listqualname_from_function	safe_repr	to_stringtry_convertis_sentry_urlis_valid_sample_rate_is_external_source_is_in_project_root_module_in_list)Span)TYPE_CHECKING)Any)Dict)	Generator)Optional)Union)Iterator)Tuple)	FrameType)
Attributesz5^[ 	]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ 	]*$z(([a-zA-Z0-9+/]{4})*([a-zA-Z0-9+/]{2,3})?c                   H    e Zd Z	 ddddeddfdZdeddfd	Zdefd
ZddZy)EnvironHeadersenvironzMapping[str, str]prefixreturnNc                      || _         || _        y N)r*   r+   )selfr*   r+   s      B/root/env/lib/python3.12/site-packages/sentry_sdk/tracing_utils.py__init__zEnvironHeaders.__init__M   s    
     keyOptional[Any]c                 v    | j                   | j                  |j                  dd      j                         z      S N-_)r*   r+   replaceupper)r/   r3   s     r0   __getitem__zEnvironHeaders.__getitem__U   s.    ||DKK#++c3*?*E*E*GGHHr2   c                 8    t        d t        |       D              S )Nc              3       K   | ]  }d   yw)   N ).0r8   s     r0   	<genexpr>z)EnvironHeaders.__len__.<locals>.<genexpr>Y   s     )1)s   )sumiterr/   s    r0   __len__zEnvironHeaders.__len__X   s    )d4j)))r2   c              #      K   | j                   D ]i  }t        |t              s|j                  dd      j	                         }|j                  | j                        sP|t        | j                        d   k y wr6   )r*   
isinstancestrr9   r:   
startswithr+   len)r/   ks     r0   __iter__zEnvironHeaders.__iter__[   si      	(Aa%		#s#))+A<<,C$&''	(s   A:A<)HTTP_)r,   zGenerator[str, None, None])	__name__
__module____qualname__rH   r1   r;   intrE   rL   r?   r2   r0   r)   r)   L   sO     $  
	Is I I* *	(r2   r)   optionsOptional[Dict[str, Any]]r,   c                     | yt        | j                  d      duxr( | j                  d      duxs | j                  d      du      S )z}
    Returns True if either traces_sample_rate or traces_sampler is
    defined and enable_tracing is set and not false.
    NFenable_tracingtraces_sample_ratetraces_sampler)boolgetrR   s    r0   has_tracing_enabledr[   g   sY    
 $%U2 	
KK,-T9 9{{+,D8	 r2   Optional[dict[str, Any]]c                 V    | y| j                  d      xs i j                  d      dk(  S )NF_experimentstrace_lifecyclestream)rY   rZ   s    r0   has_span_streaming_enabledra   x   s/    KK'-2223DEQQr2   cursorr   queryparams_list
paramstyleOptional[str]executemanyrecord_cursor_reprspan_originz.Generator[sentry_sdk.tracing.Span, None, None]c              #   2  K   t        j                         j                  d   j                  dd      r|r|d gk(  rd }|dk(  rd}nd }d }t	        | |      }i }|||d<   |||d<   |rd|d	<   |r| | |d
<   t               5  t        j                  |d|       d d d        t        j                  t        j                  ||      5 }|j                         D ]  \  }	}
|j                  |	|
        | d d d        y # 1 sw Y   gxY w# 1 sw Y   y xY ww)Nr^   record_sql_paramsFpyformatformat	db.paramsdb.paramstyleTdb.executemany	db.cursorrc   messagecategorydataopnameorigin)
sentry_sdk
get_clientrR   rY   _format_sqlr   add_breadcrumb
start_spanr   DBitemsset_data)rb   rc   rd   re   rg   rh   ri   ru   spanrK   vs              r0   record_sql_queriesr      s?     &&~6::;NPUVkdV3K#!J
&ED'[ *_!%f0"[	$	& N!!%'MN 
		55
  
JJL 	 DAqMM!Q	 
 N N s6   A>D C?.D/D6	D?DDDDzUGenerator[Union[sentry_sdk.tracing.Span, sentry_sdk.traces.StreamedSpan], None, None]c              #      K   t        j                         }|j                  d   j                  dd      r|r|d gk(  rd }|dk(  rd}nd }d }t	        | |      }i }|||d<   |||d<   |rd|d	<   |r| | |d
<   t               5  t        j                  |d|       d d d        t        |j                        rDt         j                  j                  |dn||t        j                  d      5 }	|	 d d d        y t        j                  t        j                  ||      5 }	|j                         D ]  \  }
}|	j                  |
|        |	 d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w# 1 sw Y   y xY ww)Nr^   rk   Frl   rm   rn   ro   Trp   rq   rc   rr   z<unknown SQL query>)zsentry.originz	sentry.op)rx   
attributesrv   )rz   r{   rR   rY   r|   r   r}   ra   tracesr~   r   r   r   r   )rb   rc   rd   re   rg   rh   ri   clientru   r   rK   r   s               r0   'record_sql_queries_supporting_streamingr      s     ""$F~~n%))*=uEkdV3K#!J
&ED'[ *_!%f0"[	$	& N!!%'MN "&..1))*/-&U!,UU * 
 	 J	 	 ""uu
 	 

 $1a#$J	 	N N	 		 	sO   B E>EAE>.E&3/E>"/E2	E>E#E>&E/+E>2E;7E>scopesentry_sdk.Scoper   c                 \   |j                   t        j                  k(  r*| j                  |j                  dd|j
                         y |j                   t        j                  k(  rd }|j                  j                  t        j                        }|r!d|cxk  rdk  rn nd}nd|cxk  rdk  rn nd}|r | j                  d	d
|j                  |       y | j                  d	d
|j                         y |j                   dk(  r*| j                  dd|j                  |j                         y y )Nredis)rs   typert   ru   i  iW  errori  i  warninghttphttplib)r   rt   ru   level)r   rt   ru   
subprocess)r   rt   rs   ru   )rw   r   DB_REDISr}   description_tagsHTTP_CLIENT_datarY   r   HTTP_STATUS_CODE)r   r   r   status_codes       r0   "maybe_create_breadcrumbs_from_spanr      s    ww"++$$7W4:: 	 	
 
BNN	"jjnnX%>%>?k(S(*s*!  idjj !    fytzz R	L	 !$$	 	 	
 
!r2   c                 N    	 | j                   j                  S # t        $ r Y y w xY wr.   )f_codeco_filename	Exception)frames    r0   _get_frame_module_abs_pathr   	  s)    ||''' s    	$$is_sentry_sdk_frame	namespacein_app_includeOptional[list[str]]in_app_excludeabs_pathproject_rootc                     t        ||      }t        |      xs t        ||      }|  xr |xs t        ||      xr | S r.   )r   r   r   )r   r   r   r   r   r   should_be_includedshould_be_excludeds           r0   _should_be_includedr     s[     )NC,X6 />; #"  	T,7R@R<Rr2   c                    t        j                         }|at        |      }	 |j                  j	                  d      }|duxr |j                  d      }t        ||||||      }|rn|j                  }|ad}|	 |j                  }	|	Ct        | t              r!| j                  t        j                  |	       n| j                  d|	       	 |j                  j	                  d      }|Qt        | t              r!| j                  t        j                   |       n | j                  t        j                   |       t        |      }
|
|t#        ||
      }nE|A|
j                  |      r0|
j%                  |d      j'                  t(        j*                        }n|
}t        | t              r!| j                  t        j,                  |       n|| j                  d|       	 |j.                  j0                  }|zt        | t              r5| j                  t        j2                  |j.                  j0                         y| j                  t        j2                  |j.                  j0                         yyy# t
        $ r d}Y Iw xY w# t
        $ r d}	Y w xY w# t
        $ r d}Y w xY w# t
        $ r d}Y w xY w)zB
    Adds OTel compatible source code information to the span
    NrN   zsentry_sdk.)r   r   r   r   r   r   zcode.line.number zcode.file.path)sys	_getframer   	f_globalsrY   r   rI   r   f_backf_linenorG   
LegacySpanr   r   CODE_LINENOset_attributeCODE_NAMESPACEr   r9   lstripossepCODE_FILEPATHr   co_nameCODE_FUNCTION)r   r   r   r   r   r   r   r   r   linenofilepathin_app_pathcode_functions                r0   
add_sourcer   #  s    '*mmoE

-e4	).)<)<Z)HI (t3 
	8L8L9
 1 3))%
 / 
2  	^^F $
+h22F;""#5v>	++J7I  $
+h55yA""8#:#:IF-e4$1)XF)h.A.A,.O&..|R@GGO&$
+h44kB*&&'7E	!!LL00M $$
+h44ell6J6JK""8#9#95<<;O;OP	 %S /  	I	4  	F	  	I	2  	! M	!sG   I9 >J J %J/ 9JJJJJ,+J,/J=<J=c                 r   t        j                         }|j                         syt        | t              r| j
                  y| j                  y|j                  j                  dd      }|sy| j
                  #t        j                  t        j                        n| j
                  }|| j                  z
  }|j                  j                  dd      }|t        d      z  |kD  }|syt        | |j                  d   |j                  j                  d	      |j                  j                  d
             y)zO
    Adds OTel compatible source code information to a database query span
    Nenable_db_query_sourceTdb_query_source_threshold_msr   r>   millisecondsr   r   r   r   r   r   r   rz   r{   	is_activerG   r   	timestampstart_timestamprR   rY   r   nowr   utcr   r   )r   r   should_add_query_sourceend_timestampduration	threshold
slow_querys          r0   add_query_sourcer   z  s    ""$F$
# >>!#$nn001I4P" '+nn&<X\\"$..  t333H""#A1EII155	AJ^^N3~~))*:;~~))*:;	r2   c                 r   t        j                         }|j                         syt        | t              r| j
                  y| j                  y|j                  j                  dd      }|sy| j
                  #t        j                  t        j                        n| j
                  }|| j                  z
  }|j                  j                  dd      }|t        d      z  |kD  }|syt        | |j                  d   |j                  j                  d	      |j                  j                  d
             y)z]
    Adds OTel compatible source code information to a span for an outgoing HTTP request
    Nenable_http_request_sourceT http_request_source_threshold_msr   r>   r   r   r   r   r   r   )r   r   should_add_request_sourcer   r   r   r   s          r0   add_http_request_sourcer     s    ""$F$
# >>!# & 2 23OQU V$ '+nn&<X\\"$..  t333H""#EqIII155	AJ^^N3~~))*:;~~))*:;	r2   c                 @   | sy| j                  d      r| j                  d      r| dd } t        j                  |       }|sy|j	                         \  }}}d}|rdj                  t        |d            }|rdj                  t        |d            }|r|d	k7  }|||d
S )zL
    Given a `sentry-trace` header string, return a dictionary of data.
    Nz00-z-00   z{:032x}   z{:016x}0)trace_idparent_span_idparent_sampled)rI   endswithSENTRY_TRACE_REGEXmatchgroupsrm   rQ   )headerr   r   r   sampled_strr   s         r0   extract_sentrytrace_datar     s     FOOE$:"$$V,E,1LLN)HnkN##C"$56"))#nb*AB$+ (( r2   sqlc                     d }	 t        | d      rF| j                  |      }t        |t              r%|j	                  | j
                  j                        }|xs t        |      S # t        $ r d }Y w xY w)Nmogrify)	hasattrr   rG   bytesdecode
connectionencodingr   r   )rb   r   real_sqls      r0   r|   r|     so    H69%~~c*H(E*#??6+<+<+E+EF %y~%  s   AA% %A32A3c                   H   e Zd ZdZdZ	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZe	 	 	 	 dd       Zede	fd       Z
e
j                  de	ddfd	       Z
ede	fd
       Zej                  de	ddfd       Zedd       Zde	fdZddZddZddZ	 	 	 	 ddZde	fdZddZddZy)PropagationContextzJ
    The PropagationContext represents the data of a trace in Sentry.
    )	_trace_id_span_idr   r   baggagecustom_sampling_contextNr,   c                     || _         	 || _        	 || _        	 || _        	 || _        	 	 ||t        |      | _        d | _        y r.   )r   r   r   r   r   Baggager   )r/   r   span_idr   r   dynamic_sampling_contextr   s          r0   r1   zPropagationContext.__init__  se     "/:,	H -	Q PN?7C"#;<DLCG$r2   c                 B   t               }t        |      }|j                  t              }t	        |      }||S |j                  t
              }|rt        j                  |      nd }t        |      s|S |j                  |       |r||_
        |j                          |S r.   )r   normalize_incoming_datarY   SENTRY_TRACE_HEADER_NAMEr   BAGGAGE_HEADER_NAMEr   from_incoming_header_should_continue_traceupdater   _fill_sample_rand)clsincoming_datapropagation_contextnormalized_datasentry_trace_headersentrytrace_databaggage_headerr   s           r0   from_incoming_dataz%PropagationContext.from_incoming_data2  s     121-@-112JK34GH #&&(,,-@A<JG((8PT 	 &g.&&""#34*1'--/""r2   c                 x    | j                   s#t        j                         j                  | _         | j                   S )z!The trace id of the Sentry trace.)r   uuiduuid4hexrD   s    r0   r   zPropagationContext.trace_idP  s(     ~~!ZZ\--DN~~r2   valuec                     || _         y r.   )r   r/   r  s     r0   r   zPropagationContext.trace_idY  s	    r2   c                 ~    | j                   s&t        j                         j                  dd | _         | j                   S )z+The span id of the currently executed span.r   N)r   r  r  r  rD   s    r0   r   zPropagationContext.span_id]  s/     }} JJL,,RS1DM}}r2   c                     || _         y r.   )r   r  s     r0   r   zPropagationContext.span_ide  s	    r2   c                 >    | j                         j                         S r.   )get_baggager   rD   s    r0   r   z+PropagationContext.dynamic_sampling_contexti  s    !::<<r2   c                 8    | j                    d| j                   S )Nr7   )r   r   rD   s    r0   to_traceparentz!PropagationContext.to_traceparentm  s    --$,,00r2   c                 f    | j                   t        j                  |       | _         | j                   S r.   )r   r   !populate_from_propagation_contextrD   s    r0   r  zPropagationContext.get_baggagep  s(    <<"DDTJDL||r2   c              #      K   t         | j                         f | j                         j                         }|rt        |f yyw)zw
        Creates a generator which returns the propagation_context's ``sentry-trace`` and ``baggage`` headers.
        N)r   r  r  	serializer   )r/   r   s     r0   iter_headerszPropagationContext.iter_headersu  sF      '(;(;(===""$..0%w.. s   AAc                 n    |j                         D ]  \  }}	 t        | ||        y# t        $ r Y "w xY w)zU
        Updates the PropagationContext with data from the given dictionary.
        N)r   setattrAttributeError)r/   
other_dictr3   r  s       r0   r  zPropagationContext.update  sE     %**, 	JCc5)	 " s   (	44c                     || _         y r.   )r   )r/   r   s     r0   _set_custom_sampling_contextz/PropagationContext._set_custom_sampling_context  s     (?$r2   c                     dj                  | j                  | j                  | j                  | j                  | j
                        S )Nz\<PropagationContext _trace_id={} _span_id={} parent_span_id={} parent_sampled={} baggage={}>)rm   r   r   r   r   r   rD   s    r0   __repr__zPropagationContext.__repr__  s<    mttNNMMLL
 	
r2   c                    | j                   yt        t        | j                   j                  j	                  d            }|d|cxk  rdk  ry t        t        | j                   j                  j	                  d            }t        | j                  |      \  }}	 t        | j                  ||f      }|d
| j                   j                  d<   y# t        $ r) t        j                  d| j                   d| d	       Y yw xY w)a  
        Ensure that there is a valid sample_rand value in the baggage.

        If there is a valid sample_rand value in the baggage, we keep it.
        Otherwise, we generate a sample_rand value according to the following:

          - If we have a parent_sampled value and a sample_rate in the DSC, we compute
            a sample_rand value randomly in the range:
                - [0, sample_rate) if parent_sampled is True,
                - or, in the range [sample_rate, 1) if parent_sampled is False.

          - If either parent_sampled or sample_rate is missing, we generate a random
            value in the range [0, 1).

        The sample_rand is deterministically generated from the trace_id, if present.

        This function does nothing if there is no baggage.
        Nsample_randr   r>   sample_rateintervalz5Could not backfill sample_rand, since parent_sampled=z and sample_rate=..6f)r   r   floatsentry_itemsrY   _sample_rand_ranger   _generate_sample_randr   
ValueErrorr   debug)r/   r(  r)  lowerr:   s        r0   r  z$PropagationContext._fill_sample_rand  s    & <<!%)B)B)F)F})UV"qK';!'; (< "%)B)B)F)F})UV)$*=*={Ku	/PUWK 7B#5F!!-0  		
 LLGH[H[G\ ]##.-q2 		s   C /DDc                 f    | j                   y| j                   j                  j                  d      S )zAConvenience method to get the sample_rand value from the baggage.Nr(  )r   r/  rY   rD   s    r0   _sample_randzPropagationContext._sample_rand  s*    <<||((,,];;r2   )NNNNNN)r   rf   r   rf   r   rf   r   Optional[bool]r   zOptional[Dict[str, str]]r   Optional[Baggage]r,   N)r  Dict[str, Any]r,   r   )r,   rS   )r,   r   )r,   zIterator[Tuple[str, str]])r"  r9  r,   N)r   dict[str, Any]r,   Nr,   N)r,   rf   )rN   rO   rP   __doc__	__slots__r1   classmethodr  propertyrH   r   setterr   r   r  r  r  r  r$  r&  r  r6  r?   r2   r0   r   r     sv   I %)#'*.+/?C'+H!H !H (	H
 )H #=H %H 
HB #,#	# #: #   __c d      ^^S T   = =1 1
/?'7?	?

# 
-H^<r2   r   c                       e Zd ZdZdZdZ ej                  d      Z	 	 dddde	de
fd	Zed
d	 	 	 	 	 dd       Zedd       Ze	 	 	 	 dd       Ze	 	 	 	 dd       Zedd       Zd dZd!dZd"de
de	fdZede	de	fd       Zd#dZde	fdZy
)$r   aF  
    The W3C Baggage header information (see https://www.w3.org/TR/baggage/).

    Before mutating a `Baggage` object, calling code must check that `mutable` is `True`.
    Mutating a `Baggage` object that has `mutable` set to `False` is not allowed, but
    it is the caller's responsibility to enforce this restriction.
    r/  third_party_itemsmutablezsentry-z^sentry-r/  Dict[str, str]rC  rD  c                 .    || _         || _        || _        y r.   rB  )r/   r/  rC  rD  s       r0   r1   zBaggage.__init__  s     )!2r2   N)r6  r   r,   c                   i }d}d}|r|j                  d      D ]  }d|vrt               5  |j                         }|j                  d      \  }}t        j                  j                  |      r.t        |j                  d      d         }	t        |      ||	<   d}n||rdnd|z   z  }ddd        |t        |      |d	<   d}t        |||      S # 1 sw Y   xY w)
zF
        freeze if incoming header already has sentry baggage
        r   T,=r7   r>   FNr(  )splitr   stripr   SENTRY_PREFIX_REGEXr   r
   rH   )
r  r   r6  r/  rC  rD  itemr3   valbaggage_keys
             r0   r  zBaggage.from_incoming_header  s     S) Wd?02 W::<D#zz#HC2288=&-ciinQ.?&@4;CL[1"')5FcBRV-VV)W W	W #*-l*;L'G|%6@@W Ws   A>CC	c                 n    |j                   t        i       S t        j                  |j                         S )zC
        Deprecated: use populate_from_propagation_context
        )_propagation_contextr   r  )r  r   s     r0   from_optionszBaggage.from_options	  s1    
 %%-2;889S9STTr2   c                    i }d}d}t        j                         }|j                         st        |      S |j                  }|j
                  |d<   |j                  d      r|d   |d<   |j                  d      r|d   |d<   |j                  rH|j                  j                  |d<   |j                  j                  r|j                  j                  |d<   |j                  d      rt        |d         |d	<   t        |||      S )
Nr   Fr   environmentrelease
public_keyorg_idrV   r)  )rz   r{   r   r   rR   r   rY   
parsed_dsnrV  rW  rH   )r  r  r/  rC  rD  r   rR   s          r0   r  z)Baggage.populate_from_propagation_context  s     *,&&(!<((..#6#?#?Z ;;}%*1-*@L';;y!&-i&8L#)/):):)E)EL&  '')/):):)A)AX&;;+,*-g6J.K*LL'|%6@@r2   c                 X   t        j                         }i }|j                         st        |      S |j                  xs i }|j
                  |d<   |j                  d|d<   |j                  d      r|d   |d<   |j                  d      r|d   |d<   |j                  rH|j                  j                  |d<   |j                  j                  r|j                  j                  |d<   |j                  r!|j                  t        vr|j                  |d<   |j                  t        |j                        |d	<   |j                   |j                   rd
nd|d<   |j"                  r;|j"                  j$                  r%|j'                  |j"                  j$                         t        |d      S )
        Populate fresh baggage entry with sentry_items and make it immutable
        if this is the head SDK which originates traces.
        r   r-  r(  rT  rU  rV  rW  transactionr)  truefalsesampledFrD  )rz   r{   r   r   rR   r   r6  rY   rX  rV  rW  rx   sourceLOW_QUALITY_TRANSACTION_SOURCESr)  rH   r^  _baggager/  r  )r  r[  r   r/  rR   s        r0   populate_from_transactionz!Baggage.populate_from_transaction4  s    &&()+!<((..&B#.#7#7Z )4)A)A#(F]#;;}%*1-*@L';;y!&-i&8L#)/):):)E)EL&  '')/):):)A)AX& ""*II*5*:*:L'"".*-k.E.E*FL'*0;0C0CfL#
 K$8$8$E$E 4 4 A AB|U33r2   c                 ~   t        j                         }i }|j                         st        |      S |j                  xs i }|j
                  |d<   |j                  d|d<   |j                  d      r|d   |d<   |j                  d      r|d   |d<   |j                  rH|j                  j                  |d<   |j                  j                  r|j                  j                  |d<   |j                         j                  d      t        vr|j                  r|j                  |d	<   |j                  t        |j                        |d
<   |j                   |j                   rdnd|d<   |j"                  r;|j"                  j$                  r%|j'                  |j"                  j$                         t        |d      S )rZ  r   r-  r(  rT  rU  rV  rW  zsentry.span.sourcer[  r)  r\  r]  r^  Fr_  )rz   r{   r   r   rR   r   r6  rY   rX  rV  rW  get_attributesLOW_QUALITY_SEGMENT_SOURCES_name_sample_raterH   r^  rb  r/  r  )r  segmentr   r/  rR   s        r0   populate_from_segmentzBaggage.populate_from_segmentf  s    &&()+!<((..&B#*#3#3Z )0)=)=c(B]#;;}%*1-*@L';;y!&-i&8L#)/):):)E)EL&  '')/):):)A)AX& ""$(()=>./mm*1--L'+*-g.B.B*CL'??&07fWL#  0 0 = = 0 0 = =>|U33r2   c                     d| _         y NFr_  rD   s    r0   freezezBaggage.freeze  s	    r2   c                 X    i }| j                   j                         D ]
  \  }}|||<    |S r.   )r/  r   )r/   r   r3   rM  s       r0   r   z Baggage.dynamic_sampling_context  s9    **002 	ICF3K	 r2   include_third_partyc                 n   g }| j                   j                         D ]]  \  }}t               5  t        j                  t        |      z   dz   t        t        |            z   }|j                  |       d d d        _ |r|j                  | j                         dj                  |      S # 1 sw Y   xY w)NrI  rH  )
r/  r   r   r   SENTRY_PREFIXr	   rH   appendrC  join)r/   ro  r   r3   rN  rM  s         r0   r  zBaggage.serialize  s    ))//1 	#HC,. #,,uSz9C?%C/QT"# #	#
 LL//0xx# #s   AB++B4	c                 P    dj                  d | j                  d      D              S )zRemove Sentry baggage from the given header.

        Given a Baggage header, return a new Baggage header with all Sentry baggage items removed.
        rH  c              3   z   K   | ]3  }t         j                  j                  |j                               s| 5 y wr.   )r   rL  r   rK  )r@   rM  s     r0   rA   z/Baggage.strip_sentry_baggage.<locals>.<genexpr>  s2      2288F s   9;)rs  rJ  )r   s    r0   strip_sentry_baggagezBaggage.strip_sentry_baggage  s+     xx"LL-
 	
r2   c                 x    t        t        | j                  j                  d            }|d|cxk  rdk  r|S  yy)zConvenience method to get the sample_rand value from the sentry_items.

        We validate the value and parse it as a float before returning it. The value is considered
        valid if it is a float in the range [0, 1).
        r(  N              ?)r   r.  r/  rY   )r/   r(  s     r0   r6  zBaggage._sample_rand  sD     "%):):)>)>})MN"sk'?C'? (@ r2   c                 H    d| j                  d       d| j                   dS )Nz
<Baggage "T)ro  z", mutable=>)r  rD  rD   s    r0   r&  zBaggage.__repr__  s,    DNNtNDE[QUQ]Q]P^^_``r2   )r   T)r   rf   r6  rf   r,   r   )r   zsentry_sdk.scope.Scoper,   r8  )r  r   r,   r   )r[  zsentry_sdk.tracing.Transactionr,   r   )ri  StreamedSpanr,   r   r;  )r,   rE  )F)r,   Optional[float])rN   rO   rP   r<  r=  rq  recompilerL  rH   rX   r1   r>  r  rR  r  rc  rj  rm  r   r  staticmethodrv  r6  r&  r?   r2   r0   r   r     sT    AIM$"**Z0
 "$	&  	 
 )-	 A A &	 A
 
 A  AD U U A"6A	A A@ /4:/4	/4 /4b .4 .4`T c  
S 
S 
 
a# ar2   r   r   zsentry_sdk.client.BaseClienturlc                 V    | j                   d   }t        | |      ryt        ||d      S )zy
    Returns True if url matches trace_propagation_targets configured in the given client. Otherwise, returns False.
    trace_propagation_targetsFT)substring_matching)rR   r   r   )r   r  r  s      r0   should_propagate_tracer    s1     !'/J KVS!C!:tTTr2   c                     i }| j                         D ]@  \  }}|j                  d      r|dd }|j                  dd      j                         }|||<   B |S )z
    Normalizes incoming data so the keys are all lowercase with dashes instead of underscores and stripped from known prefixes.
    rM      Nr8   r7   )r   rI   r9   r4  )r  ru   r3   r  s       r0   r   r     se     D#))+ 
U>>'"ab'Ckk#s#))+S	 Kr2   rx   r   templatec                 0     ddl m d fd}|S )a  
    Create a span decorator that can wrap both sync and async functions.

    :param op: The operation type for the span.
    :type op: str or :py:class:`sentry_sdk.consts.OP` or None
    :param name: The name of the span.
    :type name: str or None
    :param attributes: Additional attributes to set on the span.
    :type attributes: dict or None
    :param template: The type of span to create. This determines what kind of
        span instrumentation and data collection will be applied. Use predefined
        constants from :py:class:`sentry_sdk.consts.SPANTEMPLATE`.
        The default is `SPANTEMPLATE.DEFAULT` which is the right choice for most
        use cases.
    :type template: :py:class:`sentry_sdk.consts.SPANTEMPLATE`
    r   )should_send_default_piic                 l    t        j                         d fd       }	 t        j                         |_        t        j                         d fd       }	 t        j                         |_        t        j                         r|S |S # t
        $ r Y bw xY w# t
        $ r Y 3w xY w)D
        Decorator to create a span for the given function.
        c            
      P  K   t               }|/t        j                  dt        
              
| i | d {   S t	        |t
              r,t        j                  dt        d        
| i | d {   S xs t              }xs t        
      xs d}t        ||      }        }|j                  ||      5 }|j                  	xs i        t        |||
| |        
| i | d {   }t        |||       |cd d d        S 7 7 7 !# 1 sw Y   y xY wwNzbCannot create a child span for %s. Please start a Sentry transaction before calling this function.zBUse the @sentry_sdk.traces.trace decorator in span streaming mode.   
stacklevelr   )rw   rx   get_current_spanr   r3  r   rG   r|  warningswarnDeprecationWarning_get_span_op_get_span_namestart_childupdate_data_set_input_attributes_set_output_attributesargskwargscurrent_spanspan_opfunction_name	span_namesend_piir   resultr   frx   rw   r  r  s            r0   async_wrapperzDcreate_span_decorator.<locals>.span_decorator.<locals>.async_wrapper  sJ    +-L#V*1-
 ////,5X& 
 ////2L2G C$:1$=CM&xGI.0H)) *     !1r2%(HmQf  !$1&11&tXxH  0 0  2 sL   7D&D;D&6D7AD&2D6D7D
D&D&DD#D&c            
         t               }|'t        j                  dt        
              
| i |S t	        |t
              r$t        j                  dt        d        
| i |S xs t              }xs t        
      xs d}t        ||      }        }|j                  ||      5 }|j                  	xs i        t        |||
| |        
| i |}t        |||       |cd d d        S # 1 sw Y   y xY wr  r  r  s            r0   sync_wrapperzCcreate_span_decorator.<locals>.span_decorator.<locals>.sync_wrapper3  s'   +-L#V*1-
 $)&)),5X& 
 $)&))2L2G C$:1$=CM&xGI.0H)) *     !1r2%(HmQf D+F+&tXxH  s   2>C::Dr  r   r  r   r,   r   	functoolswrapsinspect	signature__signature__r   iscoroutinefunction)r  r  r  r   rx   rw   r  r  s   `  r0   span_decoratorz-create_span_decorator.<locals>.span_decorator  s    
 
	%	 %	 
%	N	*1*;*;A*>M' 
	%	 %	 
%	N	)0):):1)=L& &&q)  g  		Z  		s#   B %B' 	B$#B$'	B32B3r  r   r,   r   )sentry_sdk.scoper  )rw   rx   r   r  r  r  s   ```` @r0   create_span_decoratorr    s    , 9b  b H r2   activec                      d fd}|S )zW
    Create a span creating decorator that can wrap both sync and async functions.
    c                 d    t        j                         d fd       }	 t        j                         |_        t        j                         d fd       }	 t        j                         |_        t        j                         r|S |S # t
        $ r Y `w xY w# t
        $ r Y 3w xY w)r  c                  "  K   t        j                         }t        |j                        st	        j
                  dd       xs t              xs d}t        |      5   | i | d {   }|cd d d        S 7 # 1 sw Y   y xY wwNzSUsing span streaming API in non-span-streaming mode. Use @sentry_sdk.trace instead.r  r  r   )rx   r   r  rz   r{   ra   rR   r  r  r   start_streaming_span)	r  r  r   r  r  r  r   r  rx   s	        r0   r  zNcreate_streaming_span_decorator.<locals>.span_decorator.<locals>.async_wrapperv  s     **,F-fnn=1  ? 6q 9?RI%:f   !$1&11	  2 s0   A"B%B1B2B7
BBBBc                     t        j                         }t        |j                        st	        j
                  dd       xs t              xs d}t        |      5   | i |cd d d        S # 1 sw Y   y xY wr  r  )r  r  r   r  r  r   r  rx   s       r0   r  zMcreate_streaming_span_decorator.<locals>.span_decorator.<locals>.sync_wrapper  s{    **,F-fnn=1  ? 6q 9?RI%:f * $)&)* * *s   #A55A>r  r  )r  r  r  r  r   rx   s   `  r0   r  z7create_streaming_span_decorator.<locals>.span_decoratorq  s    
 
		 
	"	*1*;*;A*>M' 
		* 
	* 	)0):):1)=L& &&q)  9  		,  		s#   B !B# 	B B #	B/.B/r  r?   )rx   r   r  r  s   ``` r0   create_streaming_span_decoratorr  h  s    5 n r2   c                 N    | xs t        j                         } | j                  }|S )zU
    Returns the currently active span if there is one running, otherwise `None`
    )rz   get_current_scoper   )r   r  s     r0   r  r    s&     3Z113E::Lr2   c                    ddl m}m}m} t	        j
                         }| s0t        |j                        r |       nt	        j                         } | t        | t              rV| j                  t        j                         | j                  *| j                  j                  t        j                         yyt        | |      r:|j                  | _        | j"                  |j                  | j"                  _        yyyy)z
    Set the status of the current or given span to INTERNAL_ERROR.
    Also sets the status of the transaction (root span) to INTERNAL_ERROR.
    r   )r|  
SpanStatus_get_current_streamed_spanN)sentry_sdk.tracesr|  r  r  rz   r{   ra   rR   r  rG   r   
set_statusr   INTERNAL_ERRORcontaining_transactionERRORstatus_segment)r   r|  r  r  r   s        r0   set_span_erroredr    s    
 WV""$F *&..9 '(,,. 	 dD!OOJ556**6++66z7P7PQ 7l+$**DK}}('1'7'7$ ) , r2   rx  ry  r*  r   r+  tuple[float, float]c                    |\  }}||k  st        d      t        |       }t        |dz        }t        |dz        }	 |j                  ||      }|dz  S # t         $ r	 |}Y |dz  S w xY w)a  Generate a sample_rand value from a trace ID.

    The generated value will be pseudorandomly chosen from the provided
    interval. Specifically, given (lower, upper) = interval, the generated
    value will be in the range [lower, upper). The value has 6-digit precision,
    so when printing with .6f, the value will never be rounded up.

    The pseudorandom number generator is seeded with the trace ID.
    z/Invalid interval: lower must be less than upperi@B )r2  r   rQ   	randrange)r   r+  r4  r:   rnglower_scaledupper_scaledsample_rand_scaleds           r0   r1  r1    s     LE55=JKK

Cuy()Luy()L* ]]<F 	))  * *	))*s   A A'&A'c                 $    | |y| du rd|fS |dfS )z
    Compute the lower (inclusive) and upper (exclusive) bounds of the range of values
    that a generated sample_rand value must fall into, given the parent_sampled and
    sample_rate values.
    r  Trx  ry  r?   )r   r)  s     r0   r0  r0    s0     !4	4	KCr2   r`  r3   r4   c                     d}t        | t              r| j                  |      }|S t        | |      r	 t	        | |      }|S |S # t
        $ r d}Y |S w xY w)z
    Gets a value from a source object. The source can be a dict or an object.
    It is checked for dictionary keys and object attributes.
    N)rG   dictrY   r   getattrr   )r`  r3   r  s      r0   
_get_valuer     sj    
 E&$

3 L 63, L5L  Ls   A AAzUnion[str, SPANTEMPLATE]r  c                    |}| t         j                  k(  rDd}|r3dD ].  }|j                  |      st        ||   t              s)||   } n |rd| }|S d}|S | t         j
                  k(  rd| }|S | t         j                  k(  rd| }|S )zF
    Get the name of the span based on the template and the name.
    N)model
model_namezchat chatzinvoke_agent zexecute_tool )r   AI_CHATrY   rG   rH   AI_AGENTAI_TOOL)r  rx   r  r  r  r3   s         r0   r  r    s     I<'''. ::c?z&+s'C"3KE
 (-eE7O	  39	  
\**	*#D6*	
  
\))	)#D6*	r2   c                    t         j                  t        j                  t         j                  t        j
                  t         j                  t        j                  i}|j                  | t        j                        }t        |      S )z>
    Get the operation of the span based on the template.
    )r   r  r   GEN_AI_CHATr  GEN_AI_INVOKE_AGENTr  GEN_AI_EXECUTE_TOOLrY   FUNCTIONrH   )r  mappingrw   s      r0   r  r  .  s\    
 	bnnr55b44AG
 
Xr{{	+Br7Nr2   r  r  ztuple[Any, ...]r:  c                    i | t         j                  t         j                  t         j                  fv rt        j
                  t        ft        j
                  t        ft        j                  t        ft        j                  t        ft        j                  t        ft        j                  t        ft        j                  t        ft        j                  t        ft        j                  t        ft        j                  t        fd
dt        ddddffd}t!        |j#                               D ]  \  }}|dk(  rCt%        |t              r3j'                  t        j(                  g       j+                  d	|d
       N|dk(  rCt%        |t              r3j'                  t        j(                  g       j+                  d|d
        |||        | t         j                  k(  r!|rt-        ||d      t        j.                  <   t        j(                  v r-t-        t        j(                           t        j(                  <   S )z;
    Get input attributes for the given span template.
    )
r  r  agent
agent_name
max_tokensfrequency_penaltypresence_penaltytemperaturetop_ptop_kr3   r  r   r,   Nc                 J    | v r|    \  }}|t        ||      r||<   y y y y r.   )rG   )r3   r  	attribute	data_typer   r  s       r0   _set_from_keyz,_get_input_attributes.<locals>._set_from_keyU  s?    g~)0&I$E9)E,1Jy) *F$ r2   promptuser)rolecontentsystem_promptsystem)r  r  )r   r  r  r  r   GEN_AI_REQUEST_MODELrH   GEN_AI_AGENT_NAMEGEN_AI_REQUEST_MAX_TOKENSrQ    GEN_AI_REQUEST_FREQUENCY_PENALTYr.  GEN_AI_REQUEST_PRESENCE_PENALTYGEN_AI_REQUEST_TEMPERATUREGEN_AI_REQUEST_TOP_PGEN_AI_REQUEST_TOP_Klistr   rG   
setdefaultGEN_AI_REQUEST_MESSAGESrr  r   GEN_AI_TOOL_INPUT)	r  r  r  r  r  r3   r  r   r  s	          @@r0   _get_input_attributesr  <  s    $&JL))<+?+?AUAUVV33S9#88#>00#6#55s;#==sC"*"K"KU!S!)!I!I5 Q$??G33U;33S9
	2s 	25 	2T 	2 v||~. 	&JCh:eS#9%%h&F&FKRR#6 o%*UC*@%%h&F&FKRR%%8 #u%	& <'''H1:V,2

8--.
 '':57@x7788

8334 r2   c                      i dt         ddddf fd} |t        j                  d        |t        j                  d        |t        j                  d	       S )
z
    Get usage attributes.
    r  keysztuple[str, ...]r,   Nc                 ^    |D ]'  }t        |      }|t        |t              s#|| <   ) y r.   )r  rG   rQ   )r  r  r3   r  r   usages       r0   _set_from_keysz-_get_usage_attributes.<locals>._set_from_keys~  s7     	.Cuc*E Zs%;(-
9%	.r2   )prompt_tokensinput_tokens)completion_tokensoutput_tokens)total_tokens)rH   r   GEN_AI_USAGE_INPUT_TOKENSGEN_AI_USAGE_OUTPUT_TOKENSGEN_AI_USAGE_TOTAL_TOKENS)r	  r
  r   s   ` @r0   _get_usage_attributesr  x  so     J.# .-> .4 . **) ++. **
 r2   r  c                    i }| t         j                  t         j                  t         j                  fv rt	               5  |g}t        |d      }|j                  |       t        |d      }t        |d      }|j                  |       |D ]  }||j                  t        |             ! t        |d      }|#t        |t              r||t        j                  <   t        |d      }|#t        |t              r||t        j                  <   ddd       | t         j                  k(  r|rt        |      |t        j                  <   |S # 1 sw Y   <xY w)z<
    Get output attributes for the given span template.
    r	  metadataNr  r  )r   r  r  r  r   r  rr  r  r  rG   rH   r   GEN_AI_RESPONSE_MODELr   GEN_AI_TOOL_OUTPUT)	r  r  r  r   usage_candidatesr	  metausage_candidater  s	            r0   _get_output_attributesr    sA    $&JL))<+?+?AUAUVV(* 	H &xvw/E##E*fj1DtW-E##E*#3 N".%%&;O&LMN
 $FG4J%*Z*E=G
899:#FL9J%*Z*E=G
899:-	H2 <'''H2;F2C
8../9	H 	Hs   AE	A>E		Er   r  c                    i }|t         j                  k(  r#t        j                  dt        j                  |i}n||t         j
                  k(  rt        j                  di}nV|t         j                  k(  rCt        j                  dt        j                  |i}|j                  }|||t        j                  <   |j                  t        ||||             | j                  |xs i        y)a  
    Set span input attributes based on the given span template.

    :param span: The span to set attributes on.
    :param template: The template to use to set attributes on the span.
    :param send_pii: Whether to send PII data.
    :param f: The wrapped function.
    :param args: The arguments to the wrapped function.
    :param kwargs: The keyword arguments to the wrapped function.
    invoke_agentr  execute_toolN)r   r  r   GEN_AI_OPERATION_NAMEr  r  r  GEN_AI_TOOL_NAMEr<  GEN_AI_TOOL_DESCRIPTIONr  r  r  )	r   r  r  rx   r  r  r  r   	docstrings	            r0   r  r    s    & $&J<(((**N&&

 
\))	)**F

 
\))	)**N%%t


 II	 ;DJx778+HhfMNZ%2&r2   c                 D    | j                  t        |||      xs i        y)a%  
    Set span output attributes based on the given span template.

    :param span: The span to set attributes on.
    :param template: The template to use to set attributes on the span.
    :param send_pii: Whether to send PII data.
    :param result: The result of the wrapped function.
    N)r  r  )r   r  r  r  s       r0   r  r    s!     	+HhGM2Nr2   r   r8  c                 t   t        j                         }|j                  }|r|j                  nd}| r| j                  j                  d      nd}|$|"||k7  rt        j                  d| d| d       y|j                  j                  dd      }|r%||||t        j                  d| d| d       yy	)
z
    Check if we should continue the incoming trace according to the strict_trace_continuation spec.
    https://develop.sentry.dev/sdk/telemetry/traces/#stricttracecontinuation
    NrW  zKStarting a new trace because org IDs don't match (incoming baggage org_id: z, SDK org_id: )Fstrict_trace_continuationzvStarting a new trace because strict trace continuation is enabled and one org ID is missing (incoming baggage org_id: T)	rz   r{   rX  rW  r/  rY   r   r3  rR   )r   r   rX  client_org_idbaggage_org_idr&  s         r0   r  r    s    ""$F""J)3J%%M;BW))--h7N 	!&^+YZhYiiw  yF  xG  GH  I	
 &,nn&8&8#U' !&=+@"}'@LL I  JX  IY  Yg  hu  gv  vw  x r2   headerszMutableMapping[str, str]sentry_baggagec                     | j                  t        d      }t        j                  |      }t	        |      dkD  rdnd}||z   |z   | t        <   y)zAdd the Sentry baggage to the headers.

    This function directly mutates the provided headers. The provided sentry_baggage
    is appended to the existing baggage. If the baggage already contains Sentry items,
    they are stripped out first.
    r   r   rH  N)rY   r   r   rv  rJ   )r)  r*  existing_baggagestripped_existing_baggage	separators        r0   add_sentry_baggage_to_headersr/    sV     {{#6; ' < <=M N459rI 	"I->  r2   zOptional[Attributes]z<tuple[bool, Optional[float], Optional[float], Optional[str]]c                 6   t        j                         }t        |j                        sy|j	                         }d}|j
                  |j
                  j                         }|t        |j                        }t        |j                  j                  d            }|rrd| |j                  |j                  |j                  |rt        |      ni di}|j                  r|j                  |j                          |j                  d   |      }n(|j                  |j                  }n|j                  d   }t!        |d      st#        j$                  d	|  d
       yt'        |      }|s#|rd}	nd}	t#        j(                  d	|  d|	        y|j*                  r8|d|j*                  j,                  z  z  }|st#        j(                  d	|  d       y||k  }
|
rt#        j(                  d|         d}nt#        j(                  d	|  d| d       d}|
|||fS )z
    Decide whether a span should be sampled.

    Returns a tuple with:
    1. the sampling decision
    2. the effective sample rate
    3. the sample rand
    4. the reason for not sampling the span, if unsampled
    )FNNNNrW   span_context)rx   r   r   r   r   rV   Tracing)r`  z[Tracing] Discarding z  because of invalid sample rate.)FNNr)  z"traces_sampler returned 0 or Falseztraces_sample_rate is set to 0z	 because )Frx  Nr)  r  z because backpressure)Frx  Nbackpressurez[Tracing] Starting zA because it's not included in the random sample (sampling rate = r%  r)  )rz   r{   r[   rR   get_active_propagation_contextr   r6  r1  r   callablerY   r   r   r  r   r  r   r   r   r.  r3  monitordownsample_factor)rx   r   r   r   r  r(  traces_sampler_definedsampling_contextr)  reasonr^  outcomes               r0   _make_sampling_decisionr<  -  s    ""$Fv~~.&>>@K"".)11>>@+,?,H,HI &fnn&8&89I&JK/88"5"D"D"5"D"D2<d:."
 66##$7$O$OP6fnn%567GH--9-<<K ..)=>K  I>.tf4TUV/$K!9F5F,TF)F8DE. ~~q&..::::LL06KLM3K'G*4&12#D6)jkvjwwxy	
  Kg55r2   c                    t        j                         }|j                  j                  d      xs i j                  d      }|sydddddt        fd}|D ]  }t        |t        t        f      r |||       s# y	t        |t              s6d
|v sd|v s?d	}d	}|xs i }d
|v r ||d
   |       }d|v r/|d   j                         D ]  \  }}	||vs ||	||         rd} n |s|s y	 y)z:Determine if a span fits one of the rules in ignore_spans.r^   ignore_spansFruler   r  r,   c                     t        | t              r+t        |t              rt        | j	                  |            S y| |k(  S rl  )rG   r   rH   rX   	fullmatch)r?  r  s     r0   _matchesz!is_ignored_span.<locals>._matches  s7    dG$%%DNN5122u}r2   Trx   r   )
rz   r{   rR   rY   rX   rG   rH   r   r  r   )
rx   r   r   r>  rB  r?  name_matchesattributes_matchr  r  s
             r0   is_ignored_spanrE    s!   ""$FNN&&~6<"AA.QLu U t   dS'N+d#d#4<4;OL##)rJ~'Vd;t#(,\(:(@(@(B $Iu 
2(z)4; ,1(  0/2 r2   )r   ra  r   r   )rf  r|  r~   )Fmanual)r   r   r   zsentry_sdk.tracing.Spanr,   N)r   r&   r,   rf   )
r   >Union[sentry_sdk.tracing.Span, sentry_sdk.traces.StreamedSpan]r   rf   r   r   r   r   r,   N)r   rG  r,   N)r   rf   r,   z+Optional[Dict[str, Union[str, bool, None]]])r  r9  r,   r9  )
rw   zOptional[Union[str, OP]]rx   rf   r   r\   r  r   r,   r   )NNTr.   )r   zOptional[sentry_sdk.Scope]r,   zOptional[Span])r   z#Optional[Union[Span, StreamedSpan]]r,   N)r   r7  r)  r}  r,   r  )r	  r   r,   r:  )l
contextlibr  r  r   r~  r   r  collections.abcr   r   r   r   r   randomr   urllib.parser	   r
   r  r   ImportErrortypingrz   sentry_sdk.constsr   r   r   r   sentry_sdk.utilsr   r   r   r   r   r   r   r   r   r   r   r   r   sentry_sdk.tracingr   r   r   r   r    r!   r"   r#   r$   r%   typesr&   sentry_sdk._typesr'   r  r   base64_strippedr)   rX   r[   ra   contextmanagerrH   r   r   r   r   r   r   r   r   r   r|   r   r   r  r   DEFAULTr  r  r  r  r.  r1  r0  r  r  r  r  r  r  r  r  r  r/  r<  rE  r   ra  r   r  rf  r|  r~   r  r?   r2   r0   <module>rV     s      	 	 
  3 2 2  ' 
  D D    2   ,  RZZ  (W (6!;  "R(B Rt R   %*** *  	*
 * * * 6* *^   %555 5  	5
 5 5 5 ]5 5p

%>
	
B * *	
  " 
&TQ
JTQ!TQ *TQ *	TQ
 
TQn(
J(	(V(
J(	(V2B& &C &O &$H< H<V}a }a@	U#A 	U 	UPT 	U  &* -1+33	|"|
| +| 	|
 |@ !-1@
@*@ @ 	@H +/'8< '1** $* 	*> $ 3D   u 3 ? ( *.(
 ' 		:5 # 9(99 9 	9
 9x8%(%48%BG%%P)'
)'()' )' 	)'
 )' )' )' 
)'XO
O6OBFOPUO	O!$7 !D !H'9<	&U6
U6&U6 U6 D	U6p*# *+A *d *\   ' _5  s   J   J/.J/