
    Zjl                        U 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lmZ d dlm	Z d dlmZ eed	Zd
ed<   ddZddZddZdS )    )annotations)W3CBaggagePropagator)set_global_textmap)CompositePropagator)TextMapPropagator)load_entry_point)
Propagator)TraceContextTextMapPropagator)tracecontextbaggagez"dict[str, type[TextMapPropagator]]_PROPAGATOR_REGISTRYconfigTextMapPropagatorConfigreturnlist[TextMapPropagator]c                   g }t                                           D ]3\  }}t          | |d          |                     |                       4dD ]>}t          | |d          +|                     t	          d|                                 ?| j                                        D ]0\  }}|                     t	          d|          di |pi            1|S )aW  Resolve a TextMapPropagator config to a list of propagators.

    Known names (tracecontext, baggage) are bootstrapped directly via
    _PROPAGATOR_REGISTRY. Known schema fields not in the registry (b3, b3multi)
    and unknown plugin names from additional_properties are loaded via the
    ``opentelemetry_propagator`` entry point group.
    N)b3b3multiopentelemetry_propagator )r   itemsgetattrappendr   additional_properties)r   resultnameclsplugin_configs        i/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/opentelemetry/sdk/_configuration/_propagator.py _propagators_from_textmap_configr       s    ')F)//11 ! !	c64&&2MM##%%    " P P64&&2MML*+EtLLNNOOO  &;AACC 
 
m>7>>   &B 	
 	
 	
 	
 M    PropagatorConfig | Noner   c                ,   | t          g           S i }| j        r?| j        D ]7}t          |          D ]%}|                    t	          |          |           &8| j        r| j                            d          D ]l}|                                }|r|                                dk    r1 t          d|                      }|                    t	          |          |           mt          t          |                                                    S )u  Create a CompositePropagator from declarative config.

    If config is None or has no propagators defined, returns an empty
    CompositePropagator (no-op), ensuring "what you see is what you get"
    semantics — the env-var-based default propagators are not used.

    Args:
        config: Propagator config from the parsed config file, or None.

    Returns:
        A CompositePropagator wrapping all configured propagators.
    N,noner   )r   	compositer    
setdefaulttypecomposite_listsplitstriplowerr   listvalues)r   propagatorsentry
propagatorr   s        r   create_propagatorr2   ;   s4    ~"2&&&DFK  E% 	E 	EE>uEE E E
&&tJ'7'7DDDDE  A)//44 	A 	AD::<<D 4::<<611K)*DdKKMMJ""4
#3#3Z@@@@tK$6$6$8$899:::r!   Nonec                >    t          t          |                      dS )a&  Configure the global text map propagator from declarative config.

    Always calls set_global_textmap to override any defaults (including the
    env-var-based tracecontext+baggage default set by the SDK).

    Args:
        config: Propagator config from the parsed config file, or None.
    N)r   r2   )r   s    r   configure_propagatorr5   a   s!     (0011111r!   N)r   r   r   r   )r   r"   r   r   )r   r"   r   r3   )
__future__r   !opentelemetry.baggage.propagationr   opentelemetry.propagater   #opentelemetry.propagators.compositer   !opentelemetry.propagators.textmapr   (opentelemetry.sdk._configuration._commonr   'opentelemetry.sdk._configuration.modelsr	   PropagatorConfigr   ,opentelemetry.trace.propagation.tracecontextr
   r   __annotations__r    r2   r5   r   r!   r   <module>r@      s@   # " " " " " " B B B B B B 6 6 6 6 6 6 C C C C C C ? ? ? ? ? ? E E E E E E                2#< <        >#; #; #; #;L	2 	2 	2 	2 	2 	2r!   