Skip to content

Commit

Permalink
Remove non-inclusive language (#43)
Browse files Browse the repository at this point in the history
Addresses #42

TODO: address pylint
  • Loading branch information
flands authored Sep 9, 2020
1 parent eaeb508 commit ce66c8d
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# run arbitrary code.
extension-pkg-whitelist=

# Add files or directories to the blacklist. They should be base names, not
# Add files or directories to the denylist. They should be base names, not
# paths.
ignore=CVS,gen

# Add files or directories matching the regex patterns to the blacklist. The
# Add files or directories matching the regex patterns to the denylist. The
# regex matches against base names, not paths.
ignore-patterns=

Expand Down
10 changes: 5 additions & 5 deletions reference/ddtrace/ext/aws.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from ..utils.formats import flatten_dict


BLACKLIST_ENDPOINT = ['kms', 'sts']
BLACKLIST_ENDPOINT_TAGS = {
DENYLIST_ENDPOINT = ['kms', 'sts']
DENYLIST_ENDPOINT_TAGS = {
's3': ['params.Body'],
}

Expand All @@ -18,8 +18,8 @@ def truncate_arg_value(value, max_len=1024):


def add_span_arg_tags(span, endpoint_name, args, args_names, args_traced):
if endpoint_name not in BLACKLIST_ENDPOINT:
blacklisted = BLACKLIST_ENDPOINT_TAGS.get(endpoint_name, [])
if endpoint_name not in DENYLIST_ENDPOINT:
denylisted = DENYLIST_ENDPOINT_TAGS.get(endpoint_name, [])
tags = dict(
(name, value)
for (name, value) in zip(args_names, args)
Expand All @@ -29,7 +29,7 @@ def add_span_arg_tags(span, endpoint_name, args, args_names, args_traced):
tags = {
k: truncate_arg_value(v)
for k, v in tags.items()
if k not in blacklisted
if k not in denylisted
}
span.set_tags(tags)

Expand Down
4 changes: 2 additions & 2 deletions reference/ddtrace/http/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def store_request_headers(headers, span, integration_config):
"""
Store request headers as a span's tags
:param headers: All the request's http headers, will be filtered through the whitelist
:param headers: All the request's http headers, will be filtered through the allowlist
:type headers: dict or list
:param span: The Span instance where tags will be stored
:type span: ddtrace.Span
Expand All @@ -30,7 +30,7 @@ def store_request_headers(headers, span, integration_config):
def store_response_headers(headers, span, integration_config):
"""
Store response headers as a span's tags
:param headers: All the response's http headers, will be filtered through the whitelist
:param headers: All the response's http headers, will be filtered through the allowlist
:type headers: dict or list
:param span: The Span instance where tags will be stored
:type span: ddtrace.Span
Expand Down
8 changes: 4 additions & 4 deletions reference/ddtrace/settings/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def _add(self, integration, settings, merge=True):
else:
self._config[integration] = IntegrationConfig(self, integration, settings)

def trace_headers(self, whitelist):
def trace_headers(self, allowlist):
"""
Registers a set of headers to be traced at global level or integration level.
:param whitelist: the case-insensitive list of traced headers
:type whitelist: list of str or str
:param allowlist: the case-insensitive list of traced headers
:type allowlist: list of str or str
:return: self
:rtype: HttpConfig
"""
self._http.trace_headers(whitelist)
self._http.trace_headers(allowlist)
return self

def header_is_traced(self, header_name):
Expand Down
26 changes: 13 additions & 13 deletions reference/ddtrace/settings/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ class HttpConfig(object):
"""

def __init__(self):
self._whitelist_headers = set()
self._allowlist_headers = set()
self.trace_query_string = None

@property
def is_header_tracing_configured(self):
return len(self._whitelist_headers) > 0
return len(self._allowlist_headers) > 0

def trace_headers(self, whitelist):
def trace_headers(self, allowlist):
"""
Registers a set of headers to be traced at global level or integration level.
:param whitelist: the case-insensitive list of traced headers
:type whitelist: list of str or str
:param allowlist: the case-insensitive list of traced headers
:type allowlist: list of str or str
:return: self
:rtype: HttpConfig
"""
if not whitelist:
if not allowlist:
return

whitelist = [whitelist] if isinstance(whitelist, str) else whitelist
for whitelist_entry in whitelist:
normalized_header_name = normalize_header_name(whitelist_entry)
allowlist = [allowlist] if isinstance(allowlist, str) else allowlist
for allowlist_entry in allowlist:
normalized_header_name = normalize_header_name(allowlist_entry)
if not normalized_header_name:
continue
self._whitelist_headers.add(normalized_header_name)
self._allowlist_headers.add(normalized_header_name)

return self

Expand All @@ -46,9 +46,9 @@ def header_is_traced(self, header_name):
:rtype: bool
"""
normalized_header_name = normalize_header_name(header_name)
log.debug('Checking header \'%s\' tracing in whitelist %s', normalized_header_name, self._whitelist_headers)
return normalized_header_name in self._whitelist_headers
log.debug('Checking header \'%s\' tracing in allowlist %s', normalized_header_name, self._allowlist_headers)
return normalized_header_name in self._allowlist_headers

def __repr__(self):
return '<{} traced_headers={} trace_query_string={}>'.format(
self.__class__.__name__, self._whitelist_headers, self.trace_query_string)
self.__class__.__name__, self._allowlist_headers, self.trace_query_string)
2 changes: 1 addition & 1 deletion reference/docs/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Examples::
])

The following rules apply:
- headers configuration is based on a whitelist. If a header does not appear in the whitelist, it won't be traced.
- headers configuration is based on a allowlist. If a header does not appear in the allowlist, it won't be traced.
- headers configuration is case-insensitive.
- if you configure a specific integration, e.g. 'requests', then such configuration overrides the default global
configuration, only for the specific integration.
Expand Down
2 changes: 1 addition & 1 deletion reference/tests/contrib/botocore/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_s3_put(self):
self.assertEqual(spans[1].resource, 's3.putobject')
self.assertEqual(spans[1].get_tag('params.Key'), stringify(params['Key']))
self.assertEqual(spans[1].get_tag('params.Bucket'), stringify(params['Bucket']))
# confirm blacklisted
# confirm denylisted
self.assertIsNone(spans[1].get_tag('params.Body'))

@mock_sqs
Expand Down
6 changes: 3 additions & 3 deletions reference/tests/unit/http/test_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_value_not_trim_leading_trailing_spaced(self, span, integration_config):
}, span, integration_config)
assert span.get_tag('http.response.headers.content-type') == ' some;value '

def test_no_whitelist(self, span, integration_config):
def test_no_allowlist(self, span, integration_config):
"""
:type span: Span
:type integration_config: IntegrationConfig
Expand All @@ -147,7 +147,7 @@ def test_no_whitelist(self, span, integration_config):
}, span, integration_config)
assert span.get_tag('http.response.headers.content-type') is None

def test_whitelist_exact(self, span, integration_config):
def test_allowlist_exact(self, span, integration_config):
"""
:type span: Span
:type integration_config: IntegrationConfig
Expand All @@ -158,7 +158,7 @@ def test_whitelist_exact(self, span, integration_config):
}, span, integration_config)
assert span.get_tag('http.response.headers.content-type') == 'some;value'

def test_whitelist_case_insensitive(self, span, integration_config):
def test_allowlist_case_insensitive(self, span, integration_config):
"""
:type span: Span
:type integration_config: IntegrationConfig
Expand Down
2 changes: 1 addition & 1 deletion reference/tests/unit/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_trace_headers(self):
assert http_config.header_is_traced('some_header')
assert not http_config.header_is_traced('some_other_header')

def test_trace_headers_whitelist_case_insensitive(self):
def test_trace_headers_allowlist_case_insensitive(self):
http_config = HttpConfig()
http_config.trace_headers('some_header')
assert http_config.header_is_traced('sOmE_hEaDeR')
Expand Down

0 comments on commit ce66c8d

Please sign in to comment.