o
    g                     @   s   d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	m
Z
 dZedZ	dde
dee d	efd
dZddee d	e
fddZdS )    )Optional)
create_key	get_value	set_value)Context)INVALID_SPANSpanzcurrent-spanNspancontextreturnc                 C   s   t t| |d}|S )zSet the span in the given context.

    Args:
        span: The Span to set.
        context: a Context object. if one is not passed, the
            default current context is used instead.
    r
   )r   	_SPAN_KEY)r	   r
   ctx r   _/var/www/visachat/venv/lib/python3.10/site-packages/opentelemetry/trace/propagation/__init__.pyset_span_in_context   s   
r   c                 C   s&   t t| d}|du st|tstS |S )zRetrieve the current span.

    Args:
        context: A Context object. If one is not passed, the
            default current context is used instead.

    Returns:
        The Span set in the context if it exists. INVALID_SPAN otherwise.
    r   N)r   r   
isinstancer   r   )r
   r	   r   r   r   get_current_span&   s   
r   )N)typingr   opentelemetry.contextr   r   r   opentelemetry.context.contextr   opentelemetry.trace.spanr   r   SPAN_KEYr   r   r   r   r   r   r   <module>   s   
