Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve no_proxy directly from the Datadog Agent's configuration #2004

Merged
merged 2 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions datadog_checks_base/datadog_checks/checks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under a 3-clause BSD style license (see LICENSE)
from collections import defaultdict
import logging
import os
import re
import json
import copy
Expand Down Expand Up @@ -106,7 +105,6 @@ def in_developer_mode(self):

def get_instance_proxy(self, instance, uri, proxies=None):
proxies = proxies if proxies is not None else self.proxies.copy()
proxies['no'] = os.getenv('no_proxy', os.getenv('NO_PROXY', None))

deprecated_skip = instance.get('no_proxy', None)
skip = (
Expand Down
11 changes: 11 additions & 0 deletions datadog_checks_base/tests/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
'https': '',
'no': None
}
NO_PROXY_DD_CONFIG_SETTINGS = {
'http': 'http://1.2.3.4:567',
'https': 'https://1.2.3.4:567',
'no': 'localhost'
}
BAD_PROXY_SETTINGS = {
'http': 'http://1.2.3.4:567',
'https': 'https://1.2.3.4:567',
Expand Down Expand Up @@ -100,3 +105,9 @@ def test_https_proxy_fail():
finally:
os.environ.clear()
os.environ.update(old_env)

def test_config_no_proxy():
with mock.patch('datadog_checks.checks.AgentCheck._get_requests_proxy', return_value=NO_PROXY_DD_CONFIG_SETTINGS):
check = AgentCheck()
proxy_results = check.get_instance_proxy({}, 'uri/health')
assert 'localhost' in proxy_results['no']
1 change: 0 additions & 1 deletion network/datadog_checks/network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ def _check_psutil(self, instance):
Gather metrics about connections states and interfaces counters
using psutil facilities
"""
# import pdb; pdb.set_trace()
custom_tags = instance.get('tags', [])
if self._collect_cx_state:
self._cx_state_psutil(tags=custom_tags)
Expand Down