o
    i                     @   sV   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 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                   @   s   e Zd ZdZdZddddedddd	fd
dZdddZdeddddfddZdddZ	deddfddZ
edefd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                C   s8   || _ i | _|r| D ]
\}}| || q|| _d S N)r   r	   itemsset_attributer
   )selfr   r   r   	attributevalue r   N/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/sentry_sdk/traces.py__init__"   s   
zStreamedSpan.__init__returnr   c                 C   s   | j S r   )r	   r   r   r   r   get_attributes1   s   zStreamedSpan.get_attributeskeyr   r   c                 C   s   t || j|< d S r   )r   r	   )r   r   r   r   r   r   r   4   s   zStreamedSpan.set_attributec                 C   s"   |  D ]
\}}| || qd S r   )r   r   )r   r   r   r   r   r   r   set_attributes7   s   zStreamedSpan.set_attributesc                 C   s$   z| j |= W d S  ty   Y d S w r   )r	   KeyError)r   r   r   r   r   remove_attribute;   s
   zStreamedSpan.remove_attributec                 C   s   | j s	t j| _ | j S r   )r
   uuiduuid4hexr   r   r   r   r   A   s   zStreamedSpan.trace_id)r   r   )r   r   r   N)__name__
__module____qualname____doc__	__slots__strr   r   r   r   r   propertyr   r   r   r   r   r      s$    	



r   )r#   r   typingr   sentry_sdk.utilsr   r   sentry_sdk._typesr   r   r   r   r   r   r   <module>   s    