
    Ph                         d dl Z d dlZd dlmZ d dlmZ dZdZdZdZ	ej                  r2ej                  j                  Zej                  j                  Zd Zd	 Zd
 Zd Zd Zy)    N)httplib)apizX-B3-TraceIdzX-B3-SpanIdzX-B3-ParentSpanIdzX-B3-Sampledc                    t        j                         rt        j                         }t        j                         }| j	                  t
        t        |j                               | j	                  t        t        |             | j	                  t        t        |j                               | j	                  t        t        |j                               t        j                  d       t        |        y )NzClient Send)r   
is_tracingget_trace_datagenerate_span_id	putheaderHDR_TRACE_IDhex_strtrace_idHDR_SPAN_IDHDR_PARENT_SPAN_IDspan_idHDR_SAMPLEDintsampledput_annotation__org_endheaders__)self
trace_datanew_span_ids      _C:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\eventlet/zipkin/http.py_patched_endheadersr      s    >>++-J..0KNN<1D1D)EFNN;(<=NN-wz7I7I/JKNN;J,>,>(?@}-4     c                     t        |        t        j                         r#t        j                  d| j                  z         y y )NzClient Recv (%s))__org_begin__r   r   r   status)r   s    r   _patched_beginr      s1    d>>1DKK?@ r   c                      t         j                  r2t        t        j                  _        t        t        j                  _        t         j                  rt        j                  d       y y )NzSince current Python thrift release         doesn't support Python 3, eventlet.zipkin.http         doesn't also support Python 3 (http.client))sixPY2r   r   HTTPConnection
endheadersr   HTTPResponsebeginPY3warningswarn r   r   patchr*   &   sB    
ww,?)%3"
ww 5 	6 r   c                      t         j                  r2t        t        j                  _        t        t        j                  _        t         j                  ry y )N)
r    r!   r   r   r"   r#   r   r$   r%   r&   r)   r   r   unpatchr,   0   s4    
ww,>)%2"
ww r   c                     d| fz  S )z
    Thrift uses a binary representation of trace and span ids
    HTTP headers use a hexadecimal representation of the same
    z%0.16xr)   )ns    r   r   r   8   s    
 qd?r   )r'   r    eventlet.greenr   eventlet.zipkinr   r
   r   r   r   r!   r"   r#   r   r$   r%   r   r   r   r*   r,   r   r)   r   r   <module>r1      sn     
 "  (  77 //::((..M
!A6r   