o
    i                     @   s0  d dl Z d dlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm	Z	 dd
lm
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ deeeef eeef eeee f f fddZdS )    N)Optional   )
AgentError)BuilderError)DDSketch)DeserializationError)IoError)NetworkError)PyConfigurator)PyTracerMetadata)RequestError)SerializationError)TraceExporter)TraceExporterBuilder)config)ffe)generate_128bit_trace_id)logger)
rand64bits)seed)store_metadatareturnc               
   C   s  t dd  dv } t| }t dd}t dd}|r#|| |r*|| i }i }i }z8| D ]1}|d }|d }	|	d	krQ|d
 ||< |d||< q5|	dkr\|d
 ||< q5t	d|	 d|  q5W n t
y }
 zt	d|
  W Y d}
~
nd}
~
ww |||fS )a  
    Retrieves the tracer configuration from disk. Calls the PyConfigurator object
    to read the configuration from the disk using the libdatadog shared library
    and returns the corresponding configuration
    See https://github.com/DataDog/libdatadog/blob/06d2b6a19d7ec9f41b3bfd4ddf521585c55298f6/library-config/src/lib.rs
    for more information on how the configuration is read from disk
    DD_TRACE_DEBUGfalse)true1_DD_SC_LOCAL_FILE_OVERRIDE _DD_SC_MANAGED_FILE_OVERRIDEnamesourcefleet_stable_configvalue	config_idlocal_stable_configzUnknown configuration source: z, for z2Failed to load configuration from disk, skipping: N)osgetenvlowerstripr
   set_local_file_overrideset_managed_file_overrideget_configurationgetprint	Exception)
debug_logsconfiguratorlocal_file_overridemanaged_file_overridefleet_configfleet_config_idslocal_configentryenvr    e r9   T/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/internal/native/__init__.pyget_configuration_from_disk   s6   



r;   )r%   typingr   _nativer   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   tupledictstrr;   r9   r9   r9   r:   <module>   s,    8