o
    Zhb                     @   sl   d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZ er0d dlmZ dd	 ZdS )
    N)wraps)get_current_span)TYPE_CHECKING)OP)loggerqualname_from_function)Anyc                    s:   t  rt  fdd}|S t  fdd}|S )a  
    Decorator to add child spans for functions.

    This is the Python 3 compatible version of the decorator.
    For Python 2 there is duplicated code here: ``sentry_sdk.tracing_utils_python2.start_child_span_decorator()``.

    See also ``sentry_sdk.tracing.trace()``.
    c                     s   t tjj}|d u rtdt   | i |I d H S |jtj	t d  | i |I d H W  d    S 1 s<w   Y  d S NzcCan not create a child span for %s. Please start a Sentry transaction before calling this function.)opdescription
r   
sentry_sdkZHubcurrentr   warningr   Zstart_childr   ZFUNCTIONargskwargsspanfunc S/var/www/html/lang_env/lib/python3.10/site-packages/sentry_sdk/tracing_utils_py3.pyfunc_with_tracing   s   $z5start_child_span_decorator.<locals>.func_with_tracingc                     sx   t tjj}|d u rtdt   | i |S |jtj	t d  | i |W  d    S 1 s5w   Y  d S r	   r   r   r   r   r   r   4   s   $)inspectiscoroutinefunctionr   )r   r   r   r   r   start_child_span_decorator   s   
*r   )r   	functoolsr   r   r   Zsentry_sdk._typesr   Zsentry_sdk.constsr   Zsentry_sdk.utilsr   r   typingr   r   r   r   r   r   <module>   s    