§
    3xÅj¤r  ã            	       ó   — 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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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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 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        ZAe jB        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        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        Zxe jy        Zye jz        Zz G d„ d¦  «        Z{de|de*fd„Z} e{i ¦  «        Z~ e{ezdewdexe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‰d ZŠd!Z‹d"ZŒd#Z�d$ZŽd%Z�d&Z�d'e*de*dz  fd(„Z‘d)e’e*d*f         de*fd+„Z“de*dz  fd,„Z”de*dz  fd-„Z•de*dz  fd.„Z–de*dz  fd/„Z—de*dz  fd0„Z˜ G d1„ d2e†¦  «        Z™ G d3„ d4e†¦  «        Zšde›d         fd5„Zœde{fd6„Z�	 	 d<d8ed         d9e{dz  d:e‚ddfd;„ZždS )=a1  
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)Úparse)ÚBoundedAttributes)Ú$OTEL_EXPERIMENTAL_RESOURCE_DETECTORSÚOTEL_RESOURCE_ATTRIBUTESÚOTEL_SERVICE_NAME)Ú__version__)ÚResourceAttributes)ÚAnyValueÚpsutilÚwinregc                   ó  — 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                 óH   — t          |d¬¦  «        | _        |€d}|| _        d S )NT)r   Ú	immutableÚ )r	   r   r   )Úselfr   r   s      úUC:\Projects\Historical\venv\Lib\site-packages\opentelemetry/sdk/resources/__init__.pyÚ__init__zResource.__init__¬   s0   € å,¸
ÈdÐSÑSÔSˆÔØÐØˆJØ%ˆÔÐÐó    Úreturnc                 ó   — | si } t          t          ¦   «         t          ¦  «                             t	          | |¦  «        ¦  «        }|j                             t          d¦  «        sgd}t          j	        r/|dt          j                             t          j	        ¦  «        › �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_NAMEÚsysÚ
executableÚosÚpathÚbasename)r   r   ÚresourceÚdefault_service_names       r   ÚcreatezResource.create³   sÁ   € ð" ð 	ØˆJå+Õ,EÑ,GÔ,GÕIZÑ[Ô[×aÒaÝ�Z Ñ,Ô,ñ
ô 
ˆð Ô"×&Ò&¥|°TÑ:Ô:ð 	bØ#4Ð ÝŒ~ð OØ$Ð(N­B¬G×,<Ò,<½S¼^Ñ,LÔ,LÐ(NÐ(NÑNÐ$Ø—~’~¥hµÐ>RÐ/SÐU_Ñ&`Ô&`ÑaÔaˆHØˆr   c                  ó   — t           S ©N)Ú_EMPTY_RESOURCE© r   r   Ú	get_emptyzResource.get_emptyÒ   s   € åÐr   c                 ó   — | j         S r2   )r   ©r   s    r   r   zResource.attributesÖ   ó   € àÔÐr   c                 ó   — | j         S r2   )r   r7   s    r   r   zResource.schema_urlÚ   r8   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   r:   Ú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   r:   s     r   Ú__eq__zResource.__eq__  s:   € Ý˜%¥Ñ*Ô*ð 	Ø�5ØÔ 5Ô#4Ò4Ð^¸Ô9IÈUÔM^Ò9^Ð^r   c                 óŒ   — t          t          | j                             ¦   «         dt          ¬¦  «        › d| j        › �¦  «        S )NT)Ú	sort_keysÚdefaultú|)Úhashr   r   ÚcopyÚ_json_defaultr   r7   s    r   Ú__hash__zResource.__hash__  s@   € Ý•u˜TÔ-×2Ò2Ñ4Ô4ÀÍmÐ\Ñ\Ô\ÐqÐqÐ_cÔ_oÐqÐqÑrÔrÐrr   é   Úindentc                 ód   — t          t          | j        ¦  «        | j        dœ|t          ¬¦  «        S )N)r   r   )rM   rF   )r   r<   r   r   rJ   )r   rM   s     r   Úto_jsonzResource.to_json	  s>   € Ýå" 4¤?Ñ3Ô3Ø"Ô.ðð ð Ý!ð
ñ 
ô 
ð 	
r   r2   )NN©r   r   )r:   r   r   r   )rL   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Ú__annotations__ÚstrÚ
Attributesr   Ústaticmethodr0   r5   Úpropertyr   r   r&   ÚobjectÚboolrC   ÚintrK   rO   r4   r   r   r   r   ¦   s£  € € € € € € ØdÐdà"Ð"Ð"Ñ"ØÐÐÑð&ð & :ð &¸3À¹:ð &ð &ð &ð &ð à(,Ø!%ðð Ø Ñ%ðà˜$‘Jðð 
ðð ð ñ „\ðð< ðð ð ñ „\ðð ð ˜Jð  ð  ð  ñ „Xð ð ð ˜Cð  ð  ð  ñ „Xð ð!7ð !7ð !7ð !7ðF_˜Fð _ tð _ð _ð _ð _ð
s˜#ð sð sð sð sð
ð 
˜c D™jð 
°ð 
ð 
ð 
ð 
ð 
ð 
r   r   Úvaluer   c                 ó€   — t          | t          t          f¦  «        r|                      ¦   «         S t	          | ¦  «        S )aE  Represent attribute values that `json` cannot encode natively.

    `types.AnyValue` admits `bytes`, which `json.dumps` rejects. Rendering it
    as hex keeps `to_json` readable and keeps `__hash__` working; `__eq__`
    still distinguishes `b""` from the string `"01"`, so the resulting
    hash collision is harmless.
    )rB   ÚbytesÚ	bytearrayÚhexrV   )r]   s    r   rJ   rJ     s5   € õ �%�%¥Ð+Ñ,Ô,ð Ø�yŠy‰{Œ{ÐÝˆu‰:Œ:Ð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 r2   ©rh   )r   rh   s     r   r   zResourceDetector.__init__2  s   € Ø,ˆÔÐÐr   r   c                 ó   — t          ¦   «         ‚)zdDon't call `Resource.create` here to avoid an infinite loop, instead instantiate `Resource` directly)ÚNotImplementedErrorr7   s    r   ÚdetectzResourceDetector.detect5  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``.
        Fr4   r7   s    r   Úis_process_dependentz%ResourceDetector.is_process_dependent;  s	   € ð ˆur   ©FrP   )	rQ   rR   rS   r[   r   ÚabcÚabstractmethodrm   ro   r4   r   r   rg   rg   1  sz   € € € € € ð-ð - tð -¸ð -ð -ð -ð -ð 	Ôð$ð $ð $ñ Ôð$ð
 dð ð ð ð ð ð r   rg   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Úkeyr]   ÚexcÚvalue_url_decodedÚservice_names	            r   rm   zOTELResourceDetector.detectL  s  € Ý%œkÕ*BÑCÔCÐØ02Ðàð 	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NrP   )rQ   rR   rS   rm   r4   r   r   rt   rt   J  s(   € € € € € ð*ð *ð *ð *ð *ð *r   rt   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_argsrh   rˆ   r   Nc                óZ   •— t          ¦   «                              |¬¦  «         || _        d S )Nrj   )Úsuperr   Ú_include_command_args)r   rh   rˆ   Ú	__class__s      €r   r   z ProcessResourceDetector.__init__n  s.   ø€ õ 	‰Œ×Ò¨ÐÑ7Ô7Ð7Ø%9ˆÔ"Ð"Ð"r   c                 ó   — dS ©NTr4   r7   s    r   ro   z,ProcessResourceDetector.is_process_dependentx  ó   € Øˆ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	        rt          j	        d         nd}t          j
        pd}t          t          j        t          t          j        j        t           |t"          |t$          t          j                             |¦  «        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ÚmaprV   r)   Úversion_infoÚreleaselevelÚserialr+   ÚgetpidÚ	orig_argvr*   ÚPROCESS_RUNTIME_DESCRIPTIONÚversionÚPROCESS_RUNTIME_NAMEÚimplementationÚnameÚPROCESS_RUNTIME_VERSIONÚPROCESS_PIDÚPROCESS_EXECUTABLE_NAMEr,   r-   Ú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_commandr*   Úresource_infoÚ_process_argvÚprocessr­   s	            r   rm   zProcessResourceDetector.detect{  sv  € ØŸ8š8ÝÝõ Ô'Ô4¸Ò?Ð?ÍÔHXÔH_Ð?õ Ô$ R a RÔ(Ð(åÔ)ñô ñ	
ô 	
Ðõ ”y‘{”{ˆõ 03¬}ÐD�3œ=¨Ô+Ð+À"ÐÝ”^Ð) rˆ
å'­¬Ý ¥#Ô"4Ô"9Ý#Ð%5Ý˜Ý#¥R¤W×%5Ò%5°jÑ%AÔ%AÝ# ZÝÐ-ð.
ˆð Ô%ð 	@Ý ¥¤Ñ/Ô/ˆMØ25·(²(¸=Ñ2IÔ2IˆMÕ.Ñ/Ø2?ˆMÕ.Ñ/å•2�yÑ!Ô!ð 	=å02´
±´ˆMÕ,Ñ-åÐÝ—n’nÑ&Ô&ˆGØ×'Ò'Ñ)Ô)ˆHØ+3ˆM�-Ñ(å˜Ñ&Ô&Ð&r   rp   rP   )	rQ   rR   rS   rT   r[   r   ro   rm   Ú__classcell__)rŒ   s   @r   r‡   r‡   d  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   rm   zOsResourceDetector.detect«  sˆ   € õ| ”/Ñ#Ô#×)Ò)Ñ+Ô+ˆÝÔ%Ñ'Ô'ˆ
ð �iÒÐÝ!Ô)Ñ+Ô+ˆJˆJà˜ÒÐØˆGÝ!Ô)Ñ+Ô+ˆJåå˜Ý˜Jðñ
ô 
ð 	
r   NrP   ©rQ   rR   rS   rT   rm   r4   r   r   r·   r·   ¨  s:   € € € € € ð Cð  CðN
ð N
ð N
ð N
ð N
ð N
r   r·   )z/etc/machine-idz/var/lib/dbus/machine-idz/etc/hostid)z	/bin/kenvz-qzsmbios.system.uuid)z/usr/sbin/ioregz-rd1z-cÚIOPlatformExpertDevicezSOFTWARE\Microsoft\CryptographyÚMachineGuidé   r,   c                 ó  — 	 t          | d¬¦  «        5 }|                     ¦   «                              ¦   «         pd cd d d ¦  «         S # 1 swxY w Y   d S # t          $ r'}t                               d| |¦  «         Y d }~d S d }~ww xY w)NÚutf8)ÚencodingzFailed to read %s: %s)ÚopenÚreadr~   ÚOSErrorr>   Údebug)r,   Úmachine_id_fileÚ	exceptions      r   Ú_read_machine_id_filerÑ   	  sÞ   € ðÝ�$ Ð(Ñ(Ô(ð 	:¨OØ"×'Ò'Ñ)Ô)×/Ò/Ñ1Ô1Ð9°Tð	:ð 	:ð 	:ð 	:ñ 	:ô 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:øøøð 	:ð 	:ð 	:ð 	:ð 	:ð 	:øåð ð ð Ý�ŠÐ,¨d°IÑ>Ô>Ð>Øˆtˆtˆtˆtˆtøøøøðøøøs9   ‚A “(A»A ÁAÁA ÁAÁA Á
BÁBÂBÚcommand.c                 óÜ   — 	 t          j        | ddt          d¬¦  «        }nF# t           j        t          f$ r-}t
                               d| d         |¦  «         Y d}~dS d}~ww xY w|j        S )z¦Returns the command's stdout, or "" when the source is unavailable here.

    A non-zero exit or a missing binary means this host has no machine id to
    offer.
    T)Úcapture_outputÚtextÚtimeoutÚcheckzFailed to run %s: %sr   Nr   )Ú
subprocessÚrunÚ_COMMAND_TIMEOUT_SECONDSÚCalledProcessErrorÚFileNotFoundErrorr>   rÎ   Ústdout)rÒ   Ú	completedrÐ   s      r   Ú_run_commandrß     s‹   € ð
Ý”NØØØÝ,Øð
ñ 
ô 
ˆ	ˆ	øõ Ô)Õ+<Ð=ð ð ð Ý�ŠÐ+¨W°Q¬Z¸ÑCÔCÐCØˆrˆrˆrˆrˆrøøøøðøøøð ÔÐs   ‚! ¡A$·"AÁA$c                  óD   — t           D ]} t          | ¦  «        }|r|c S Œd S r2   )Ú_LINUX_MACHINE_ID_PATHSrÑ   )r,   Ú
machine_ids     r   Ú_get_linux_machine_idrã   &  s<   € Ý'ð ð ˆÝ*¨4Ñ0Ô0ˆ
Øð 	ØÐÐÐð	àˆ4r   c                  óz   — t          t          ¦  «        p't          t          ¦  «                             ¦   «         pd S r2   )rÑ   Ú_BSD_HOSTID_PATHrß   Ú_BSD_KENV_COMMANDr~   r4   r   r   Ú_get_bsd_machine_idrç   .  s1   € Ý Õ!1Ñ2Ô2ÐeµlÕCTÑ6UÔ6U×6[Ò6[Ñ6]Ô6]ÐeÐaeÐer   c                  ó@  — t          t          ¦  «                             ¦   «         D ]v} |                      d¦  «        \  }}}|r+|                     ¦   «                              d¦  «        dk    rŒI|                     ¦   «                              d¦  «        }|r|c S Œwd S )Nrw   ú"ÚIOPlatformUUID)rß   Ú_MACOS_IOREG_COMMANDÚ
splitlinesÚ	partitionr~   )Úliner‚   Ú	separatorr]   râ   s        r   Ú_get_macos_machine_idrð   2  s£   € ÝÕ1Ñ2Ô2×=Ò=Ñ?Ô?ð ð ˆà $§¢¨sÑ 3Ô 3ÑˆˆY˜Øð 	˜CŸIšI™KœK×-Ò-¨cÑ2Ô2Ð6FÒFÐFØà—[’[‘]”]×(Ò(¨Ñ-Ô-ˆ
Øð 	ØÐÐÐð	àˆ4r   c                  óv  — t           €"t                               dt          ¦  «         d S t                                t           j        t          t           j        t           j        z  ¬¦  «        5 } t            	                    | t          ¦  «        \  }}d d d ¦  «         n# 1 swxY w Y   |rt          |¦  «        nd S )Nz'winreg is unavailable, cannot detect %s)Úaccess)r   r>   rÎ   ÚHOST_IDÚOpenKeyÚHKEY_LOCAL_MACHINEÚ_WINDOWS_CRYPTOGRAPHY_KEYÚKEY_READÚKEY_WOW64_64KEYÚQueryValueExÚ_WINDOWS_MACHINE_GUID_VALUErV   )r‚   Úmachine_guidÚ_s      r   Ú_get_windows_machine_idrý   ?  sé   € Ý€~Ý�ŠÐ>ÅÑHÔHÐHØˆtÝ	�ŠÝÔ!Ý!ÝŒ¥Ô!7Ñ7ð 
ñ 
ô 
ð Pð 
Ý ×-Ò-¨cÕ3NÑOÔO‰ˆ�aðPð Pð Pñ Pô Pð Pð Pð Pð Pð Pð Pøøøð Pð Pð Pð Pð !-Ð6�3ˆ|ÑÔÐ°$Ð6s   Á-$BÂB!Â$B!c                  ó8  — t          j        ¦   «         } | dk    rt          ¦   «         S | dk    rt          ¦   «         S | dk    rt	          ¦   «         S | dk    s|                      d¦  «        rt          ¦   «         S t                               dt          | ¦  «         d S )NÚLinuxÚDarwinÚWindowsÚ	DragonFlyÚBSDz(Unsupported OS type for %s detection: %s)
r¼   r½   rã   rð   rý   Úendswithrç   r>   rÎ   ró   )r½   s    r   Ú_get_host_idr  L  s˜   € ÝŒ_ÑÔ€FØ�ÒÐÝ$Ñ&Ô&Ð&Ø�ÒÐÝ$Ñ&Ô&Ð&Ø�ÒÐÝ&Ñ(Ô(Ð(Ø�ÒÐ §¢°Ñ 6Ô 6ÐÝ"Ñ$Ô$Ð$Ý
‡L‚LÐ;½WÀfÑMÔMÐMØˆ4r   c                   ó   — e Zd ZdZdd„ZdS )Ú_HostResourceDetectora±  
    The HostResourceDetector detects the hostname, architecture and host id
    attributes.

    ``host.id`` is the non-privileged machine id described by the `Host resource
    conventions <https://opentelemetry.io/docs/specs/semconv/resource/host/>`_,
    and is omitted when it cannot be determined. A failed lookup does not
    prevent ``host.name`` and ``host.arch`` from being detected unless
    ``raise_on_error=True``.
    r   r   c                 ó<  — t           t          j        ¦   «         t          t	          j        ¦   «         i}	 t          ¦   «         x}r
||t          <   n@# t          $ r3}t           
                    dt          |¦  «         | j        r‚ Y d }~nd }~ww xY wt          |¦  «        S )NzFailed to detect %s: %s)Ú	HOST_NAMEÚsocketÚgethostnameÚ	HOST_ARCHr¼   Úmachiner  ró   Ú	Exceptionr>   r|   rh   r   )r   r²   Úhost_idrÐ   s       r   rm   z_HostResourceDetector.detectf  s³   € å•vÔ)Ñ+Ô+Ý•xÔ'Ñ)Ô)ð.
ˆð	Ý&™.œ.Ð(ˆwð 1Ø)0��gÑ&øøåð 	ð 	ð 	Ý�NŠNÐ4µg¸yÑIÔIÐIØÔ"ð Øðð ð ð ð øøøøð	øøøõ
 ˜Ñ&Ô&Ð&s   ´A Á
BÁ)BÂBNrP   rÄ   r4   r   r   r  r  Z  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Ž   r4   r7   s    r   ro   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 r2   )
Ú_service_instance_id_lockr+   r›   rd   re   rV   ÚuuidÚuuid4r   ÚSERVICE_INSTANCE_ID)r   Úcurrent_pidÚinstance_ids      r   rm   z(ServiceInstanceIdResourceDetector.detect�  s°   € õ 'ð 	/ð 	/Ýœ)™+œ+ˆKÝ#Ð+Õ/GÈ;Ò/VÐ/VÝ'*­4¬:©<¬<Ñ'8Ô'8Ð$Ø+6Ð(Ý.ˆKð	/ð 	/ð 	/ñ 	/ô 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/øøøð 	/ð 	/ð 	/ð 	/õ Õ,¨kÐ:Ñ;Ô;Ð;s   ˆAA#Á#A'Á*A'NrP   )rQ   rR   rS   rT   r[   ro   rm   r4   r   r   r  r  {  sM   € € € € € ðð ð  dð ð ð ð ð	<ð 	<ð 	<ð 	<ð 	<ð 	<r   r  c                  ó:  — d„ t          j        t          d¦  «                             d¦  «        D ¦   «         } d| v rg ndg}t	          t
                               || z   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) is prepended unless
    it is explicitly configured. "otel" (OTELResourceDetector) 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 r4   )r~   ©Ú.0r¡   s     r   ú
<listcomp>z-_build_resource_detectors.<locals>.<listcomp>§  sB   € ð !ð !ð !ØÐei×eoÒeoÑeqÔeqð!Ø�
Š
‰Œð!ð !ð !r   r   rv   Úservice_instanceÚotelr   )Úentry_pointsÚ*c              3   ó&   K  — | ]}|d k    ¯|V — ŒdS )r   Nr4   r  s     r   ú	<genexpr>z,_build_resource_detectors.<locals>.<genexpr>·  s4   è è € ð 
ð 
àØ�vŠ~ˆ~ð àˆ~ˆ~ˆ~ð
ð 
r   Úopentelemetry_resource_detector)ÚgroupNrx   )r&  r¡   z/Failed to load resource detector '%s', skipping)r   r'   r
   rz   r§   r<   Úfromkeysr  rt   Ú&opentelemetry.util._importlib_metadatar!  ÚsetÚnamesÚsortedÚindexÚappendÚnextÚiterÚloadr  r>   rÐ   )	Úconfigured_detector_namesÚdefault_detector_namesÚdetector_namesr!  Ú
registeredÚ	expansionÚidxÚ	detectorsr¡   s	            r   r$   r$   ›  s9  € ð!ð !Ý!(¤Õ-QÐSUÑ!VÔ!V×!\Ò!\Ð]`Ñ!aÔ!að!ñ !ô !Ðð $6Ð9RÐ#RÐ#R˜R˜RÐYkÐXlÐÝ $¥T§]¢]Ð3IÐLeÑ3eÐioÐhpÑ3pÑ%qÔ%qÑ rÔ r€Nð Ð,¨fÐ5Ò5Ð5Ý1Ñ3Ô3Õ5IÑ5KÔ5KÐLÐLðð ð ð ð ð ð ˆnÐÐÝð 
ð 
à$˜Ð+LÐMÑMÔMÔSð
ñ 
ô 
ñ 
ô 
ˆ
õ
 ˜:­¨NÑ(;Ô(;Ñ;Ñ<Ô<ˆ	Ø×"Ò" 3Ñ'Ô'ˆØ'¨¨¨Ô-°	Ñ9¸NÈ3ÐQRÉ7È9È9Ô<UÑUˆà(*€IØð ð ˆð	Ø×Òð•ÝØ$˜Ø"CØ!%ðñ ô ñô ñô ÷ ’$‘&”&ñô ñ	ô 	ð 	ð 	øõ ð 	ð 	ð 	Ý×ÒØAØñô ð ð ð ð	øøøð
 Ðs   ÄAE0Å0%FÆFc                  ó|   — t          d„ t          ¦   «         D ¦   «         t                               ¦   «         ¦  «        S )Nc                 ó:   — g | ]}|                      ¦   «         ¯|‘ŒS r4   )ro   )r  Údetectors     r   r  z3_get_process_dependent_resource.<locals>.<listcomp>×  s)   € ÐaÐaÐa�hÀ×A^ÒA^ÑA`ÔA`ÐaˆÐaÐaÐar   )r#   r$   r   r5   r4   r   r   Ú_get_process_dependent_resourcer;  Õ  s;   € Ý#ØaÐaÕ";Ñ"=Ô"=ÐaÑaÔaÝ×ÒÑÔñô ð r   é   r7  Úinitial_resourcerÖ   c                 óÖ  ‡
— |pt                                ¦   «         }t          j                             d¬¦  «        Š
	 ˆ
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¬	¦  «         n# ‰
                     dd¬	¦  «         w xY w|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:
    rL   )Úmax_workersc                 óD   •— g | ]}‰                      |j        ¦  «        ‘ŒS r4   )Úsubmitrm   )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, ignoringT)ÚwaitÚcancel_futures)r   r0   Ú
concurrentÚfuturesÚThreadPoolExecutorÚ	enumerater3   ÚresultÚTimeoutErrorrh   r>   r|   r  r&   Úshutdown)r7  r=  rÖ   Údetectors_merged_resourcerF  Údetector_indÚfuturer:  Údetected_resourceÚexrB  s             @r   r#   r#   Ü  sã  ø€ ð !1Ð EµH·O²OÑ4EÔ4EÐõ Ô!×4Ò4ÀÐ4ÑCÔC€Hð:ØNÐNÐNÐNÀIÐNÑNÔNˆÝ$-¨gÑ$6Ô$6ð 	_ð 	_Ñ ˆL˜&Ø  Ô.ˆHÝ*9Ðð_Ø$*§M¢M¸' MÑ$BÔ$BÐ!Ð!øÝÔ%Ô2ð ð ð ØÔ*ð Ø�HÝ—’ØGØØñô ð ð ð ð ð ð øøøøõ ð Vð Vð VØÔ*ð Ø�HÝ—’ÐFÈÈHÑUÔUÐUÐUÐUÐUÐUÐUøøøøðVøøøð
 -F×,KÒ,KÐL]Ñ,^Ô,^Ð)Ð)øÐ,E×,KÒ,KÐL]Ñ,^Ô,^Ð)Ð^Ð^Ð^Ð^ð'	_ð* 	×Ò˜t°DÐÑ9Ô9Ð9Ð9øˆ×Ò˜t°DÐÑ9Ô9Ð9Ð9øøøà$Ð$sY   ¾1E Á0BÂDÂDÂ%CÃ DÃDÃ%C<Ã7DÃ<DÄDÄE ÄD1Ä1E ÅE&)Nr<  )ŸrT   rq   Úconcurrent.futuresrE  Úloggingr+   r¼   r
  rØ   r)   Ú	threadingr  Úcollections.abcr   r   Újsonr   r   Útypesr   Úurllibr   Úopentelemetry.attributesr	   Ú'opentelemetry.sdk.environment_variablesr
   r   r   Úopentelemetry.sdk.versionr   Ú_OPENTELEMETRY_SDK_VERSIONÚopentelemetry.semconv.resourcer   Úopentelemetry.util.typesr   r   rU   Úpsutil_moduleÚImportErrorr   Úwinreg_moduleÚ
LabelValuerV   rW   Ú	getLoggerrQ   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  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   rZ   rJ   r3   r%   rd   re   r\   ÚLockr  ÚABCrg   rt   r‡   r·   rá   rå   ræ   rë   rö   rú   rÚ   rÑ   Útuplerß   rã   rç   rð   rý   r  r  r  r§   r$   r;  r#   r4   r   r   ú<module>r      s³  ðð.ð .ð .ðf €
€
€
Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø €€€Ø €€€Ø Ð Ð Ð Ø 
€
€
€
Ø Ð Ð Ð Ø €€€Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 6Ð 6Ð 6Ð 6Ð 6Ð 6ðð ð ð ð ð ð ð ð ð ð
ð ð ð ð ð ð >Ð =Ð =Ð =Ð =Ð =Ø -Ð -Ð -Ð -Ð -Ð -à €ˆ
�TÑÐ  Ð  Ñ  ð	Ø"Ð"Ð"Ð"à€F€FøØð 	ð 	ð 	Ø€Dð	øøøð !€ˆ
�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Ð ðk
ð k
ð k
ð k
ð k
ñ k
ô k
ð k
ð\
˜ð 
 Cð 
ð 
ð 
ð 
ð �(˜2‘,”,€à�Hà Ø˜OØÐ9ðñô Ð ð $(Ð �c˜D‘jÐ 'Ð 'Ñ 'Ø'+Ð ˜# ™*Ð +Ð +Ñ +Ø*˜IœNÑ,Ô,Ð ðð ð ð ð �s”wñ ô ð ð2*ð *ð *ð *ð *Ð+ñ *ô *ð *ð4A'ð A'ð A'ð A'ð A'Ð.ñ A'ô A'ð A'ðHQ
ð Q
ð Q
ð Q
ð Q
Ð)ñ Q
ô Q
ð Q
ðl JÐ Ø Ð Ø=Ð ØRÐ Ø>Ð Ø+Ð ð Ð ð ð ¨¨d©
ð ð ð ð ð˜%  S œ/ð ¨cð ð ð ð ð(˜s T™zð ð ð ð ðf˜S 4™Zð fð fð fð fð
˜s T™zð 
ð 
ð 
ð 
ð
7  t¡ð 
7ð 
7ð 
7ð 
7ð�c˜D‘jð ð ð ð ð'ð 'ð 'ð 'ð 'Ð,ñ 'ô 'ð 'ðB<ð <ð <ð <ð <Ð(8ñ <ô <ð <ð@7 4Ð(:Ô#;ð 7ð 7ð 7ð 7ðt¨ð ð ð ð ð )-Øð,%ð ,%ØÐ*Ô+ð,%à ‘oð,%ð ð,%ð ð	,%ð ,%ð ,%ð ,%ð ,%ð ,%s$   Á9B  Â BÂBÂB ÂB%Â$B%