§
    xŠtjü^  ã            	       ó   — U d Z ddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ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mZmZ ddlmZ ddl m!Z! ddl"m#Z# dZ$edz  e%d<   	 ddl$Z&e&Z$n# e'$ r Y nw xY we#Z(ee)e(f         Z* ej+        e,¦  «        Z-e!j.        Z.e!j/        Z/e!j0        Z0e!j1        Z1e!j2        Z2e!j3        Z3e!j4        Z4e!j5        Z5e!j6        Z6e!j7        Z7e!j8        Z8e!j9        Z9e!j:        Z:e!j;        Z;e!j<        Z<e!j=        Z=e!j>        Z>e!j?        Z?e!j@        Z@e!jA        ZBe!jC        ZDe!jE        ZFe!jG        ZHe!jI        ZJe!jK        ZLe!jM        ZNe!jO        ZPe!jQ        ZRe!jS        ZTe!jU        ZVe!jW        ZXe!jY        ZZe!j[        Z\e!j]        Z^e!j_        Z`e!ja        Zbe!jc        Zce!jd        Zde!je        Zee!jf        Zfe!jg        Zge!jh        Zhe!ji        Zie!jj        Zje!jk        Zke!jl        Zle!jm        Zme!jn        Zne!jo        Zoe!jp        Zpe!jq        Zqe!jr        Zre!js        Zse!jt        Zte!ju        Zue!jv        Zve!jw        Zwe!jx        Zx G d„ d¦  «        Zy eyi ¦  «        Zz eyexdeudevei¦  «        Z{da|e)dz  e%d<   da}e~dz  e%d<    e	j        ¦   «         Z€ G d„ dej�        ¦  «        Z‚ G d„ de‚¦  «        Zƒ G d„ de‚¦  «        Z„ G d„ de‚¦  «        Z… G d„ de‚¦  «        Z† G d„ d e‚¦  «        Z‡d!eˆd         fd"„Z‰d!eyfd#„ZŠ	 	 d)d%ed         d&eydz  d'e~d!dfd(„Z‹dS )*aè  
This package implements `OpenTelemetry Resources
<https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#resource-sdk>`_:

    *A Resource is an immutable representation of the entity producing
    telemetry. For example, a process producing telemetry that is running in
    a container on Kubernetes has a Pod name, it is in a namespace and
    possibly is part of a Deployment which also has a name. All three of
    these attributes can be included in the Resource.*

Resource objects are created with `Resource.create`, which accepts attributes
(key-values). Resources should NOT be created via constructor except by `ResourceDetector`
instances which can't use `Resource.create` to avoid infinite loops. Working with
`Resource` objects should only be done via the Resource API methods. Resource
attributes can also be passed at process invocation in the
:envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable. You should register
your resource with the  `opentelemetry.sdk.trace.TracerProvider` by passing
them into their constructors. The `Resource` passed to a provider is available
to the exporter, which can send on this information as it sees fit.

.. code-block:: python

    trace.set_tracer_provider(
        TracerProvider(
            resource=Resource.create({
                "service.name": "shoppingcart",
                "service.instance.id": "instance-12",
            }),
        ),
    )
    print(trace.get_tracer_provider().resource.attributes)

    {'telemetry.sdk.language': 'python',
    'telemetry.sdk.name': 'opentelemetry',
    'telemetry.sdk.version': '0.13.dev0',
    'service.name': 'shoppingcart',
    'service.instance.id': 'instance-12'}

Note that the OpenTelemetry project documents certain `"standard attributes"
<https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md>`_
that have prescribed semantic meanings, for example ``service.name`` in the
above example.
é    N)ÚMappingÚSequence)Údumps)Úenviron)Ú
ModuleType)Úcast)Úparse)ÚBoundedAttributes)Ú$OTEL_EXPERIMENTAL_RESOURCE_DETECTORSÚOTEL_RESOURCE_ATTRIBUTESÚOTEL_SERVICE_NAME)Ú__version__)ÚResourceAttributes)ÚAttributeValueÚpsutilc                   ó  — e Zd ZU dZeed<   eed<   ddededz  fd„Ze		 	 ddedz  dedz  dd fd	„¦   «         Z
e	dd
„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zdd„Zdedefd„Zdefd„Zddedz  defd„ZdS )ÚResourcezZA Resource is an immutable representation of the entity producing telemetry as Attributes.Ú_attributesÚ_schema_urlNÚ
attributesÚ
schema_urlc                 óF   — t          |¬¦  «        | _        |€d}|| _        d S )N)r   Ú )r
   r   r   )Úselfr   r   s      úb/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/opentelemetry/sdk/resources/__init__.pyÚ__init__zResource.__init__ž   s.   € Ý,¸
ÐCÑCÔCˆÔØÐØˆJØ%ˆÔÐÐó    Úreturnc                 óª  — | si } t          t          ¦   «         t          ¦  «                             t	          | |¦  «        ¦  «        }|j                             t          d¦  «        sld}t          t          dz  |j                             t          d¦  «        ¦  «        }|r|d|z   z  }|                     t	          t          |i|¦  «        ¦  «        }|S )a9  Creates a new `Resource` from attributes.

        `ResourceDetector` instances should not call this method.

        Args:
            attributes: Optional zero or more key-value pairs.
            schema_url: Optional URL pointing to the schema

        Returns:
            The newly-created Resource.
        NÚunknown_serviceú:)Úget_aggregated_resourcesÚ_build_resource_detectorsÚ_DEFAULT_RESOURCEÚmerger   r   ÚgetÚSERVICE_NAMEr   ÚstrÚPROCESS_EXECUTABLE_NAME)r   r   ÚresourceÚdefault_service_nameÚprocess_executable_names        r   ÚcreatezResource.create¤   sà   € ð" ð 	ØˆJå+Ý%Ñ'Ô'Õ):ñ
ô 
ç
Š%•˜ ZÑ0Ô0Ñ
1Ô
1ð 	ð Ô"×&Ò&¥|°TÑ:Ô:ð 
	Ø#4Ð Ý&*Ý�d‘
ØÔ#×'Ò'Õ(?ÀÑFÔFñ'ô 'Ð#ð 'ð FØ$¨Ð.EÑ(EÑEÐ$Ø—~’~Ý�,Ð(<Ð=¸zÑJÔJñô ˆHð ˆr   c                  ó   — t           S ©N)Ú_EMPTY_RESOURCE© r   r   Ú	get_emptyzResource.get_emptyÉ   s   € åÐr   c                 ó   — | j         S r/   )r   ©r   s    r   r   zResource.attributesÍ   ó   € àÔÐr   c                 ó   — | j         S r/   )r   r4   s    r   r   zResource.schema_urlÑ   r5   r   Úotherc                 óJ  — t          | j        ¦  «        }|                     |j        ¦  «         | j        dk    r|j        }nS|j        dk    r| j        }n@| j        |j        k    r|j        }n(t                               d| j        |j        ¦  «         | S t          ||¦  «        S )a^  Merges this resource and an updating resource into a new `Resource`.

        If a key exists on both the old and updating resource, the value of the
        updating resource will override the old resource value.

        The updating resource's `schema_url` will be used only if the old
        `schema_url` is empty. Attempting to merge two resources with
        different, non-empty values for `schema_url` will result in an error
        and return the old resource.

        Args:
            other: The other resource to be merged.

        Returns:
            The newly-created Resource.
        r   zEFailed to merge resources: The two schemas %s and %s are incompatible)Údictr   Úupdater   ÚloggerÚerrorr   )r   r7   Úmerged_attributesr   s       r   r%   zResource.mergeÕ   s¯   € õ" ! ¤Ñ1Ô1ÐØ× Ò  Ô!1Ñ2Ô2Ð2àŒ?˜bÒ Ð ØÔ)ˆJˆJØÔ Ò#Ð#ØœˆJˆJØŒ_ Ô 0Ò0Ð0ØÔ)ˆJˆJå�LŠLØWØ”ØÔ ñô ð ð
 ˆKÝÐ)¨:Ñ6Ô6Ð6r   c                 óp   — t          |t          ¦  «        sdS | j        |j        k    o| j        |j        k    S )NF)Ú
isinstancer   r   r   )r   r7   s     r   Ú__eq__zResource.__eq__ø   s?   € Ý˜%¥Ñ*Ô*ð 	Ø�5àÔ Ô 1Ò1ð 6ØÔ  EÔ$5Ò5ð	
r   c                 ó€   — t          t          | j                             ¦   «         d¬¦  «        › d| j        › �¦  «        S )NT)Ú	sort_keysú|)Úhashr   r   Úcopyr   r4   s    r   Ú__hash__zResource.__hash__   sD   € ÝÝ�TÔ%×*Ò*Ñ,Ô,¸Ð=Ñ=Ô=ÐRÐRÀÔ@PÐRÐRñ
ô 
ð 	
r   é   Úindentc                 óX   — t          t          | j        ¦  «        | j        dœ|¬¦  «        S )N)r   r   )rH   )r   r9   r   r   )r   rH   s     r   Úto_jsonzResource.to_json  s;   € Ýå" 4¤?Ñ3Ô3Ø"Ô.ðð ð ð
ñ 
ô 
ð 	
r   r/   )NN©r   r   )r7   r   r   r   )rG   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   Ú__annotations__r(   Ú
Attributesr   Ústaticmethodr-   r2   Úpropertyr   r   r%   ÚobjectÚboolr@   ÚintrF   rJ   r1   r   r   r   r   ˜   s™  € € € € € € ØdÐdà"Ð"Ð"Ñ"ØÐÐÑð&ð & :ð &¸3À¹:ð &ð &ð &ð &ð à(,Ø!%ð"ð "Ø Ñ%ð"à˜$‘Jð"ð 
ð"ð "ð "ñ „\ð"ðH ðð ð ñ „\ðð ð ˜Jð  ð  ð  ñ „Xð ð ð ˜Cð  ð  ð  ñ „Xð ð!7ð !7ð !7ð !7ðF
˜Fð 
 tð 
ð 
ð 
ð 
ð
˜#ð 
ð 
ð 
ð 
ð

ð 
˜c D™jð 
°ð 
ð 
ð 
ð 
ð 
ð 
r   r   ÚpythonÚopentelemetryÚ_service_instance_idÚ_service_instance_id_pidc                   óN   — e Zd Zd	deddfd„Zej        d
d„¦   «         Zdefd„ZdS )ÚResourceDetectorFÚraise_on_errorr   Nc                 ó   — || _         d S r/   ©r]   )r   r]   s     r   r   zResourceDetector.__init__   s   € Ø,ˆÔÐÐr   r   c                 ó   — t          ¦   «         ‚)zdDon't call `Resource.create` here to avoid an infinite loop, instead instantiate `Resource` directly)ÚNotImplementedErrorr4   s    r   ÚdetectzResourceDetector.detect#  s   € õ "Ñ#Ô#Ð#r   c                 ó   — dS )a  Return whether this detector depends on the current process identity.

        Process dependent detectors may return resource attributes that become
        stale after a process identity change, such as :func:`os.fork`.
        Detectors returning ``True`` should be re-run after such changes so the
        resulting :class:`Resource` describes the current process.

        Returns:
            ``True`` if this detector should be re-run after process identity
            changes otherwise ``False``.
        Fr1   r4   s    r   Úis_process_dependentz%ResourceDetector.is_process_dependent)  s	   € ð ˆur   ©FrK   )	rL   rM   rN   rU   r   ÚabcÚabstractmethodrb   rd   r1   r   r   r\   r\     sz   € € € € € ð-ð - tð -¸ð -ð -ð -ð -ð 	Ôð$ð $ð $ñ Ôð$ð
 dð ð ð ð ð ð r   r\   c                   ó   — e Zd Zdd„ZdS )ÚOTELResourceDetectorr   r   c                 óì  — t          j        t          ¦  «        }i }|r¤|                     d¦  «        D ]Ž}	 |                     dd¬¦  «        \  }}n3# t          $ r&}t
                               d||¦  «         Y d }~ŒId }~ww xY wt          j        | 	                    ¦   «         ¦  «        }||| 	                    ¦   «         <   Œ�t          j        t          ¦  «        }|r
||t          <   t          |¦  «        S )Nú,ú=é   )Úmaxsplitz0Invalid key value resource attribute pair %s: %s)r   r&   r   ÚsplitÚ
ValueErrorr;   Úwarningr	   ÚunquoteÚstripr   r'   r   )	r   Úenv_resources_itemsÚenv_resource_mapÚitemÚkeyÚvalueÚexcÚvalue_url_decodedÚservice_names	            r   rb   zOTELResourceDetector.detect:  s  € Ý%œkÕ*BÑCÔCÐØ68Ðàð 	BØ+×1Ò1°#Ñ6Ô6ð Bð B�ðØ!%§¢¨C¸! Ñ!<Ô!<‘J�C˜˜øÝ!ð ð ð Ý—N’NØJØØñô ð ð
 �H�H�H�Høøøøðøøøõ %*¤M°%·+²+±-´-Ñ$@Ô$@Ð!Ø0AÐ  §¢¡¤Ñ-Ð-å”{Õ#4Ñ5Ô5ˆØð 	:Ø-9Ð�\Ñ*ÝÐ(Ñ)Ô)Ð)s   ¶AÁ
BÁA<Á<BNrK   )rL   rM   rN   rb   r1   r   r   ri   ri   8  s(   € € € € € ð*ð *ð *ð *ð *ð *r   ri   c                   óN   ‡ — e Zd ZdZ	 dddœdededdfˆ fd„Zdefd	„Zdd„Zˆ xZS )ÚProcessResourceDetectoraR  Detect process resource attributes.

    Args:
        raise_on_error: Raise errors from detection instead of logging them.
        include_command_args: Include ``process.command_args`` and
            ``process.command_line``. These attributes can contain sensitive
            command-line values, so they are excluded by default.
    F)Úinclude_command_argsr]   r~   r   Nc                óZ   •— t          ¦   «                              |¬¦  «         || _        d S )Nr_   )Úsuperr   Ú_include_command_args)r   r]   r~   Ú	__class__s      €r   r   z ProcessResourceDetector.__init__\  s.   ø€ õ 	‰Œ×Ò¨ÐÑ7Ô7Ð7Ø%9ˆÔ"Ð"Ð"r   c                 ó   — dS ©NTr1   r4   s    r   rd   z,ProcessResourceDetector.is_process_dependentf  ó   € Øˆtr   r   c                 ó¶  — d                      t          t          t          j        j        dk    r%t          j        j        st          j        d d…         nt          j        ¦  «        ¦  «        }t          j        ¦   «         }t          j	        }t          j
                             |¦  «        }t          j        rt          j        d         nd}t          t          j        t          t          j        j        t$          |t&          |t(          |t*          |t,          |i}| j        r@t1          t          j        ¦  «        }d                      |¦  «        |t2          <   ||t4          <   t7          t          d¦  «        rt          j        ¦   «         |t:          <   t<          �7t<                               ¦   «         }|                      ¦   «         }	|	|tB          <   tE          |¦  «        S )Nú.Úfinalé   r   r   ú Úgetppid)#ÚjoinÚmapr(   ÚsysÚversion_infoÚreleaselevelÚserialÚosÚgetpidÚ
executableÚpathÚdirnameÚ	orig_argvÚPROCESS_RUNTIME_DESCRIPTIONÚversionÚPROCESS_RUNTIME_NAMEÚimplementationÚnameÚPROCESS_RUNTIME_VERSIONÚPROCESS_PIDr)   ÚPROCESS_EXECUTABLE_PATHÚPROCESS_COMMANDr�   ÚlistÚPROCESS_COMMAND_LINEÚPROCESS_COMMAND_ARGSÚhasattrr‹   ÚPROCESS_PARENT_PIDr   ÚProcessÚusernameÚPROCESS_OWNERr   )
r   Ú_runtime_versionÚ_process_pidÚ_process_executable_nameÚ_process_executable_pathÚ_process_commandÚresource_infoÚ_process_argvÚprocessr§   s
             r   rb   zProcessResourceDetector.detecti  s  € ØŸ8š8ÝÝõ Ô'Ô4¸Ò?Ð?ÝÔ,Ô3ð @õ Ô$ R a RÔ(Ð(õ Ô)ñô ñ

ô 

Ðõ ”y‘{”{ˆÝ#&¤>Ð Ý#%¤7§?¢?Ð3KÑ#LÔ#LÐ õ 03¬}ÐD�3œ=¨Ô+Ð+À"Ðå'­¬Ý ¥#Ô"4Ô"9Ý#Ð%5Ý˜Ý#Ð%=Ý#Ð%=ÝÐ-ð4
ˆð Ô%ð 	@Ý ¥¤Ñ/Ô/ˆMØ25·(²(¸=Ñ2IÔ2IˆMÕ.Ñ/Ø2?ˆMÕ.Ñ/å•2�yÑ!Ô!ð 	=å02´
±´ˆMÕ,Ñ-åÐÝ—n’nÑ&Ô&ˆGØ×'Ò'Ñ)Ô)ˆHØ+3ˆM�-Ñ(å˜Ñ&Ô&Ð&r   re   rK   )	rL   rM   rN   rO   rU   r   rd   rb   Ú__classcell__)r‚   s   @r   r}   r}   R  s«   ø€ € € € € ðð ð  %ð:ð &+ð	:ð :ð :àð:ð #ð	:ð
 
ð:ð :ð :ð :ð :ð :ð dð ð ð ð ð,'ð ,'ð ,'ð ,'ð ,'ð ,'ð ,'ð ,'r   r}   c                   ó   — e Zd ZdZdd„ZdS )ÚOsResourceDetectorzxDetect os resources based on `Operating System conventions <https://opentelemetry.io/docs/specs/semconv/resource/os/>`_.r   r   c                 ó  — t          j        ¦   «                              ¦   «         }t          j        ¦   «         }|dk    rt          j        ¦   «         }n|dk    rd}t          j        ¦   «         }t          t          |t          |i¦  «        S )a³  Returns a resource with with ``os.type`` and ``os.version``.

        Python's platform library
        ~~~~~~~~~~~~~~~~~~~~~~~~~

        To grab this information, Python's ``platform`` does not return what a
        user might expect it to. Below is a breakdown of its return values in
        different operating systems.

        .. code-block:: python
            :caption: Linux

            >>> platform.system()
            'Linux'
            >>> platform.release()
            '6.5.0-35-generic'
            >>> platform.version()
            '#35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 09:00:52 UTC 2'

        .. code-block:: python
            :caption: MacOS

            >>> platform.system()
            'Darwin'
            >>> platform.release()
            '23.0.0'
            >>> platform.version()
            'Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:57 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8112'

        .. code-block:: python
            :caption: Windows

            >>> platform.system()
            'Windows'
            >>> platform.release()
            '2022Server'
            >>> platform.version()
            '10.0.20348'

        .. code-block:: python
            :caption: FreeBSD

            >>> platform.system()
            'FreeBSD'
            >>> platform.release()
            '14.1-RELEASE'
            >>> platform.version()
            'FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC'

        .. code-block:: python
            :caption: Solaris

            >>> platform.system()
            'SunOS'
            >>> platform.release()
            '5.11'
            >>> platform.version()
            '11.4.0.15.0'

        ÚwindowsÚsunosÚsolaris)ÚplatformÚsystemÚlowerÚreleaser™   r   ÚOS_TYPEÚ
OS_VERSION)r   Úos_typeÚ
os_versions      r   rb   zOsResourceDetector.detect›  sˆ   € õ| ”/Ñ#Ô#×)Ò)Ñ+Ô+ˆÝÔ%Ñ'Ô'ˆ
ð �iÒÐÝ!Ô)Ñ+Ô+ˆJˆJà˜ÒÐØˆGÝ!Ô)Ñ+Ô+ˆJåå˜Ý˜Jðñ
ô 
ð 	
r   NrK   ©rL   rM   rN   rO   rb   r1   r   r   r³   r³   ˜  s:   € € € € € ð Cð  CðN
ð N
ð N
ð N
ð N
ð N
r   r³   c                   ó   — e Zd ZdZdd„ZdS )Ú_HostResourceDetectorzT
    The HostResourceDetector detects the hostname and architecture attributes.
    r   r   c                 ó€   — t          t          t          j        ¦   «         t          t          j        ¦   «         i¦  «        S r/   )r   Ú	HOST_NAMEÚsocketÚgethostnameÚ	HOST_ARCHr¸   Úmachiner4   s    r   rb   z_HostResourceDetector.detectñ  s5   € Ýå�6Ô-Ñ/Ô/Ý�8Ô+Ñ-Ô-ðñ
ô 
ð 	
r   NrK   rÀ   r1   r   r   rÂ   rÂ   ì  s2   € € € € € ðð ð
ð 
ð 
ð 
ð 
ð 
r   rÂ   c                   ó&   — e Zd ZdZdefd„Zdd„ZdS )Ú!ServiceInstanceIdResourceDetectorah  Detects service.instance.id as a random UUID v4.

    Per the OpenTelemetry specification, SDKs SHOULD generate a random v1/v4
    UUID for service.instance.id to uniquely identify each service instance.
    The ID is shared across all detector instances within the same process and
    regenerated automatically when the process PID changes (e.g. after a fork).

    Note: because this detector is process dependent, providers refresh it
    automatically after a fork and merge the newly detected value on top of
    the existing resource. This means that if a user explicitly sets
    `service.instance.id` (e.g. via OTEL_RESOURCE_ATTRIBUTES or
    Resource.create(attributes=...)), that value will be overwritten with a
    newly generated UUID the next time the process forks. This differs from
    Resource.create(), which does preserve user supplied overrides.
    r   c                 ó   — dS r„   r1   r4   s    r   rd   z6ServiceInstanceIdResourceDetector.is_process_dependent  r…   r   r   c                 ó  — t           5  t          j        ¦   «         }t          �t          |k    r"t          t          j        ¦   «         ¦  «        a|at          }d d d ¦  «         n# 1 swxY w Y   t          t          |i¦  «        S r/   )
Ú_service_instance_id_lockr’   r“   rY   rZ   r(   ÚuuidÚuuid4r   ÚSERVICE_INSTANCE_ID)r   Úcurrent_pidÚinstance_ids      r   rb   z(ServiceInstanceIdResourceDetector.detect  s°   € õ 'ð 	/ð 	/Ýœ)™+œ+ˆKå$Ð,Ý+¨{Ò:Ð:å'*­4¬:©<¬<Ñ'8Ô'8Ð$Ø+6Ð(Ý.ˆKð	/ð 	/ð 	/ñ 	/ô 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/øøøð 	/ð 	/ð 	/ð 	/õ Õ,¨kÐ:Ñ;Ô;Ð;s   ˆAA#Á#A'Á*A'NrK   )rL   rM   rN   rO   rU   rd   rb   r1   r   r   rÊ   rÊ   ú  sM   € € € € € ðð ð  dð ð ð ð ð<ð <ð <ð <ð <ð <r   rÊ   r   c                  ó   — t          t                               d„ t          j        t
          d¦  «                             d¦  «        D ¦   «         ddgz   ¦  «        ¦  «        } | ddgk    rt          ¦   «         t          ¦   «         gS ddl	m
} d| v rwt          d	„  |d
¬¦  «        j        D ¦   «         ¦  «        }t          |t          | ¦  «        z
  ¦  «        }|                      d¦  «        }| d|…         |z   | |dz   d…         z   } g }| D ]‚}	 |                      t!          t#           |d
|¬¦  «        ¦  «        ¦  «                             ¦   «         ¦   «         ¦  «         ŒX# t&          $ r t(                               d|¦  «         Y Œw xY w|S )a!  Returns the ordered list of resource detectors to use for Resource.create.

    Fast path: if no extra detectors are configured, returns only the two
    built-in detectors without scanning entry_points.

    "service_instance" (ServiceInstanceIdResourceDetector) and "otel"
    (OTELResourceDetector) are always appended as defaults. "otel" is last so
    that OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME take highest merge
    priority, but an explicit position in OTEL_EXPERIMENTAL_RESOURCE_DETECTORS
    is respected for either name.
    c                 ó^   — g | ]*}|                      ¦   «         ¯|                      ¦   «         ‘Œ+S r1   )rs   ©Ú.0rœ   s     r   ú
<listcomp>z-_build_resource_detectors.<locals>.<listcomp>+  s@   € ð ð ð àð —:’:‘<”<ðØ—
’
‘”ðð ð r   r   rk   Úservice_instanceÚotelr   )Úentry_pointsÚ*c              3   ó&   K  — | ]}|d k    ¯|V — ŒdS )rÙ   Nr1   rÕ   s     r   ú	<genexpr>z,_build_resource_detectors.<locals>.<genexpr>@  s8   è è € ð 
ð 
àð �vŠ~ˆ~ð	 ð ˆ~ˆ~ˆ~ð
ð 
r   Úopentelemetry_resource_detector)ÚgroupNrm   )rß   rœ   z/Failed to load resource detector '%s', skipping)r¡   r9   Úfromkeysr   r&   r   ro   rÊ   ri   Ú&opentelemetry.util._importlib_metadatarÚ   ÚsetÚnamesÚsortedÚindexÚappendÚnextÚiterÚloadÚ	Exceptionr;   Ú	exception)Údetector_namesrÚ   Ú
registeredÚ	expansionÚidxÚ	detectorsrœ   s          r   r#   r#     s,  € õ !%Ý�Šðð å#œKÝ8¸"ñô ç’%˜‘*”*ð	ñ ô ð " 6Ð*ñ+ñ		
ô 		
ñ!ô !€Nð Ð,¨fÐ5Ò5Ð5Ý1Ñ3Ô3Õ5IÑ5KÔ5KÐLÐLðð ð ð ð ð ð ˆnÐÐÝð 
ð 
à$˜Ø7ðñ ô äð	
ñ 
ô 
ñ 
ô 
ˆ
õ ˜:­¨NÑ(;Ô(;Ñ;Ñ<Ô<ˆ	Ø×"Ò" 3Ñ'Ô'ˆà˜4˜C˜4Ô  9Ñ,¨~¸cÀA¹g¸i¸iÔ/HÑHð 	ð )+€IØð ð ˆð	Ø×Òð•ÝØ$˜Ø"CØ!%ðñ ô ñô ñô ÷ ’$‘&”&ñô ñ	ô 	ð 	ð 	øõ ð 	ð 	ð 	Ý×ÒØAØñô ð ð ð ð	øøøð
 Ðs   ÄAE#Å#%FÆ
Fc                  ó|   — t          d„ t          ¦   «         D ¦   «         t                               ¦   «         ¦  «        S )Nc                 ó:   — g | ]}|                      ¦   «         ¯|‘ŒS r1   )rd   )rÖ   Údetectors     r   r×   z3_get_process_dependent_resource.<locals>.<listcomp>d  s:   € ð 	
ð 	
ð 	
àØ×,Ò,Ñ.Ô.ð	
Øð	
ð 	
ð 	
r   )r"   r#   r   r2   r1   r   r   Ú_get_process_dependent_resourcerô   b  sG   € Ý#ð	
ð 	
å5Ñ7Ô7ð	
ñ 	
ô 	
õ
 	×ÒÑÔñô ð r   é   rð   Úinitial_resourceÚtimeoutc                 óœ  ‡
— |pt                                ¦   «         }t          j                             d¬¦  «        5 Š
ˆ
fd„| D ¦   «         }t          |¦  «        D ]Ø\  }}| |         }t          }	 |                     |¬¦  «        }n}# t          j        j        $ r/}	|j	        r|	‚t                               d||¦  «         Y d}	~	n?d}	~	wt          $ r/}	|j	        r|	‚t                               d|	|¦  «         Y d}	~	nd}	~	ww xY w|                     |¦  «        }Œ¿# |                     |¦  «        }w xY w	 ddd¦  «         n# 1 swxY w Y   |S )a'  Retrieves resources from detectors in the order that they were passed

    :param detectors: List of resources in order of priority
    :param initial_resource: Static resource. This has highest priority
    :param timeout: Number of seconds to wait for each detector to return
    :return:
    rG   )Úmax_workersc                 óD   •— g | ]}‰                      |j        ¦  «        ‘ŒS r1   )Úsubmitrb   )rÖ   ró   Úexecutors     €r   r×   z,get_aggregated_resources.<locals>.<listcomp>|  s'   ø€ ÐNÐNÐN¸�8—?’? 8¤?Ñ3Ô3ÐNÐNÐNr   )r÷   z1Detector %s took longer than %s seconds, skippingNz%Exception %s in detector %s, ignoring)r   r-   Ú
concurrentÚfuturesÚThreadPoolExecutorÚ	enumerater0   ÚresultÚTimeoutErrorr]   r;   rq   rê   r%   )rð   rö   r÷   Údetectors_merged_resourcerþ   Údetector_indÚfutureró   Údetected_resourceÚexrü   s             @r   r"   r"   m  s  ø€ ð !1Ð EµH·O²OÑ4EÔ4EÐå	Ô	×	.Ò	.¸1Ð	.Ñ	=Ô	=ð ÀØNÐNÐNÐNÀIÐNÑNÔNˆÝ$-¨gÑ$6Ô$6ð 	ð 	Ñ ˆL˜&Ø  Ô.ˆHÝ*9ÐðØ$*§M¢M¸' MÑ$BÔ$BÐ!Ð!øÝÔ%Ô2ð ð ð ØÔ*ð Ø�HÝ—’ØGØØñô ð ð ð ð ð ð øøøøõ ð ð ð ØÔ*ð Ø�HÝ—’Ø;¸RÀñô ð ð ð ð ð ð øøøøðøøøð -F×,KÒ,KØ%ñ-ô -Ð)Ð)øÐ,E×,KÒ,KØ%ñ-ô -Ð)ð ð ð ð ð+	ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð6 %Ð$s_   ½2EÁ0BÂDÂDÂ%CÃ DÃDÃ%C<Ã7DÃ<DÄDÄEÄD1Ä1EÅEÅE)Nrõ   )ŒrO   rf   Úconcurrent.futuresrý   Úloggingr’   r¸   rÅ   rŽ   Ú	threadingrÎ   Úcollections.abcr   r   Újsonr   r   Útypesr   Útypingr   Úurllibr	   Úopentelemetry.attributesr
   Ú'opentelemetry.sdk.environment_variablesr   r   r   Úopentelemetry.sdk.versionr   Ú_OPENTELEMETRY_SDK_VERSIONÚopentelemetry.semconv.resourcer   Úopentelemetry.util.typesr   r   rP   Úpsutil_moduleÚImportErrorÚ
LabelValuer(   rQ   Ú	getLoggerrL   r;   ÚCLOUD_PROVIDERÚCLOUD_ACCOUNT_IDÚCLOUD_REGIONÚCLOUD_AVAILABILITY_ZONEÚCONTAINER_NAMEÚCONTAINER_IDÚCONTAINER_IMAGE_NAMEÚCONTAINER_IMAGE_TAGÚDEPLOYMENT_ENVIRONMENTÚ	FAAS_NAMEÚFAAS_IDÚFAAS_VERSIONÚFAAS_INSTANCErÄ   rÇ   Ú	HOST_TYPEÚHOST_IMAGE_NAMEÚHOST_IMAGE_IDÚHOST_IMAGE_VERSIONÚK8S_CLUSTER_NAMEÚKUBERNETES_CLUSTER_NAMEÚK8S_NAMESPACE_NAMEÚKUBERNETES_NAMESPACE_NAMEÚK8S_POD_UIDÚKUBERNETES_POD_UIDÚK8S_POD_NAMEÚKUBERNETES_POD_NAMEÚK8S_CONTAINER_NAMEÚKUBERNETES_CONTAINER_NAMEÚK8S_REPLICASET_UIDÚKUBERNETES_REPLICA_SET_UIDÚK8S_REPLICASET_NAMEÚKUBERNETES_REPLICA_SET_NAMEÚK8S_DEPLOYMENT_UIDÚKUBERNETES_DEPLOYMENT_UIDÚK8S_DEPLOYMENT_NAMEÚKUBERNETES_DEPLOYMENT_NAMEÚK8S_STATEFULSET_UIDÚKUBERNETES_STATEFUL_SET_UIDÚK8S_STATEFULSET_NAMEÚKUBERNETES_STATEFUL_SET_NAMEÚK8S_DAEMONSET_UIDÚKUBERNETES_DAEMON_SET_UIDÚK8S_DAEMONSET_NAMEÚKUBERNETES_DAEMON_SET_NAMEÚK8S_JOB_UIDÚKUBERNETES_JOB_UIDÚK8S_JOB_NAMEÚKUBERNETES_JOB_NAMEÚK8S_CRONJOB_UIDÚKUBERNETES_CRON_JOB_UIDÚK8S_CRONJOB_NAMEÚKUBERNETES_CRON_JOB_NAMEÚOS_DESCRIPTIONr¼   r½   rž   r¥   r)   rŸ   r    r¢   r£   r¨   rš   r�   r˜   r'   ÚSERVICE_NAMESPACErÐ   ÚSERVICE_VERSIONÚTELEMETRY_SDK_NAMEÚTELEMETRY_SDK_VERSIONÚTELEMETRY_AUTO_VERSIONÚTELEMETRY_SDK_LANGUAGEr   r0   r$   rY   rZ   rV   ÚLockrÍ   ÚABCr\   ri   r}   r³   rÂ   rÊ   r¡   r#   rô   r"   r1   r   r   ú<module>rV     s%  ðð*ð *ð *ð^ €
€
€
Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø €€€Ø €€€Ø 
€
€
€
Ø Ð Ð Ð Ø €€€Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 6Ð 6Ð 6Ð 6Ð 6Ð 6ðð ð ð ð ð ð ð ð ð ð
ð ð ð ð ð ð >Ð =Ð =Ð =Ð =Ð =Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3à €ˆ
�TÑÐ  Ð  Ñ  ð	Ø"Ð"Ð"Ð"à€F€FøØð 	ð 	ð 	Ø€Dð	øøøð €
Ø�S˜*�_Ô%€
Ø	ˆÔ	˜8Ñ	$Ô	$€à#Ô2€Ø%Ô6Ð Ø!Ô.€Ø,ÔDÐ Ø#Ô2€Ø!Ô.€Ø)Ô>Ð Ø(Ô<Ð Ø+ÔBÐ ØÔ(€	Ø
Ô
$€Ø!Ô.€Ø"Ô0€ØÔ(€	ØÔ(€	ØÔ(€	Ø$Ô4€Ø"Ô0€Ø'Ô:Ð Ø,Ô=Ð Ø.ÔAÐ Ø'Ô3Ð Ø(Ô5Ð Ø.ÔAÐ Ø/ÔBÐ Ø0ÔDÐ Ø.ÔAÐ Ø/ÔCÐ Ø0ÔDÐ Ø1ÔFÐ Ø.Ô@Ð Ø/ÔBÐ Ø'Ô3Ð Ø(Ô5Ð Ø,Ô<Ð Ø-Ô>Ð Ø#Ô2€Ø
Ô
$€ØÔ*€
Ø Ô,€Ø'Ô:Ð Ø,ÔDÐ Ø,ÔDÐ Ø$Ô4€Ø)Ô>Ð Ø)Ô>Ð Ø"Ô0€Ø)Ô>Ð Ø,ÔDÐ Ø0ÔLÐ Ø!Ô.€Ø&Ô8Ð Ø(Ô<Ð Ø$Ô4€Ø'Ô:Ð Ø*Ô@Ð Ø+ÔBÐ Ø+ÔBÐ ðt
ð t
ð t
ð t
ð t
ñ t
ô t
ð t
ðn �(˜2‘,”,€à�Hà Ø˜OØÐ9ðñô Ð ð $(Ð �c˜D‘jÐ 'Ð 'Ñ 'Ø'+Ð ˜# ™*Ð +Ð +Ñ +Ø*˜IœNÑ,Ô,Ð ðð ð ð ð �s”wñ ô ð ð2*ð *ð *ð *ð *Ð+ñ *ô *ð *ð4C'ð C'ð C'ð C'ð C'Ð.ñ C'ô C'ð C'ðLQ
ð Q
ð Q
ð Q
ð Q
Ð)ñ Q
ô Q
ð Q
ðh
ð 
ð 
ð 
ð 
Ð,ñ 
ô 
ð 
ð <ð  <ð  <ð  <ð  <Ð(8ñ  <ô  <ð  <ðFB 4Ð(:Ô#;ð Bð Bð Bð BðJ¨ð ð ð ð ð )-Øð)%ð )%ØÐ*Ô+ð)%à ‘oð)%ð ð)%ð ð	)%ð )%ð )%ð )%ð )%ð )%s   Á;B ÂB
Â	B
