Ë
    S>{i …  ã            
       ó¦  — d dl Z d dlZd dlmZ d dlZd dlmZ d dlmZm	Z	m
Z
 d dlmZmZ d dlmZ d dlmZ er<d dlZd dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlZd dlmZmZmZ dZdZdZdZdZ dZ!dZ"dZ#egZ$e"e"e"e ee"e e e dœ	Z% G d„ de&«      Z' G d„ de&«      Z( G d„ de(«      Z) G d„ d e(«      Z*d#d!„Z+d d"l,m-Z-m.Z.m/Z/m0Z0m1Z1 y)$é    N)Ú	timedelta)ÚINSTRUMENTER)Úis_valid_sample_rateÚloggerÚnanosecond_time)Údatetime_utcnowÚPY2)ÚSPANDATA)ÚTYPE_CHECKING)Údatetime)ÚAny)ÚDict)ÚIterator)ÚList)ÚOptional)ÚTuple)ÚEventÚMeasurementUnitÚSamplingContextÚbaggagezsentry-traceÚcustomÚurlÚrouteÚviewÚ	componentÚtask)	ÚendpointÚfunction_nameÚhandler_nameÚmethod_and_path_patternÚpathÚ
route_nameÚroute_patternÚuri_templater   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)Ú_SpanRecorderz5Limits the number of spans recorded in a transaction.©ÚmaxlenÚspansc                 ó&   — |dz
  | _         g | _        y )Né   r'   ©Úselfr(   s     úP/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sentry_sdk/tracing.pyÚ__init__z_SpanRecorder.__init__A   s   € ð ˜q‘jˆŒØˆ�
ó    c                 óŽ   — t        | j                  «      | j                  kD  rd |_        y | j                  j	                  |«       y ©N)Úlenr)   r(   Ú_span_recorderÚappend)r-   Úspans     r.   Úaddz_SpanRecorder.addK   s0   € äˆt�z‰z‹?˜TŸ[™[Ò(Ø"&ˆDÕà�J‰J×Ñ˜dÕ#r0   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r/   r7   © r0   r.   r&   r&   <   s   „ Ù?à#€Iòó$r0   r&   c                   óú   — e Zd ZdZdZd„ Z	 	 	 	 	 	 	 	 	 	 	 	 dd„Zd„ Zd„ Zd„ Z	d	„ Z
ed
„ «       Zej                  fd„Zd„ Zed„ «       Zed„ «       Zd„ Zed„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdd„Zd„ Zd„ Zy)ÚSpanzuA span holds timing information of a block of code.
    Spans can have multiple child spans thus forming a span tree.)Útrace_idÚspan_idÚparent_span_idÚsame_process_as_parentÚsampledÚopÚdescriptionÚstart_timestampÚ_start_timestamp_monotonic_nsÚstatusÚ	timestampÚ_tagsÚ_datar4   ÚhubÚ_context_manager_stateÚ_containing_transactionc                 óf   — d|v rt         j                  t        «      S t         j                  | «      S )z_
        Backwards-compatible implementation of Span and Transaction
        creation.
        Útransaction)ÚobjectÚ__new__ÚTransaction)ÚclsÚkwargss     r.   rS   zSpan.__new__k   s*   € ð ˜FÑ"Ü—>‘>¤+Ó.Ð.Ü�~‰~˜cÓ"Ð"r0   Nc                 ó²  — |xs t        j                  «       j                  | _        |xs! t        j                  «       j                  dd  | _        || _        || _        || _        || _        || _	        |	| _
        || _        i | _        i | _        || _        |xs
 t        «       | _        	 t#        «       | _        d | _        d | _        y # t&        $ r Y Œw xY w)Né   )ÚuuidÚuuid4Úhexr@   rA   rB   rC   rD   rE   rF   rI   rM   rK   rL   rO   r   rG   r   rH   ÚAttributeErrorrJ   r4   )r-   r@   rA   rB   rC   rD   rE   rF   rM   rI   rQ   Úcontaining_transactionrG   s                r.   r/   zSpan.__init__y   sÍ   € ð  !Ò4¤D§J¡J£L×$4Ñ$4ˆŒØÒ7¤$§*¡*£,×"2Ñ"2°2°3Ð"7ˆŒØ,ˆÔØ&<ˆÔ#ØˆŒØˆŒØ&ˆÔØˆŒØˆŒØˆŒ
ØˆŒ
Ø'=ˆÔ$Ø.ÒC´/Ó2CˆÔð	ô 2AÓ1BˆDÔ.ð
 ˆŒà"ˆÕøô ò 	Ùð	ús   Â,C
 Ã
	CÃCc                 ó>   — | j                   €t        |«      | _         y y r2   )r4   r&   r,   s     r.   Úinit_span_recorderzSpan.init_span_recorder¤   s    € à×ÑÐ&Ü"/°Ó"7ˆDÕð 'r0   c                 óÒ   — d| j                   j                  ›d| j                  ›d| j                  ›d| j                  ›d| j
                  ›d| j                  ›d| j                  ›d�S )	Nú<z(op=z, description:ú, trace_id=ú
, span_id=ú, parent_span_id=ú
, sampled=ú)>)Ú	__class__r8   rE   rF   r@   rA   rB   rD   ©r-   s    r.   Ú__repr__zSpan.__repr__©   sI   � ð
 —‘×'Ó'Ø—“Ø× Ó Ø—“Ø—“Ø×#Ó#Ø—“ð	ð	
r0   c                 ó´   — | j                   xs t        j                  j                  }|j                  d   \  }}|j
                  }| |_        |||f| _        | S )Néÿÿÿÿ)rM   Ú
sentry_sdkÚHubÚcurrentÚ_stackr6   rN   )r-   rM   Ú_ÚscopeÚold_spans        r.   Ú	__enter__zSpan.__enter__¸   sO   € à�h‰hÒ0œ*Ÿ.™.×0Ñ0ˆà—:‘:˜b‘>‰ˆˆ5Ø—:‘:ˆØˆŒ
Ø'*¨E°8Ð&<ˆÔ#Øˆr0   c                 ó~   — |�| j                  d«       | j                  \  }}}| `| j                  |«       ||_        y )NÚinternal_error)Ú
set_statusrN   Úfinishr6   )r-   ÚtyÚvalueÚtbrM   rq   rr   s          r.   Ú__exit__zSpan.__exit__Â   s@   € àÐØ�O‰OÐ,Ô-à#×:Ñ:ÑˆˆU�HØÐ'à�‰�CÔØˆ�
r0   c                 ó   — | j                   S )z´The ``Transaction`` that this span belongs to.
        The ``Transaction`` is the root of the span tree,
        so one could also think of this ``Transaction`` as the "root span".)rO   rh   s    r.   r]   zSpan.containing_transactionÍ   s   € ð ×+Ñ+Ð+r0   c                 ó²  — | j                   xs t        j                  j                  }|j                  }|xr |j
                  d   }||k7  r
t        «       S |j                  d| j                  «       t        d| j                  | j                  | j                  dœ|¤Ž}| j                  xr | j                  j                  }|r|j                  |«       |S )a  
        Start a sub-span from the current span or transaction.

        Takes the same arguments as the initializer of :py:class:`Span`. The
        trace id, sampling decision, transaction pointer, and span recorder are
        inherited from the current span/transaction.
        ÚinstrumenterrD   )r@   rB   r]   r=   )rM   rl   rm   rn   ÚclientÚoptionsÚNoOpSpanÚ
setdefaultrD   r?   r@   rA   r]   r4   r7   )r-   r~   rV   rM   r   Úconfiguration_instrumenterÚchildÚspan_recorders           r.   Ústart_childzSpan.start_childÙ   sÇ   € ð �h‰hÒ0œ*Ÿ.™.×0Ñ0ˆØ—‘ˆØ%+Ò%N°·±¸~Ñ0NÐ"àÐ5Ò5Ü“:Ðà×Ñ˜) T§\¡\Ô2äð 
Ø—]‘]ØŸ<™<Ø#'×#>Ñ#>ñ
ð ñ	
ˆð ×'Ñ'ÒV¨D×,GÑ,G×,VÑ,Vð 	ñ Ø×Ñ˜eÔ$àˆr0   c                 óP   — t        j                  d«        | j                  di |¤ŽS )zGDEPRECATED: use :py:meth:`sentry_sdk.tracing.Span.start_child` instead.z^Deprecated: use Span.start_child instead of Span.new_span. This will be removed in the future.r=   )r   Úwarningr†   ©r-   rV   s     r.   Únew_spanzSpan.new_spanú   s+   € ô 	�‰Ølô	
ð  ˆt×ÑÑ) &Ñ)Ð)r0   c                 óz   — | t         u rt        j                  d«       t        j                  t        |«      fi |¤ŽS )a(  
        Create a Transaction with the given params, then add in data pulled from
        the ``sentry-trace`` and ``baggage`` headers from the environ (if any)
        before returning the Transaction.

        This is different from :py:meth:`~sentry_sdk.tracing.Span.continue_from_headers`
        in that it assumes header names in the form ``HTTP_HEADER_NAME`` -
        such as you would get from a WSGI/ASGI environ -
        rather than the form ``header-name``.

        :param environ: The ASGI/WSGI environ to pull information from.
        zXDeprecated: use Transaction.continue_from_environ instead of Span.continue_from_environ.)r?   r   rˆ   rT   Úcontinue_from_headersÚEnvironHeaders)rU   ÚenvironrV   s      r.   Úcontinue_from_environzSpan.continue_from_environ  s9   € ð& ”$‰;Ü�N‰Nð9ôô ×0Ñ0´ÀÓ1HÑSÈFÑSÐSr0   c                 ód  — | t         u rt        j                  d«       t        j                  |j                  t        «      «      }|j                  t        |i«       t        |j                  t        «      «      }|�!|j                  |«       |j                  «        t        di |¤Ž}d|_        |S )zë
        Create a transaction with the given params (including any data pulled from
        the ``sentry-trace`` and ``baggage`` headers).

        :param headers: The dictionary with the HTTP headers to pull information from.
        zXDeprecated: use Transaction.continue_from_headers instead of Span.continue_from_headers.Fr=   )r?   r   rˆ   ÚBaggageÚfrom_incoming_headerÚgetÚBAGGAGE_HEADER_NAMEÚupdateÚextract_sentrytrace_dataÚSENTRY_TRACE_HEADER_NAMEÚfreezerT   rC   )rU   ÚheadersrV   r   Úsentrytrace_kwargsrQ   s         r.   rŒ   zSpan.continue_from_headers  sž   € ð ”$‰;Ü�N‰Nð9ôô ×.Ñ.¨w¯{©{Ô;NÓ/OÓPˆØ�‰Ô*¨GÐ4Ô5ä5Ø�K‰KÔ0Ó1ó
Ðð Ð)Ø�M‰MÐ,Ô-ð
 �N‰NÔä!Ñ+ FÑ+ˆØ-2ˆÔ*àÐr0   c              #   óÀ   K  — t         | j                  «       f–— | j                  r6| j                  j                  «       j	                  «       }|rt
        |f–— yyy­w)zó
        Creates a generator which returns the span's ``sentry-trace`` and ``baggage`` headers.
        If the span's containing transaction doesn't yet have a ``baggage`` value,
        this will cause one to be generated and stored.
        N)r—   Úto_traceparentr]   Úget_baggageÚ	serializer”   )r-   r   s     r.   Úiter_headerszSpan.iter_headersF  sZ   è ø€ ô '¨×(;Ñ(;Ó(=Ð=Ò=à×&Ò&Ø×1Ñ1×=Ñ=Ó?×IÑIÓKˆGÙÜ)¨7Ð2Ó2ð ð 'ùs   ‚AAc                 ód   — t        j                  d«       |sy | j                  t        |ifi |¤ŽS )a  
        DEPRECATED: Use :py:meth:`sentry_sdk.tracing.Span.continue_from_headers`.

        Create a ``Transaction`` with the given params, then add in data pulled from
        the given ``sentry-trace`` header value before returning the ``Transaction``.
        zwDeprecated: Use Transaction.continue_from_headers(headers, **kwargs) instead of from_traceparent(traceparent, **kwargs)N)r   rˆ   rŒ   r—   )rU   ÚtraceparentrV   s      r.   Úfrom_traceparentzSpan.from_traceparentT  sC   € ô 	�‰ðAô	
ñ
 Øà(ˆs×(Ñ(Ü% {Ð3ñ
Ø7=ñ
ð 	
r0   c                 ó˜   — | j                   du rd}n| j                   du rd}nd }| j                  ›d| j                  ›�}|�|d|›�z  }|S )NTÚ1FÚ0ú-)rD   r@   rA   )r-   rD   r¡   s      r.   rœ   zSpan.to_traceparentm  sT   € à�<‰<˜4ÑØ‰GØ�\‰\˜UÑ"Ø‰GàˆGà!%§£°·²Ð=ˆØÐÙ¡GÐ-Ñ-ˆKàÐr0   c                 óP   — | j                   r| j                   j                  «       S y)z™Returns the :py:class:`~sentry_sdk.tracing_utils.Baggage`
        associated with this ``Span``, if any. (Taken from the root of the span tree.)
        N)r]   r�   rh   s    r.   Ú
to_baggagezSpan.to_baggage|  s%   € ð
 ×&Ò&Ø×.Ñ.×:Ñ:Ó<Ð<Ør0   c                 ó"   — || j                   |<   y r2   )rK   ©r-   Úkeyry   s      r.   Úset_tagzSpan.set_tag…  ó   € àˆ�
‰
�3Šr0   c                 ó"   — || j                   |<   y r2   )rL   rª   s      r.   Úset_datazSpan.set_data‰  r­   r0   c                 ó   — || _         y r2   ©rI   ©r-   ry   s     r.   rv   zSpan.set_status�  s	   € àˆ�r0   c                 óè  — | j                  dt        |«      «       | j                  t        j                  |«       |dk  r| j                  d«       y d|cxk  rdk  rŸn nœ|dk(  r| j                  d«       y |dk(  r| j                  d«       y |d	k(  r| j                  d
«       y |dk(  r| j                  d«       y |dk(  r| j                  d«       y |dk(  r| j                  d«       y | j                  d«       y d|cxk  rdk  rZn nW|dk(  r| j                  d«       y |dk(  r| j                  d«       y |dk(  r| j                  d«       y | j                  d«       y | j                  d«       y )Nzhttp.status_codei�  Úokiô  i“  Úpermission_deniedi”  Ú	not_foundi­  Úresource_exhaustedi�  Úfailed_preconditioni‘  Úunauthenticatedi™  Úalready_existsÚinvalid_argumentiX  iø  Údeadline_exceedediõ  Úunimplementedi÷  Úunavailableru   Úunknown_error)r¬   Ústrr¯   r
   ÚHTTP_STATUS_CODErv   ©r-   Úhttp_statuss     r.   Úset_http_statuszSpan.set_http_status‘  s<  € à�‰Ø¤ KÓ 0ô	
ð 	�‰”h×/Ñ/°Ô=à˜ÒØ�O‰O˜DÕ!Ø�KÔ% #Õ%Ø˜cÒ!Ø—‘Ð 3Õ4Ø Ò#Ø—‘ Õ,Ø Ò#Ø—‘Ð 4Õ5Ø Ò#Ø—‘Ð 5Õ6Ø Ò#Ø—‘Ð 1Õ2Ø Ò#Ø—‘Ð 0Õ1à—‘Ð 2Õ3Ø�KÔ% #Õ%Ø˜cÒ!Ø—‘Ð 3Õ4Ø Ò#Ø—‘ Õ0Ø Ò#Ø—‘ Õ.à—‘Ð 0Õ1à�O‰O˜OÕ,r0   c                 ó    — | j                   dk(  S )Nr´   r±   rh   s    r.   Ú
is_successzSpan.is_successµ  s   € à�{‰{˜dÑ"Ð"r0   c                 óP  — | j                   �y|xs( | j                  xs t        j                  j                  }	 |r|| _         n8t        «       | j                  z
  }| j                  t        |dz  ¬«      z   | _         t        || «       y# t        $ r t        «       | _         Y Œ'w xY w)a4  Sets the end timestamp of the span.
        Additionally it also creates a breadcrumb from the span,
        if the span represents a database or HTTP request.

        :param hub: The hub to use for this transaction.
            If not provided, the current hub will be used.
        :param end_timestamp: Optional timestamp that should
            be used as timestamp instead of the current time.

        :return: Always ``None``. The type is ``Optional[str]`` to match
            the return value of :py:meth:`sentry_sdk.tracing.Transaction.finish`.
        Niè  )Úmicroseconds)rJ   rM   rl   rm   rn   r   rH   rG   r   r\   r   Ú"maybe_create_breadcrumbs_from_span)r-   rM   Úend_timestampÚelapseds       r.   rw   zSpan.finish¹  sš   € ð" �>‰>Ð%ààÒ7�T—X‘XÒ7¤§¡×!7Ñ!7ˆð		/ÙØ!.�•ä)Ó+¨d×.PÑ.PÑP�Ø!%×!5Ñ!5¼	Ø!(¨4¡ô9ñ "�”ô 	+¨3°Ô5Øøô	 ò 	/Ü,Ó.ˆDŽNð	/ús   »AB
 Â
B%Â$B%c           	      óR  — | j                   | j                  | j                  | j                  | j                  | j
                  | j                  | j                  dœ}| j                  r| j                  | j                  d<   | j                  }|r||d<   | j                  }|r||d<   |S )z5Returns a JSON-compatible representation of the span.)r@   rA   rB   rC   rE   rF   rG   rJ   rI   ÚtagsÚdata)r@   rA   rB   rC   rE   rF   rG   rJ   rI   rK   rL   )r-   ÚrvrÍ   rÎ   s       r.   Úto_jsonzSpan.to_jsonÞ  s•   € ð
 Ÿ™Ø—|‘|Ø"×1Ñ1Ø&*×&AÑ&AØ—'‘'Ø×+Ñ+Ø#×3Ñ3ØŸ™ñ	
ˆð �;Š;Ø#'§;¡;ˆD�J‰J�xÑ à�z‰zˆÙØˆBˆv‰Jà�z‰zˆÙØˆBˆv‰Jàˆ	r0   c                 ó  — | j                   | j                  | j                  | j                  | j                  dœ}| j
                  r| j
                  |d<   | j                  r+| j                  j                  «       j                  «       |d<   |S )N)r@   rA   rB   rE   rF   rI   Údynamic_sampling_context)	r@   rA   rB   rE   rF   rI   r]   r�   rÒ   )r-   rÏ   s     r.   Úget_trace_contextzSpan.get_trace_contextú  s‚   € ð Ÿ™Ø—|‘|Ø"×1Ñ1Ø—'‘'Ø×+Ñ+ñ
ˆð �;Š;ØŸ;™;ˆBˆx‰Là×&Ò&ð ×+Ñ+×7Ñ7Ó9×RÑRÓTð Ø*ñð ˆ	r0   )NNNTNNNNNNNN©NN) r8   r9   r:   r;   r<   rS   r/   r_   ri   rs   r{   Úpropertyr]   r   ÚSENTRYr†   rŠ   Úclassmethodr�   rŒ   rŸ   r¢   rœ   r¨   r¬   r¯   rv   rÄ   rÆ   rw   rÐ   rÓ   r=   r0   r.   r?   r?   S   sö   „ ñEð€Iò(#ð  ØØØ#ØØØØØØØ#Øó'#òV8ò

òò	ð ñ	,ó ð	,ð (4×':Ñ':ó òB*ð ñTó ðTð2 ñ'ó ð'òR3ð ñ
ó ð
ò0òò ò òò"-òH#ó#òJó8r0   r?   c                   ó”   ‡ — e Zd ZdZdZdddefˆ fd„	Zd„ Zˆ fd„Zˆ fd„Z	e
d	„ «       Zdˆ fd
„	Zdd„Zd„ Zˆ fd„Zˆ fd„Zd„ Zd„ Zˆ xZS )rT   zhThe Transaction is the root element that holds all the spans
    for Sentry performance instrumentation.)ÚnameÚsourceÚparent_sampledÚsample_rateÚ_measurementsÚ	_contextsÚ_profileÚ_baggageÚ Nc                 óô   •— |s*d|v r&t        j                  d«       |j                  d«      }t        t        | �  di |¤Ž || _        || _        d| _        || _	        i | _
        i | _        d| _        || _        y)a³  Constructs a new Transaction.

        :param name: Identifier of the transaction.
            Will show up in the Sentry UI.
        :param parent_sampled: Whether the parent transaction was sampled.
            If True this transaction will be kept, if False it will be discarded.
        :param baggage: The W3C baggage header value.
            (see https://www.w3.org/TR/baggage/)
        :param source: A string describing the source of the transaction name.
            This will be used to determine the transaction's type.
            See https://develop.sentry.dev/sdk/event-payloads/transaction/#transaction-annotations
            for more information. Default "custom".
        rQ   z^Deprecated: use Transaction(name=...) to create transactions instead of Span(transaction=...).Nr=   )r   rˆ   ÚpopÚsuperrT   r/   rÙ   rÚ   rÜ   rÛ   rÝ   rÞ   rß   rà   )r-   rÙ   rÛ   r   rÚ   rV   rg   s         €r.   r/   zTransaction.__init__  s}   ø€ ñ2 ˜¨Ñ/Ü�N‰Nð4ôð —:‘:˜mÓ,ˆDäŒk˜4Ñ)Ñ3¨FÒ3àˆŒ	ØˆŒØˆÔØ,ˆÔØˆÔØˆŒØˆŒØˆ�r0   c                 óì   — d| j                   j                  ›d| j                  ›d| j                  ›d| j                  ›d| j
                  ›d| j                  ›d| j                  ›d| j                  ›d	�S )
Nra   z(name=z, op=rb   rc   rd   re   z	, source=rf   )	rg   r8   rÙ   rE   r@   rA   rB   rD   rÚ   rh   s    r.   ri   zTransaction.__repr__I  sN   � ð
 —‘×'Ó'Ø—	“	Ø—“Ø—“Ø—“Ø×#Ó#Ø—“Ø—“ð
ð	
r0   c                 óx   •— t         t        | �  «        | j                  �| j                  j                  «        | S r2   )rä   rT   rs   rß   )r-   rg   s    €r.   rs   zTransaction.__enter__Y  s/   ø€ äŒk˜4Ñ*Ô,à�=‰=Ð$Ø�M‰M×#Ñ#Ô%àˆr0   c                 ó‚   •— | j                   �| j                   j                  |||«       t        t        | �  |||«       y r2   )rß   r{   rä   rT   )r-   rx   ry   rz   rg   s       €r.   r{   zTransaction.__exit__b  s6   ø€ à�=‰=Ð$Ø�M‰M×"Ñ" 2 u¨bÔ1äŒk˜4Ñ)¨"¨e°RÕ8r0   c                 ó   — | S )znThe root element of the span tree.
        In the case of a transaction it is the transaction itself.
        r=   rh   s    r.   r]   z"Transaction.containing_transactioni  s	   € ð ˆr0   c           	      óÀ  •— | j                   �y|xs( | j                  xs t        j                  j                  }|j
                  }|€y| j                  €~t        j                  d«       |j                  r\t        |j                  «      rG|j                  r|j                  j                  dkD  rd}nd}|j                  j                  |d¬«       y| j                  st        j                   d«       d	| _        t"        t$        | �O  ||«       | j(                  s"| j(                  €t        j                   d
«       y| j                  j*                  D �cg c]  }|j                   �|j-                  «       ‘Œ  }}d| _        i }|j/                  | j0                  «       |j/                  d| j3                  «       i«       d| j                  d| j4                  i|| j6                  | j                   | j8                  |dœ}| j:                  �0| j:                  j=                  «       r| j:                  |d<   d| _        | j>                  |d<   |jA                  |«      S c c}w )aÖ  Finishes the transaction and sends it to Sentry.
        All finished spans in the transaction will also be sent to Sentry.

        :param hub: The hub to use for this transaction.
            If not provided, the current hub will be used.
        :param end_timestamp: Optional timestamp that should
            be used as timestamp instead of the current time.

        :return: The event ID if the transaction was sent to Sentry,
            otherwise None.
        Nz.Discarding transaction because sampled = Falser   ÚbackpressurerÜ   rQ   )Údata_categoryzCTransaction has no name, falling back to `<unlabeled transaction>`.z<unlabeled transaction>z1Discarding transaction without sampling decision.ÚtracerÚ   )ÚtyperQ   Útransaction_infoÚcontextsrÍ   rJ   rG   r)   ÚprofileÚmeasurements)!rJ   rM   rl   rm   rn   r   r4   r   ÚdebugÚ	transportÚhas_tracing_enabledr€   ÚmonitorÚdownsample_factorÚrecord_lost_eventrÙ   rˆ   rä   rT   rw   rD   r)   rÐ   r•   rÞ   rÓ   rÚ   rK   rG   rß   ÚvalidrÝ   Úcapture_event)
r-   rM   rÊ   r   Úreasonr6   Úfinished_spansrï   Úeventrg   s
            €r.   rw   zTransaction.finishu  s
  ø€ ð �>‰>Ð%ààÒ7�T—X‘XÒ7¤§¡×!7Ñ!7ˆØ—‘ˆàˆ>àð ×ÑÐ&Ü�L‰LÐIÔJð
 ×ÒÔ$7¸¿¹Ô$GØ—>’> f§n¡n×&FÑ&FÈÒ&JØ+‘Fà*�Fà× Ñ ×2Ñ2°6ÈÐ2ÔWàà�yŠyÜ�N‰NØUôð 2ˆDŒIäŒk˜4Ñ'¨¨]Ô;à�|Š|ð �|‰|Ð#Ü—‘ÐRÔSàð ×+Ñ+×1Ñ1ö
àØ�~‰~Ð)ð �L‰L�Nð
ˆð 
ð #ˆÔàˆØ�‰˜Ÿ™Ô'Ø�‰˜ $×"8Ñ"8Ó":Ð;Ô<ð "ØŸ9™9Ø!)¨4¯;©;Ð 7Ø Ø—J‘JØŸ™Ø#×3Ñ3Ø#ñ	
ˆð �=‰=Ð$¨¯©×)<Ñ)<Ô)>Ø#Ÿ}™}ˆE�)ÑØ ˆDŒMà $× 2Ñ 2ˆˆnÑà× Ñ  Ó'Ð'ùòC
s   Å#Ic                 ó(   — ||dœ| j                   |<   y )N)ry   Úunit)rÝ   ©r-   rÙ   ry   rþ   s       r.   Úset_measurementzTransaction.set_measurementÑ  s   € à-2¸DÑ#Aˆ×Ñ˜4Ò r0   c                 ó"   — || j                   |<   y)a  Sets a context. Transactions can have multiple contexts
        and they should follow the format described in the "Contexts Interface"
        documentation.

        :param key: The name of the context.
        :param value: The information about the context.
        N)rÞ   rª   s      r.   Úset_contextzTransaction.set_contextÕ  s   € ð $ˆ�‰�sÒr0   c                 óT   •— t         t        | �  |«       | j                  dd|i«       y)zySets the status of the Transaction according to the given HTTP status.

        :param http_status: The HTTP status code.ÚresponseÚstatus_codeN)rä   rT   rÄ   r  )r-   rÃ   rg   s     €r.   rÄ   zTransaction.set_http_statusà  s)   ø€ ô
 	Œk˜4Ñ0°Ô=Ø×Ñ˜ m°[Ð%AÕBr0   c                 ó†   •— t         t        | �  «       }| j                  |d<   | j                  |d<   | j
                  |d<   |S )z<Returns a JSON-compatible representation of the transaction.rÙ   rÚ   rD   )rä   rT   rÐ   rÙ   rÚ   rD   )r-   rÏ   rg   s     €r.   rÐ   zTransaction.to_jsonè  s@   ø€ ô ”; Ñ-Ó/ˆà—Y‘Yˆˆ6‰
Ø—{‘{ˆˆ8‰ØŸ™ˆˆ9‰àˆ	r0   c                 ó’   — | j                   r| j                   j                  rt        j                  | «      | _         | j                   S )z¾Returns the :py:class:`~sentry_sdk.tracing_utils.Baggage`
        associated with the Transaction.

        The first time a new baggage with Sentry items is made,
        it will be frozen.)rà   Úmutabler‘   Úpopulate_from_transactionrh   s    r.   r�   zTransaction.get_baggageó  s3   € ð �}Š} §¡× 5Ò 5Ü#×=Ñ=¸dÓCˆDŒMà�}‰}Ðr0   c           
      óª  — | j                   xs t        j                  j                  }|j                  }|xr |j
                  xs i }dj                  | j                  rd| j                  z   dz   nd| j                  ¬«      }|rt        |«      sd| _
        y| j                  �t        | j                  «      | _        yt        |j                  d«      «      r |d   |«      n|d	   �|d	   n|d
   }t        |d¬«      s-t!        j"                  dj                  |¬«      «       d| _
        yt        |«      | _        |j$                  r,| xj                  d|j$                  j&                  z  z  c_        | j                  sJt!        j(                  dj                  |t        |j                  d«      «      rdnd¬«      «       d| _
        yt+        j*                  «       | j                  k  | _
        | j                  r&t!        j(                  dj                  |¬«      «       yt!        j(                  dj                  || j                  ¬«      «       y)aO  
        Sets the transaction's sampling decision, according to the following
        precedence rules:

        1. If a sampling decision is passed to `start_transaction`
        (`start_transaction(name: "my transaction", sampled: True)`), that
        decision will be used, regardless of anything else

        2. If `traces_sampler` is defined, its decision will be used. It can
        choose to keep or ignore any parent sampling decision, or use the
        sampling context data to make its own decision or to choose a sample
        rate for the transaction.

        3. If `traces_sampler` is not defined, but there's a parent sampling
        decision, the parent sampling decision will be used.

        4. If `traces_sampler` is not defined and there's no parent sampling
        decision, `traces_sample_rate` will be used.
        z{op}transaction <{name}>ra   z> rá   )rE   rÙ   FNÚtraces_samplerrÛ   Útraces_sample_rateÚTracing)rÚ   zN[Tracing] Discarding {transaction_description} because of invalid sample rate.)Útransaction_descriptioné   z?[Tracing] Discarding {transaction_description} because {reason}z"traces_sampler returned 0 or Falseztraces_sample_rate is set to 0)r  rú   z,[Tracing] Starting {transaction_description}z}[Tracing] Discarding {transaction_description} because it's not included in the random sample (sampling rate = {sample_rate}))r  rÜ   )rM   rl   rm   rn   r   r€   ÚformatrE   rÙ   rô   rD   ÚfloatrÜ   Úcallabler“   r   r   rˆ   rõ   rö   rò   Úrandom)r-   Úsampling_contextrM   r   r€   r  rÜ   s          r.   Ú_set_initial_sampling_decisionz*Transaction._set_initial_sampling_decision   s2  € ð, �h‰hÒ0œ*Ÿ.™.×0Ñ0ˆØ—‘ˆØÒ,˜fŸn™nÒ3°ˆØ"<×"CÑ"CØ(,¯ª��d—g‘g‘ Ò$°R¸t¿y¹yð #Dó #
Ðñ
 Ô0°Ô9Ø ˆDŒLØð �<‰<Ð#Ü$ T§\¡\Ó2ˆDÔØô ˜Ÿ™Ð$4Ó5Ô6ð &ˆGÐ$Ñ%Ð&6Ô7ð
 $Ð$4Ñ5ÐAð !Ð!1Ò2àÐ1Ñ2ð 	ô $ K¸	ÕBÜ�N‰NØ`×gÑgØ,Cð hó ôð
 !ˆDŒLØä  Ó-ˆÔà�>Š>Ø×Ò  6§>¡>×#CÑ#CÑ CÑCÕð ×ÒÜ�L‰LØQ×XÑXØ,Cô $ G§K¡KÐ0@Ó$AÔBñ =à=ð Yó ô	ð !ˆDŒLØô
 —}‘}“¨×)9Ñ)9Ñ9ˆŒà�<Š<Ü�L‰LØ>×EÑEØ,Cð Fó õô �L‰Lð P÷  Wñ  WØ,CØ $× 0Ñ 0ð Wó õr0   rÔ   ©rá   )r8   r9   r:   r;   r<   ÚTRANSACTION_SOURCE_CUSTOMr/   ri   rs   r{   rÕ   r]   rw   r   r  rÄ   rÐ   r�   r  Ú__classcell__)rg   s   @r.   rT   rT     sn   ø„ ñ/ð
€Ið ØØØ(õ) òV
ô ô9ð ñ	ó ð	õZ(óxBò	$ôCô	òöhr0   rT   c                   óª   — e Zd Zd„ Zed„ «       Zej                  fd„Zd„ Z	d„ Z
d„ Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdd„Zdd„Zd„ Zd„ Zd„ Zy)r�   c                 ó.   — | j                   j                  S r2   )rg   r8   rh   s    r.   ri   zNoOpSpan.__repr__l  s   € à�~‰~×&Ñ&Ð&r0   c                  ó   — y r2   r=   rh   s    r.   r]   zNoOpSpan.containing_transactionp  s   € ð r0   c                 ó   — t        «       S r2   )r�   )r-   r~   rV   s      r.   r†   zNoOpSpan.start_childu  s
   € ä‹zÐr0   c                 ó&   —  | j                   di |¤ŽS ©Nr=   )r†   r‰   s     r.   rŠ   zNoOpSpan.new_spany  s   € àˆt×ÑÑ) &Ñ)Ð)r0   c                  ó   — y)Nrá   r=   rh   s    r.   rœ   zNoOpSpan.to_traceparent}  s   € àr0   c                  ó   — y r2   r=   rh   s    r.   r¨   zNoOpSpan.to_baggage�  ó   € àr0   c                  ó   — y r2   r=   rh   s    r.   r�   zNoOpSpan.get_baggage…  r!  r0   c                 ó   — t        d«      S r  )Úiterrh   s    r.   rŸ   zNoOpSpan.iter_headers‰  s   € ä�B‹xˆr0   c                  ó   — y r2   r=   rª   s      r.   r¬   zNoOpSpan.set_tag�  ó   € àr0   c                  ó   — y r2   r=   rª   s      r.   r¯   zNoOpSpan.set_data‘  r&  r0   c                  ó   — y r2   r=   r²   s     r.   rv   zNoOpSpan.set_status•  r&  r0   c                  ó   — y r2   r=   rÂ   s     r.   rÄ   zNoOpSpan.set_http_status™  r&  r0   c                  ó   — y)NTr=   rh   s    r.   rÆ   zNoOpSpan.is_success�  r!  r0   c                 ó   — i S r2   r=   rh   s    r.   rÐ   zNoOpSpan.to_json¡  ó   € àˆ	r0   c                 ó   — i S r2   r=   rh   s    r.   rÓ   zNoOpSpan.get_trace_context¥  r,  r0   Nc                  ó   — y r2   r=   )r-   rM   rÊ   s      r.   rw   zNoOpSpan.finish©  r&  r0   c                  ó   — y r2   r=   rÿ   s       r.   r   zNoOpSpan.set_measurement­  r&  r0   c                  ó   — y r2   r=   rª   s      r.   r  zNoOpSpan.set_context±  r&  r0   c                  ó   — y r2   r=   r,   s     r.   r_   zNoOpSpan.init_span_recorderµ  r&  r0   c                  ó   — y r2   r=   )r-   r  s     r.   r  z'NoOpSpan._set_initial_sampling_decision¹  r&  r0   rÔ   r  )r8   r9   r:   ri   rÕ   r]   r   rÖ   r†   rŠ   rœ   r¨   r�   rŸ   r¬   r¯   rv   rÄ   rÆ   rÐ   rÓ   rw   r   r  r_   r  r=   r0   r.   r�   r�   k  s€   „ ò'ð ñó ðð (4×':Ñ':ó ò*òòòòòòòòòòòóóòòór0   r�   c                 ó@   — t         rddlm} nddlm} | r || «      S |S )av  
    Decorator to start a child span under the existing current transaction.
    If there is no current transaction, then nothing will be traced.

    .. code-block::
        :caption: Usage

        import sentry_sdk

        @sentry_sdk.trace
        def my_function():
            ...

        @sentry_sdk.trace
        async def my_async_function():
            ...
    r   )Ústart_child_span_decorator)r	   Úsentry_sdk.tracing_utils_py2r4  Úsentry_sdk.tracing_utils_py3)Úfuncr4  s     r.   rì   rì   ¾  s#   € õ& ÞKåKñ Ù)¨$Ó/Ð/à)Ð)r0   )r‘   r�   r–   rô   rÉ   r2   )2rY   r  r   r   rl   Úsentry_sdk.constsr   Úsentry_sdk.utilsr   r   r   Úsentry_sdk._compatr   r	   r
   Úsentry_sdk._typesr   Útypingr   r   r   r   r   r   Úsentry_sdk.profilerr   r   r   r”   r—   r  ÚTRANSACTION_SOURCE_URLÚTRANSACTION_SOURCE_ROUTEÚTRANSACTION_SOURCE_VIEWÚTRANSACTION_SOURCE_COMPONENTÚTRANSACTION_SOURCE_TASKÚLOW_QUALITY_TRANSACTION_SOURCESÚSOURCE_FOR_STYLErR   r&   r?   rT   r�   rì   Úsentry_sdk.tracing_utilsr‘   r�   r–   rô   rÉ   r=   r0   r.   ú<module>rF     sø   ðÛ Û å ã Ý *ß JÑ Jß 3Ý &Ý +ñ Ûå!ÝÝÝÝÝÝãßIÑIð  Ð Ø)Ð ð
 %Ð ØÐ Ø"Ð Ø Ð Ø*Ð Ø Ð ð ð#Ð ð
 -Ø1Ø0Ø7Ø"Ø.Ø-Ø,Ø#ñ
Ð ô$�Fô $ô.xˆ6ô xôvZ�$ô Zôz
Pˆtô Póf*÷Dö r0   