o
    i                     @   s   d Z ddlZddlZddlZddlmZmZmZ ddlm	Z	 ddl
mZmZ ddlmZmZmZ ddlmZmZmZ ddlmZ dd	lmZ ed
e  ede  ede  																	dddZdS )a  
Datadogpy is a collection of Datadog Python tools.
It contains:
* datadog.api: a Python client for Datadog REST API.
* datadog.dogstatsd: a DogStatsd Python client.
* datadog.threadstats: an alternative tool to DogStatsd client for collecting application metrics
without hindering performance.
* datadog.dogshell: a command-line tool, wrapping datadog.api, to interact with Datadog REST API.
    N)AnyListOptional)api)	DogStatsdstatsd)ThreadStatsdatadog_lambda_wrapperlambda_metric)	iteritemsNullHandlertext)get_hostname)__version__zdatadog.apizdatadog.dogstatsdzdatadog.threadstatsT333333?Fc                 K   sJ  | pt jptjdtjdt _|p t jp tjdtjdt _|t _|p-t jp-t|t _|p:t j	p:tjddt _	|
rH|
t
_dt
_dt
_n|sL|	rSt
||	t
_|rZt|t
_t
  |ret|t
_|rnt
 j|7  _|rut
  nt
|| |t
_|t _|ptjdtjd	t
_t|D ]\}}d
|}tt || qdS )aR  
    Initialize and configure Datadog.api and Datadog.statsd modules

    :param api_key: Datadog API key
    :type api_key: string

    :param app_key: Datadog application key
    :type app_key: string

    :param host_name: Set a specific hostname
    :type host_name: string

    :param proxies: Proxy to use to connect to Datadog API;
                    for example, 'proxies': {'http': "http:<user>:<pass>@<ip>:<port>/"}
    :type proxies: dictionary mapping protocol to the URL of the proxy.

    :param api_host: Datadog API endpoint
    :type api_host: url

    :param statsd_host: Host of DogStatsd server or statsd daemon
    :type statsd_host: address

    :param statsd_port: Port of DogStatsd server or statsd daemon
    :type statsd_port: port

    :param statsd_disable_buffering: Enable/disable statsd client buffering support
                                     (default: True).
    :type statsd_disable_buffering: boolean

    :param statsd_disable_aggregation: Enable/disable statsd client aggregation support
                                     (default: True).
    :type statsd_disable_aggregation: boolean

    :param statsd_max_samples_per_context: Set the max samples per context for Histogram,
    Distribution and Timing metrics. Use with the statsd_disable_aggregation set to False.
    :type statsd_max_samples_per_context: int

    :param statsd_aggregation_flush_interval: If aggregation is enabled, set the flush interval for
                    aggregation/buffering (This feature is experimental)
                                     (default: 0.3 seconds)
    :type statsd_aggregation_flush_interval: float

    :param statsd_use_default_route: Dynamically set the statsd host to the default route
                                     (Useful when running the client in a container)
    :type statsd_use_default_route: boolean

    :param statsd_socket_path: path to the DogStatsd UNIX socket. Supersedes statsd_host
                               and stats_port if provided.

    :param statsd_constant_tags: A list of tags to be applied to all metrics ("tag", "tag:value")
    :type statsd_constant_tags: list of string

    :param cacert: Path to local certificate file used to verify SSL         certificates. Can also be set to True (default) to use the systems         certificate store, or False to skip SSL verification
    :type cacert: path or boolean

    :param mute: Mute any ApiError or ClientError before they escape         from datadog.api.HTTPClient (default: True).
    :type mute: boolean

    :param return_raw_response: Whether or not to return the raw response object in addition         to the decoded response content (default: False)
    :type return_raw_response: boolean

    :param hostname_from_config: Set the hostname from the Datadog agent config (agent 5). Will be deprecated
    :type hostname_from_config: boolean

    :param cardinality: Set the global cardinality for all metrics.         Possible values are "none", "low", "orchestrator" and "high".
        Can also be set via the DATADOG_CARDINALITY or DD_CARDINALITY environment variables.
    :type cardinality: string

    DATADOG_API_KEY
DD_API_KEYDATADOG_APP_KEY
DD_APP_KEYDATADOG_HOSTzhttps://api.datadoghq.comNDATADOG_CARDINALITYDD_CARDINALITYz_{})r   _api_keyosenvironget_application_key_hostname_from_config
_host_namer   	_api_hostr   socket_pathhostportresolve_hostintclose_socketr   	namespaceconstant_tagsdisable_aggregationenable_aggregationdisable_buffering_return_raw_responsecardinalityr   formatsetattr)api_keyapp_key	host_nameapi_hoststatsd_hoststatsd_portstatsd_disable_aggregationstatsd_disable_buffering!statsd_aggregation_flush_intervalstatsd_use_default_routestatsd_socket_pathstatsd_namespacestatsd_max_samples_per_contextstatsd_constant_tagsreturn_raw_responsehostname_from_configr,   kwargskeyvalue	attribute rC   D/home/ubuntu/.local/lib/python3.10/site-packages/datadog/__init__.py
initialize!   s:   "`



rE   )NNNNNNTTr   FNNr   NFTN)__doc__loggingr   os.pathtypingr   r   r   datadogr   datadog.dogstatsdr   r   datadog.threadstatsr   r	   r
   datadog.util.compatr   r   r   datadog.util.hostnamer   datadog.versionr   	getLogger
addHandlerrE   rC   rC   rC   rD   <module>   s@   
