
    `i                     d    d Z ddlZddlmZ ddlmZ erddlmZ ddlmZm	Z	  G d d          Z
dS )	z
The API in this file is only meant to be used in span streaming mode.

You can enable span streaming mode via
sentry_sdk.init(_experiments={"trace_lifecycle": "stream"}).
    N)TYPE_CHECKING)format_attribute)Optional)
AttributesAttributeValuec                       e Zd ZdZdZddddedddd	fd
ZddZdeddddfdZddZ	deddfdZ
edefd            ZdS )StreamedSpanz
    A span holds timing information of a block of code.

    Spans can have multiple child spans thus forming a span tree.

    This is the Span First span implementation. The original transaction-based
    span implementation lives in tracing.Span.
    )name_attributes	_trace_idN)
attributestrace_idr
   r   zOptional[Attributes]r   zOptional[str]c                    || _         i | _        |r0|                                D ]\  }}|                     ||           || _        d S N)r
   r   itemsset_attributer   )selfr
   r   r   	attributevalues         e/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/sentry_sdk/traces.py__init__zStreamedSpan.__init__"   s_     	)+ 	5$.$4$4$6$6 5 5 	5""9e4444!    returnr   c                     | j         S r   )r   r   s    r   get_attributeszStreamedSpan.get_attributes1   s    r   keyr   r   c                 4    t          |          | j        |<   d S r   )r   r   )r   r   r   s      r   r   zStreamedSpan.set_attribute4   s     0 7 7r   c                 f    |                                 D ]\  }}|                     ||           d S r   )r   r   )r   r   r   r   s       r   set_attributeszStreamedSpan.set_attributes7   sD    $**,, 	+ 	+JCsE****	+ 	+r   c                 :    	 | j         |= d S # t          $ r Y d S w xY wr   )r   KeyError)r   r   s     r   remove_attributezStreamedSpan.remove_attribute;   s:    	 %%% 	 	 	DD	s    
c                 X    | j         st          j                    j        | _         | j         S r   )r   uuiduuid4hexr   s    r   r   zStreamedSpan.trace_idA   s$    ~ 	.!Z\\-DN~r   )r   r   )r   r   r   N)__name__
__module____qualname____doc__	__slots__strr   r   r   r    r#   propertyr    r   r   r	   r	      s        I .2$(" " " " +	"
 "" " " "       8 8-= 8$ 8 8 8 8+ + + +C D     #    X  r   r	   )r+   r%   typingr   sentry_sdk.utilsr   r   sentry_sdk._typesr   r   r	   r/   r   r   <module>r3      s                  - - - - - - =<<<<<<<<4 4 4 4 4 4 4 4 4 4r   