Ë
    dQêj¤r  ã            	       ó4	  — 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#dZ'edz  e$d<   	 ddl'Z(e(Z'e"Z)ee*e)f   Z+ ejX                  e-«      Z.e j^                  Z/e j`                  Z0e jb                  Z1e jd                  Z2e jf                  Z3e jh                  Z4e jj                  Z5e jl                  Z6e jn                  Z7e jp                  Z8e jr                  Z9e jt                  Z:e jv                  Z;e jx                  Z<e jz                  Z=e j|                  Z>e j~                  Z?e j€                  Z@e j‚                  ZAe j„                  ZBe j†                  ZDe jŠ                  ZFe jŽ                  ZHe j’                  ZJe j–                  ZLe jš                  ZNe jž                  ZPe j¢                  ZRe j¦                  ZTe jª                  ZVe j®                  ZXe j²                  ZZe j¶                  Z\e jº                  Z^e j¾                  Z`e jÂ                  Zbe jÆ                  Zde jÊ                  Zee jÌ                  Zfe jÎ                  Zge jÐ                  Zhe jÒ                  Zie jÔ                  Zje jÖ                  Zke jØ                  Zle jÚ                  Zme jÜ                  Zne jÞ                  Zoe jà                  Zpe jâ                  Zqe jä                  Zre jæ                  Zse jè                  Zte jê                  Zue jì                  Zve jî                  Zwe jð                  Zxe jò                  Zye jô                  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;d7ed   d8e{dz  d9e‚ddfd:„Zžy# e&$ r Y �Œw xY w# e&$ r Y �Œw xY w)<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y)ÚResourcezZA Resource is an immutable representation of the entity producing telemetry as Attributes.Ú_attributesÚ_schema_urlNÚ
attributesÚ
schema_urlc                 ó>   — t        |d¬«      | _        |€d}|| _        y )NT)r   Ú	immutableÚ )r	   r   r   )Úselfr   r   s      úi/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/opentelemetry/sdk/resources/__init__.pyÚ__init__zResource.__init__¬   s$   € ä,¸
ÈdÔSˆÔØÐØˆJØ%ˆÕó    Úreturnc                 ó|  — | si } t        t        «       t        «      j                  t	        | |«      «      }|j
                  j                  t        d«      sfd}t        j                  r3|dt        j                  j                  t        j                  «      › �z  }|j                  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ÔIZÓ[×aÑaÜ�Z Ó,ó
ˆð ×"Ñ"×&Ñ&¤|°TÔ:Ø#4Ð Ü�~Š~Ø$¨!¬B¯G©G×,<Ñ,<¼S¿^¹^Ó,LÐ+MÐ(NÑNÐ$Ø—~‘~¤h´Ð>RÐ/SÐU_Ó&`Ó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                 ó�  — t        | j                  «      }|j                  |j                  «       | j                  dk(  r|j                  }no|j                  dk(  r| j                  }nS| j                  |j                  k(  r|j                  }n-t        j                  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à�?‰?˜bÒ Ø×)Ñ)‰JØ×Ñ Ò#ØŸ™‰JØ�_‰_ × 0Ñ 0Ò0Ø×)Ñ)‰Jä�L‰LØWØ—‘Ø× Ñ ôð
 ˆKÜÐ)¨:Ó6Ð6r   c                 óŒ   — t        |t        «      sy| j                  |j                  k(  xr | j                  |j                  k(  S )NF)Ú
isinstancer   r   r   )r   r:   s     r   Ú__eq__zResource.__eq__  s<   € Ü˜%¤Ô*ØØ×Ñ 5×#4Ñ#4Ñ4Ò^¸×9IÑ9IÈU×M^ÑM^Ñ9^Ð^r   c                 ó†   — t        t        | j                  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ÀÌmÔ\Ð]Ð]^Ð_c×_oÑ_oÐ^pÐqÓrÐrr   Úindentc                 óf   — t        t        | j                  «      | j                  dœ|t        ¬«      S )N)r   r   )rL   rF   )r   r<   r   r   rJ   )r   rL   s     r   Úto_jsonzResource.to_json	  s1   € Üä" 4§?¡?Ó3Ø"×.Ñ.ñð Ü!ô
ð 	
r   r2   )NN©r   r   )r:   r   r   r   )é   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Ú__annotations__ÚstrÚ
Attributesr   Ústaticmethodr0   r5   Úpropertyr   r   r&   ÚobjectÚboolrC   ÚintrK   rN   r4   r   r   r   r   ¦   sð   … Ùdà"Ó"ØÓñ& :ð &¸3À¹:ó &ð à(,Ø!%ñØ Ñ%ðà˜$‘Jðð 
òó ðð< òó ðð ð ˜Jò  ó ð ð ð ˜Cò  ó ð ó!7ðF_˜Fð _ tó _ð
s˜#ó sñ
˜c D™jð 
°ô 
r   r   Úvaluer   c                 ód   — t        | t        t        f«      r| j                  «       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     s)   € ô �%œ%¤Ð+Ô,Ø�y‰y‹{ÐÜˆu‹:Ðr   ÚpythonÚopentelemetryÚ_service_instance_idÚ_service_instance_id_pidc                   óP   — e Zd Zddeddfd„Zej                  dd„«       Zdefd„Zy)	ÚResourceDetectorÚraise_on_errorr   Nc                 ó   — || _         y r2   ©rh   )r   rh   s     r   r   zResourceDetector.__init__2  s
   € Ø,ˆÕ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                  ó   — y)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   € ð r   ©FrO   )	rQ   rR   rS   r[   r   ÚabcÚabstractmethodrm   ro   r4   r   r   rg   rg   1  s;   „ ñ- tð -¸ó -ð 	×Ñò$ó ð$ð
 dô r   rg   c                   ó   — e Zd Zdd„Zy)ÚOTELResourceDetectorc                 óº  — t        j                  t        «      }i }|rc|j                  d«      D ]O  }	 |j                  dd¬«      \  }}t        j                  |j                  «       «      }|||j                  «       <   ŒQ t        j                  t        «      }|r	||t        <   t        |«      S # t        $ r!}t
        j                  d||«       Y d }~Œ¦d }~ww xY w)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™kÔ*BÓCÐØ02ÐáØ+×1Ñ1°#Ó6ò B�ðØ!%§¡¨C¸! Ó!<‘J�C˜ô %*§M¡M°%·+±+³-Ó$@Ð!Ø0AÐ  §¡£Ò-ðBô —{‘{Ô#4Ó5ˆÙØ-9Ðœ\Ñ*ÜÐ(Ó)Ð)øô "ò Ü—N‘NØJØØôô
 ûðús   ³B0Â0	CÂ9CÃCNrO   )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                ó4   •— t         ‰| �  |¬«       || _        y )Nrj   )Úsuperr   Ú_include_command_args)r   rh   rˆ   Ú	__class__s      €r   r   z ProcessResourceDetector.__init__n  s   ø€ ô 	‰Ñ¨ÐÔ7Ø%9ˆÕ"r   c                  ó   — y©NTr4   r7   s    r   ro   z,ProcessResourceDetector.is_process_dependentx  ó   € Ør   c                 óÆ  — dj                  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                  xs d}t        t        j                  t        t        j                  j                  t         |t"        |t$        t        j&                  j)                  |«      t*        |t,        |i}| j.                  r:t1        t        j                  «      }dj                  |«      |t2        <   ||t4        <   t7        t        d«      rt        j8                  «       |t:        <   t<        �-t<        j?                  «       }|jA                  «       }||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{  sb  € ØŸ8™8ÜÜô ×'Ñ'×4Ñ4¸Ò?Ì×HXÑHX×H_ÒH_ô ×$Ñ$ R aÑ(ä×)Ñ)óó	
Ðô —y‘y“{ˆô 03¯}ª}œ3Ÿ=™=¨Ò+À"ÐÜ—^‘^Ò) rˆ
ä'¬¯©Ü ¤#×"4Ñ"4×"9Ñ"9Ü#Ð%5Ü˜Ü#¤R§W¡W×%5Ñ%5°jÓ%AÜ# ZÜÐ-ð.
ˆð ×%Ò%Ü ¤§¡Ó/ˆMØ25·(±(¸=Ó2IˆMÔ.Ñ/Ø2?ˆMÔ.Ñ/ä”2�yÔ!ä02·
±
³ˆMÔ,Ñ-äÐÜ—n‘nÓ&ˆGØ×'Ñ'Ó)ˆHØ+3ˆMœ-Ñ(ä˜Ó&Ð&r   rp   rO   )	rQ   rR   rS   rT   r[   r   ro   rm   Ú__classcell__)rŒ   s   @r   r‡   r‡   d  sI   ø„ ñð  %ð:ð &+ò	:àð:ð #ð	:ð
 
õ:ð dó ÷*'r   r‡   c                   ó   — e Zd ZdZdd„Zy)ÚOsResourceDetectorzxDetect os resources based on `Operating System conventions <https://opentelemetry.io/docs/specs/semconv/resource/os/>`_.c                 ó  — t        j                  «       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«  sw   € ô| —/‘/Ó#×)Ñ)Ó+ˆÜ×%Ñ%Ó'ˆ
ð �iÒÜ!×)Ñ)Ó+‰Jà˜ÒØˆGÜ!×)Ñ)Ó+ˆJää˜Ü˜Jðó
ð 	
r   NrO   ©rQ   rR   rS   rT   rm   r4   r   r   r·   r·   ¨  s   „ ñ Cô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 }|j                  «       j                  «       xs d cd d d «       S # 1 sw Y   y xY w# t        $ r!}t        j                  d| |«       Y d }~y 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Ñ   	  se   € ðÜ�$ Ô(ð 	:¨OØ"×'Ñ'Ó)×/Ñ/Ó1Ò9°T÷	:÷ 	:ò 	:ûäò Ü�‰Ð,¨d°IÔ>Üûðús1   ‚A �";±	A »AÁ A ÁA Á	A1ÁA,Á,A1Úcommand.c                 óØ   — 	 t        j                  | ddt        d¬«      }|j                  S # t         j                  t        f$ r$}t
        j                  d| d   |«       Y d}~yd}~ww xY w)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ß     sh   € ð
Ü—N‘NØØØÜ,Øô
ˆ	ð ×ÑÐøô ×)Ñ)Ô+<Ð=ò Ü�‰Ð+¨W°Q©Z¸ÔCÜûðús   ‚, ¬A)ÁA$Á$A)c                  ó<   — t         D ]  } t        | «      }|sŒ|c S  y r2   )Ú_LINUX_MACHINE_ID_PATHSrÑ   )r,   Ú
machine_ids     r   Ú_get_linux_machine_idrã   &  s)   € Ü'ò ˆÜ*¨4Ó0ˆ
ÚØÒðð r   c                  óf   — t        t        «      xs! t        t        «      j	                  «       xs d S r2   )rÑ   Ú_BSD_HOSTID_PATHrß   Ú_BSD_KENV_COMMANDr~   r4   r   r   Ú_get_bsd_machine_idrç   .  s(   € Ü Ô!1Ó2Òe´lÔCTÓ6U×6[Ñ6[Ó6]ÒeÐaeÐer   c                  ó  — t        t        «      j                  «       D ]a  } | j                  d«      \  }}}|r"|j	                  «       j	                  d«      dk7  rŒ=|j	                  «       j	                  d«      }|sŒ_|c S  y )Nrw   ú"ÚIOPlatformUUID)rß   Ú_MACOS_IOREG_COMMANDÚ
splitlinesÚ	partitionr~   )Úliner‚   Ú	separatorr]   râ   s        r   Ú_get_macos_machine_idrð   2  sx   € ÜÔ1Ó2×=Ñ=Ó?ò ˆà $§¡¨sÓ 3ÑˆˆY˜Ù˜CŸI™I›K×-Ñ-¨cÓ2Ð6FÒFØà—[‘[“]×(Ñ(¨Ó-ˆ
ÚØÒðð r   c                  óX  — t         €t        j                  dt        «       y t         j	                  t         j
                  t        t         j                  t         j                  z  ¬«      5 } t         j                  | t        «      \  }}d d d «       rt        |«      S d S # 1 sw Y   ŒxY w)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ØÜ	�‰Ü×!Ñ!Ü!Ü�‰¤×!7Ñ!7Ñ7ð 
ó 
ð Pð 
Ü ×-Ñ-¨cÔ3NÓO‰ˆ�a÷Pñ !-Œ3ˆ|ÓÐ6°$Ð6÷Pð Pús   Á+B Â B)c                  óü   — t        j                  «       } | dk(  r
t        «       S | dk(  r
t        «       S | dk(  r
t	        «       S | dk(  s| j                  d«      r
t        «       S t        j                  dt        | «       y )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  sq   € Ü�_‰_Ó€FØ�ÒÜ$Ó&Ð&Ø�ÒÜ$Ó&Ð&Ø�ÒÜ&Ó(Ð(Ø�Ò §¡°Ô 6Ü"Ó$Ð$Ü
‡L�LÐ;¼WÀfÔMØr   c                   ó   — e Zd ZdZdd„Zy)Ú_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``.
    c                 ó8  — t         t        j                  «       t        t	        j
                  «       i}	 t        «       x}r	||t        <   t        |«      S # t        $ r<}t        j                  dt        |«       | j                  r‚ Y d }~t        |«      S d }~ww xY w)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Ð(Ø)0�œgÑ&ô ˜Ó&Ð&øô ò 	Ü�N‰NÐ4´g¸yÔIØ×"Ò"Øó #ô ˜Ó&Ð&ûð	ús   ´A Á	BÁ(BÂBNrO   rÄ   r4   r   r   r  r  Z  s   „ ñ	ô'r   r  c                   ó$   — e Zd ZdZdefd„Zdd„Zy)Ú!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                  ó   — yrŽ   r4   r7   s    r   ro   z6ServiceInstanceIdResourceDetector.is_process_dependentŒ  r�   r   c                 óê   — t         5  t        j                  «       }t        �	t        |k7  rt        t        j                  «       «      a|at        }d d d «       t        t        i«      S # 1 sw Y   ŒxY wr2   )
Ú_service_instance_id_lockr+   r›   rd   re   rV   ÚuuidÚuuid4r   ÚSERVICE_INSTANCE_ID)r   Úcurrent_pidÚinstance_ids      r   rm   z(ServiceInstanceIdResourceDetector.detect�  sd   € ô 'ñ 	/ÜŸ)™)›+ˆKÜ#Ð+Ô/GÈ;Ò/VÜ'*¬4¯:©:«<Ó'8Ð$Ø+6Ð(Ü.ˆK÷	/ô Ô,¨kÐ:Ó;Ð;÷	/ð 	/ús   ‡A	A)Á)A2NrO   )rQ   rR   rS   rT   r[   ro   rm   r4   r   r   r  r  {  s   „ ñð  dó ô	<r   r  c                  óò  — t        j                  t        d«      j                  d«      D � cg c]#  } | j	                  «       sŒ| j	                  «       ‘Œ% }} d|v rg ndg}t        t        j                  ||z   dgz   «      «      }|ddgk(  rt        «       t        «       gS ddl
m} d|v r\t        d„  |d	¬
«      j                  D «       «      }t        |t        |«      z
  «      }|j                  d«      }|d| |z   ||dz   d z   }g }|D ]A  } 	 |j!                   t#        t%         |d	| ¬«      «      «      j'                  «       «       «       ŒC |S c c} w # t(        $ r t*        j-                  d| «       Y Œlw xY w)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.
    r   rv   Úservice_instanceÚotelr   )Úentry_pointsÚ*c              3   ó*   K  — | ]  }|d k7  r|–— Œ y­w)r  Nr4   )Ú.0r¡   s     r   ú	<genexpr>z,_build_resource_detectors.<locals>.<genexpr>·  s   è ø€ ò 
àØ�vŠ~ô ñ
ùs   ‚Úopentelemetry_resource_detector)ÚgroupNrx   )r#  r¡   z/Failed to load resource detector '%s', skipping)r   r'   r
   rz   r~   r§   r<   Úfromkeysr  rt   Ú&opentelemetry.util._importlib_metadatar  ÚsetÚnamesÚsortedÚindexÚappendÚnextÚiterÚloadr  r>   rÐ   )	r¡   Úconfigured_detector_namesÚdefault_detector_namesÚdetector_namesr  Ú
registeredÚ	expansionÚidxÚ	detectorss	            r   r$   r$   ›  sª  € ô ")§¡Ô-QÐSUÓ!V×!\Ñ!\Ð]`Ó!aö!ØÐei×eoÑeoÕeqˆ�
‰
�ð!Ðð !ð $6Ð9RÑ#R™RÐYkÐXlÐÜ $¤T§]¡]Ð3IÐLeÑ3eÐioÐhpÑ3pÓ%qÓ r€Nð Ð,¨fÐ5Ò5Ü1Ó3Ô5IÓ5KÐLÐLõð ˆnÑÜñ 
á$Ð+LÔM×SÑSô
ó 
ˆ
ô
 ˜:¬¨NÓ(;Ñ;Ó<ˆ	Ø×"Ñ" 3Ó'ˆØ'¨¨Ð-°	Ñ9¸NÈ3ÐQRÉ7È9Ð<UÑUˆà(*€IØò ˆð	Ø×Ñð”ÜÙ$Ø"CØ!%ôóó÷ ‘$“&óõ	ðð" ÐùòW!øôL ò 	Ü×ÑØAØöð	ús   ¬EÁEÄ>EÅE6Å5E6c                  ó–   — t        t        «       D � cg c]  } | j                  «       sŒ| ‘Œ c} t        j	                  «       «      S c c} w r2   )r#   r$   ro   r   r5   )Údetectors    r   Ú_get_process_dependent_resourcer7  Õ  s:   € Ü#Ü";Ó"=Öa�hÀ×A^ÑA^ÕA`ŠÒaÜ×ÑÓóð ùÚas
   ’A¨Ar4  Úinitial_resourcerÖ   c                 óä  — |xs t         j                  «       }t        j                  j	                  d¬«      }	 | D �cg c]  }|j                  |j                  «      ‘Œ }}t        |«      D ]4  \  }}| |   }t        }		 |j                  |¬«      }	|j                  |	«      }Œ6 	 |j!                  dd¬«       |S c c}w # t        j                  j                  $ r/}
|j                  r|
‚t        j                  d||«       Y d}
~
Œud}
~
wt        $ r/}
|j                  r|
‚t        j                  d|
|«       Y d}
~
Œ«d}
~
ww xY w# |j                  |	«      }w xY w# |j!                  dd¬«       w xY w)	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:
    rP   )Úmax_workers)rÖ   z1Detector %s took longer than %s seconds, skippingNz%Exception %s in detector %s, ignoringT)ÚwaitÚcancel_futures)r   r0   Ú
concurrentÚfuturesÚThreadPoolExecutorÚsubmitrm   Ú	enumerater3   ÚresultÚTimeoutErrorrh   r>   r|   r  r&   Úshutdown)r4  r8  rÖ   Údetectors_merged_resourceÚexecutorr6  r>  Údetector_indÚfutureÚdetected_resourceÚexs              r   r#   r#   Ü  sm  € ð !1Ò E´H·O±OÓ4EÐô ×!Ñ!×4Ñ4ÀÐ4ÓC€Hð:ØDMÖN¸�8—?‘? 8§?¡?Õ3ÐNˆÐNÜ$-¨gÓ$6ò 	_Ñ ˆL˜&Ø  Ñ.ˆHÜ*9Ðð_Ø$*§M¡M¸' MÓ$BÐ!ð -F×,KÑ,KÐL]Ó,^Ñ)ñ'	_ð* 	×Ñ˜t°DÐÔ9à$Ð$ùò1 Oøô ×%Ñ%×2Ñ2ò Ø×*Ò*Ø�HÜ—‘ØGØØ÷ñ ûô ò VØ×*Ò*Ø�HÜ—‘ÐFÈÈH×UÑUûðVûð
 -F×,KÑ,KÐL]Ó,^Ñ)ûà×Ñ˜t°DÐÕ9úsd   ºE ¾"B:Á E Á?B?ÂE Â:E Â?EÃ%DÄEÄEÄ%D<Ä7EÄ<EÅEÅEÅE ÅE/)Né   )ŸrT   rq   Úconcurrent.futuresr=  Ú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$   r7  r#   r4   r   r   ú<module>r›     sk  ðò.óf Û Û Û 	Û Û Û Û 
Û Û ß -Ý Ý Ý Ý å 6÷ñ õ
õ >Ý -à €ˆ
�TÑÓ  ð	Û"à€Fð
 !€ˆ
�TÑÓ  ð	Û"à€Fð €
Ø�S˜*�_Ñ%€
Ø	ˆ×	Ñ	˜8Ó	$€Ø#×2Ñ2€Ø%×6Ñ6Ð Ø!×.Ñ.€Ø,×DÑDÐ Ø#×2Ñ2€Ø!×.Ñ.€Ø)×>Ñ>Ð Ø(×<Ñ<Ð Ø+×BÑBÐ Ø×(Ñ(€	Ø
×
$Ñ
$€Ø!×.Ñ.€Ø"×0Ñ0€Ø×(Ñ(€	Ø×(Ñ(€	Ø
×
$Ñ
$€Ø×(Ñ(€	Ø$×4Ñ4€Ø"×0Ñ0€Ø'×:Ñ:Ð Ø,×=Ñ=Ð Ø.×AÑAÐ Ø'×3Ñ3Ð Ø(×5Ñ5Ð Ø.×AÑAÐ Ø/×BÑBÐ Ø0×DÑDÐ Ø.×AÑAÐ Ø/×CÑCÐ Ø0×DÑDÐ Ø1×FÑFÐ Ø.×@Ñ@Ð Ø/×BÑBÐ Ø'×3Ñ3Ð Ø(×5Ñ5Ð Ø,×<Ñ<Ð Ø-×>Ñ>Ð Ø#×2Ñ2€Ø
×
$Ñ
$€Ø×*Ñ*€
Ø ×,Ñ,€Ø'×:Ñ:Ð Ø,×DÑDÐ Ø,×DÑDÐ Ø$×4Ñ4€Ø)×>Ñ>Ð Ø)×>Ñ>Ð Ø"×0Ñ0€Ø)×>Ñ>Ð Ø,×DÑDÐ Ø0×LÑLÐ Ø!×.Ñ.€Ø&×8Ñ8Ð Ø(×<Ñ<Ð Ø$×4Ñ4€Ø'×:Ñ:Ð Ø*×@Ñ@Ð Ø+×BÑBÐ Ø+×BÑBÐ ÷k
ñ k
ð\
˜ð 
 Có 
ñ ˜2“,€áà Ø˜OØÐ9ðóÐ ð $(Ð �c˜D‘jÓ 'Ø'+Ð ˜# ™*Ó +Ø*˜IŸNšNÓ,Ð ô�s—w’wô ô2*Ð+ô *ô4A'Ð.ô A'ôHQ
Ð)ô Q
ðl JÐ Ø Ð Ø=Ð ØRÐ Ø>Ð Ø+Ð ð Ð ð ð ¨¨d©
ó ð˜%  S ™/ð ¨có ð(˜s T™zó ðf˜S 4™Zó fð
˜s T™zó 
ð
7  t¡ó 
7ð�c˜D‘jó ô'Ð,ô 'ôB<Ð(8ô <ð@7 4Ð(:Ñ#;ó 7ðt¨ó ð )-Øñ,%ØÐ*Ñ+ð,%à ‘oð,%ð ð,%ð ô	,%øðG ò 	Úð	ûð ò 	Úð	ús$   Á9R Â
R ÒRÒ
RÒRÒR