o
    Á¿iX  ã                   @   sP   d Z ddlmZ ddlmZ dZdZdZdZdd„ Z	d	d
„ Z
dd„ Zdd„ ZdS )z3
Some utils used by the dogtrace kombu integration
é    )Úkombu)Úneté   é	   é   c                 C   sB   z| j  d¡\}}tj|tj|tj| jiW S  ty    i  Y S w )z-Transform kombu conn info into dogtrace metasú:)	ÚhostÚsplitr   ÚTARGET_HOSTÚTARGET_PORTÚkombuxÚVHOSTÚvirtual_hostÚAttributeError)Ú
connectionr   Úport© r   úX/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/contrib/internal/kombu/utils.pyÚextract_conn_tags   s   ýþr   c                 C   s   | t  S )zrExtract the exchange

    The publish method extracts the name and hands that off to _publish (what we patch)
    )ÚPUBLISH_EXCHANGE_IDX)Úargsr   r   r   Úget_exchange_from_args   s   r   c                 C   s   | t  }|S )zExtract the routing key)ÚPUBLISH_ROUTING_KEY)r   Únamer   r   r   Úget_routing_key_from_args'   s   r   c                 C   s   t | t ƒ}|S )zExtract the length of the body)ÚlenÚPUBLISH_BODY_IDX)r   Úlengthr   r   r   Úget_body_length_from_args.   s   r   N)Ú__doc__Úddtrace.extr   r   r   r   r   r   Ú
HEADER_POSr   r   r   r   r   r   r   r   Ú<module>   s    	