o
    i                     @   sT   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 Zd	S )
    )template)config)Pin)	SpanTypes)	COMPONENT)tracerc                 C   s   t t}|r| s| |i |S d|jv rd }}n|j }}tjd|j|tj	d}|
ttjj |
d| | |i |W  d   S 1 sLw   Y  dS )z
    Wrap the ``generate`` method used in templates rendering. Because the method
    may be called everywhere, the execution is traced in a tracer StackContext that
    inherits the current one if it's already available.
    z<string>render_stringztornado.template)serviceresource	span_typeztornado.template_nameN)r   get_fromr   enablednamer   tracer	   r   TEMPLATE_set_tag_strr   r   tornadointegration_name)funcrendererargskwargspinr
   template_namespan r   ]/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/contrib/internal/tornado/template.pygenerate
   s   



$r   N)r   r   ddtracer   ddtrace._trace.pinr   ddtrace.extr   ddtrace.internal.constantsr   ddtrace.tracer   r   r   r   r   r   <module>   s    