
     <i*                        U d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZmZ ddlmZ  ee          Zd	ej        fd
ej        dee	         dej        ej                 de	fdZd	ej        fd
ej        dee	         dej        ej                 dd	fdZg Zeej                 ed<    ej        ed          Ze                    d          D ]Z e !                                Z e "                                dk    re#                    d           g Z n	 e$                      e% e& ede                               '                                                       # e($ r  e)de  d          e*$ r e+                    de             w xY w ej,        e          a-ej        ed<   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)ListOptional)Context)OTEL_PROPAGATORS)	compositetextmap)entry_pointsN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      /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/opentelemetry/propagate/__init__.pyr   r   S   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   h   s+    " HHHHHr   propagatorsztracecontext,baggage,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_HTTP_TEXT_FORMATc                      t           S Nr    r   r   r   r      s    r   http_text_formatc                 
    | a d S r    r!   )r#   s    r   set_global_textmapr%      s     )r   )0__doc__loggingr   osr   typingr   r   opentelemetry.context.contextr   #opentelemetry.environment_variablesr   opentelemetry.propagatorsr	   r
   &opentelemetry.util._importlib_metadatar   __name__loggerdefault_getterCarrierTGetterr   default_setterSetterr   r   TextMapPropagator__annotations__getenviron_propagatorssplit
propagatorstriplowerdebugappendnextiterloadStopIteration
ValueError	Exception	exceptionCompositePropagatorr   r   r%   r"   r   r   <module>rG      sv  6 6 6p             ! ! ! ! ! ! ! ! 1 1 1 1 1 1 @ @ @ @ @ @ 8 8 8 8 8 8 8 8 ? ? ? ? ? ?	8		
 "&/6/EI IIgI N7+,I 	I I I I. "&/6/EI IIgI N7+,I 
	I I I I( 02T'+, 1 1 1 "gk   &++C00  J!!##JV##[	
 	
 	
 DD L8'     dff 		
 		
 		
 		
  
 
 
j[*[[[
 
 	
    8*EEE
 0My/L0 0 7,   
G5    )/)	) ) ) ) ) )s   AE((0F