コード例 #1
0
def uds_path():
    if Platform.is_mac():
        # See: https://github.com/docker/for-mac/issues/483
        pytest.skip('Sharing Unix sockets is not supported by Docker for Mac.')

    with TempDir() as tmp_dir:
        compose_file = os.path.join(HERE, 'compose', 'uds.yaml')
        uds_filename = 'tmp.sock'
        uds_path = os.path.join(tmp_dir, uds_filename)
        with docker_run(
                compose_file=compose_file,
                env_vars={
                    "UDS_HOST_DIRECTORY": tmp_dir,
                    'UDS_FILENAME': uds_filename,
                },
        ):
            yield uds_path
コード例 #2
0
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import psutil

from datadog_checks.base.utils.platform import Platform
from datadog_checks.dev import get_here

HERE = get_here()
CHECK_NAME = "system_core"

INSTANCE = {"tags": ["tag1:value1"]}

if Platform.is_mac():
    CHECK_RATES = [
        'system.core.idle', 'system.core.nice', 'system.core.system',
        'system.core.user'
    ]
    MOCK_PSUTIL_CPU_TIMES = [
        psutil._psosx.scputimes(user=7877.29,
                                nice=0.0,
                                system=7469.72,
                                idle=38164.81),
        psutil._psosx.scputimes(user=3826.74,
                                nice=0.0,
                                system=2701.6,
                                idle=46981.39),
        psutil._psosx.scputimes(user=7486.51,
                                nice=0.0,
                                system=5991.36,
                                idle=40031.88),