§
    ZŠtjR  ã            	       ó  — U d 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
mZ  ee¦  «        Zdej        fdej        d	edz  d
ej        ej                 defd„Zdej        fdej        d	edz  dej        ej                 ddfd„Zdej        fd„Z e¦   «         aej        ed<   g Zeej                 ed<    ej        ed¦  «        Ze                     d¦  «        D ]Ze                     ¦   «         ZŒdej        fd„Z dej        ddfd„Z!dS )a`  
API for propagation of context.

The propagators for the
``opentelemetry.propagators.composite.CompositePropagator`` can be defined
via configuration in the ``OTEL_PROPAGATORS`` environment variable. This
variable should be set to a comma-separated string of names of values for the
``opentelemetry_propagator`` entry point. For example, setting
``OTEL_PROPAGATORS`` to ``tracecontext,baggage`` (which is the default value)
would instantiate
``opentelemetry.propagators.composite.CompositePropagator`` with 2
propagators, one of type
``opentelemetry.trace.propagation.tracecontext.TraceContextTextMapPropagator``
and other of type ``opentelemetry.baggage.propagation.W3CBaggagePropagator``.
Notice that these propagator classes are defined as
``opentelemetry_propagator`` entry points in the ``pyproject.toml`` file of
``opentelemetry``.

Example::

    import flask
    import requests
    from opentelemetry import propagate


    PROPAGATOR = propagate.get_global_textmap()


    def get_header_from_flask_request(request, key):
        return request.headers.get_all(key)

    def set_header_into_requests_request(request: requests.Request,
                                            key: str, value: str):
        request.headers[key] = value

    def example_route():
        context = PROPAGATOR.extract(
            get_header_from_flask_request,
            flask.request
        )
        request_to_downstream = requests.Request(
            "GET", "http://httpbin.org/get"
        )
        PROPAGATOR.inject(
            set_header_into_requests_request,
            request_to_downstream,
            context=context
        )
        session = requests.Session()
        session.send(request_to_downstream.prepare())


.. _Propagation API Specification:
    https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md
é    )Ú	getLogger)Úenviron)ÚContext)ÚOTEL_PROPAGATORS)Ú	compositeÚtextmapNÚcarrierÚcontextÚgetterÚreturnc                 óJ   — t          ¦   «                              | ||¬¦  «        S )aZ  Uses the configured propagator to extract a Context from the carrier.

    Args:
        getter: an object which contains a get function that can retrieve zero
            or more values from the carrier and a keys function that can get all the keys
            from carrier.
        carrier: and object which contains values that are
            used to construct a Context. This object
            must be paired with an appropriate getter
            which understands how to extract a value from it.
        context: an optional Context to use. Defaults to root
            context if not set.
    )r   )Úget_global_textmapÚextract)r	   r
   r   s      ú^/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/opentelemetry/propagate/__init__.pyr   r   F   s%   € õ$ ÑÔ×'Ò'¨°ÀÐ'ÑHÔHÐHó    Úsetterc                 óN   — t          ¦   «                              | ||¬¦  «         dS )aç  Uses the configured propagator to inject a Context into the carrier.

    Args:
        carrier: the medium used by Propagators to read
            values from and write values to.
            Should be paired with setter, which
            should know how to set header values on the carrier.
        context: An optional Context to use. Defaults to current
            context if not set.
        setter: An optional `Setter` object that can set values
            on the carrier.
    )r
   r   N)r   Úinject)r	   r
   r   s      r   r   r   [   s+   € õ" ÑÔ×Ò °ÀÐÑHÔHÐHÐHÐHr   c                  óò  — t          j        t          ¦  «        } | s2ddlm} ddlm} t          j         |¦   «          |¦   «         g¦  «        S ddl	m
} g }|                      d¦  «        D ]ù}|                     ¦   «         }|                     ¦   «         dk    r0t                               d¦  «         t          j        g ¦  «        c S 	 |                      t#          t%           |d|¬	¦  «        ¦  «        ¦  «                             ¦   «         ¦   «         ¦  «         Œ´# t(          $ r t+          d
|› d�¦  «        ‚t,          $ r t                               d|¦  «         ‚ w xY wt          j        |¦  «        S )Nr   )ÚW3CBaggagePropagator)ÚTraceContextTextMapPropagator)Úentry_pointsú,ÚnonezMOTEL_PROPAGATORS environment variable contains none, removing all propagatorsÚopentelemetry_propagator)ÚgroupÚnamezPropagator z5 not found. It is either misspelled or not installed.zFailed to load propagator: %s)r   Úgetr   Ú!opentelemetry.baggage.propagationr   Ú,opentelemetry.trace.propagation.tracecontextr   r   ÚCompositePropagatorÚ&opentelemetry.util._importlib_metadatar   ÚsplitÚstripÚlowerÚloggerÚdebugÚappendÚnextÚiterÚloadÚStopIterationÚ
ValueErrorÚ	ExceptionÚ	exception)Ú
configuredr   r   r   Ú_propagatorsÚ_propagators         r   Ú_load_propagatorsr3   o   s  € Ý”Õ-Ñ.Ô.€JØð 
ð	
ð 	
ð 	
ð 	
ð 	
ð 	
ð
	
ð 	
ð 	
ð 	
ð 	
ð 	
õ Ô,Ø*Ð*Ñ,Ô,Ð.BÐ.BÑ.DÔ.DÐEñ
ô 
ð 	
ð
ð ð ð ð ð ð 57€LØ!×'Ò'¨Ñ,Ô,ð ð ˆØ!×'Ò'Ñ)Ô)ˆØ×ÒÑÔ &Ò(Ð(Ý�LŠLØ_ñô ð õ Ô0°Ñ4Ô4Ð4Ð4Ð4ð	Ø×Òð•ÝØ$˜Ø"<Ø!,ðñ ô ñô ñô ÷ ’$‘&”&ñô ñ	ô 	ð 	ð 	øõ ð 	ð 	ð 	ÝØ`˜kÐ`Ð`Ð`ñô ð õ ð 	ð 	ð 	Ý×ÒÐ<¸kÑJÔJÐJØð	øøøõ Ô(¨Ñ6Ô6Ð6s   Ã
ADÄAE"Ú_HTTP_TEXT_FORMATÚpropagatorsztracecontext,baggager   c                  ó   — t           S ©N©r4   © r   r   r   r   ­   s   € ÝÐr   Úhttp_text_formatc                 ó
   — | a d S r7   r8   )r:   s    r   Úset_global_textmapr<   ±   s   € ð )ÐÐÐr   )"Ú__doc__Úloggingr   Úosr   Úopentelemetry.context.contextr   Ú#opentelemetry.environment_variablesr   Úopentelemetry.propagatorsr   r   Ú__name__r&   Údefault_getterÚCarrierTÚGetterr   Údefault_setterÚSetterr   ÚTextMapPropagatorr3   r4   Ú__annotations__r5   Úlistr   Úenviron_propagatorsr#   Ú
propagatorr$   r   r<   r9   r   r   ú<module>rN      s8  ðð6ð 6ð 6ðp Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø @Ð @Ð @Ð @Ð @Ð @Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8à	ˆ�8Ñ	Ô	€ð
 #Ø/6Ô/EðIð IØÔðIà�t‰^ðIð ŒN˜7Ô+Ô,ðIð ð	Ið Ið Ið Ið. #Ø/6Ô/EðIð IØÔðIà�t‰^ðIð ŒN˜7Ô+Ô,ðIð 
ð	Ið Ið Ið Ið(07˜7Ô4ð 07ð 07ð 07ð 07ðf 0AÐ/@Ñ/BÔ/BÐ �7Ô,Ð BÐ BÑ Bð 02€ˆT�'Ô+Ô,Ð 1Ð 1Ñ 1à!�g”kÐ"2Ð4JÑKÔKÐ à%×+Ò+¨CÑ0Ô0ð $ð $€JØ×!Ò!Ñ#Ô#€J€Jð˜GÔ5ð ð ð ð ð)ØÔ/ð)à	ð)ð )ð )ð )ð )ð )r   