diff --git a/.pylintrc b/.pylintrc index 1aa1e10d0b47..9c082a23be13 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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= diff --git a/reference/ddtrace/ext/aws.py b/reference/ddtrace/ext/aws.py index 931b92bd002c..f719bbd224fa 100644 --- a/reference/ddtrace/ext/aws.py +++ b/reference/ddtrace/ext/aws.py @@ -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'], } @@ -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) @@ -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) diff --git a/reference/ddtrace/http/headers.py b/reference/ddtrace/http/headers.py index b680a5c45a07..a1ede791b86e 100644 --- a/reference/ddtrace/http/headers.py +++ b/reference/ddtrace/http/headers.py @@ -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 @@ -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 diff --git a/reference/ddtrace/settings/config.py b/reference/ddtrace/settings/config.py index 67b14aa76a53..4ed421562729 100644 --- a/reference/ddtrace/settings/config.py +++ b/reference/ddtrace/settings/config.py @@ -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): diff --git a/reference/ddtrace/settings/http.py b/reference/ddtrace/settings/http.py index ccce2c3739cc..3e71ac586601 100644 --- a/reference/ddtrace/settings/http.py +++ b/reference/ddtrace/settings/http.py @@ -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 @@ -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) diff --git a/reference/docs/advanced_usage.rst b/reference/docs/advanced_usage.rst index 3d65dcf43585..1f6d7ee9632e 100644 --- a/reference/docs/advanced_usage.rst +++ b/reference/docs/advanced_usage.rst @@ -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. diff --git a/reference/tests/contrib/botocore/test.py b/reference/tests/contrib/botocore/test.py index e99aa8ce8b13..eb8bb45075c1 100644 --- a/reference/tests/contrib/botocore/test.py +++ b/reference/tests/contrib/botocore/test.py @@ -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 diff --git a/reference/tests/unit/http/test_headers.py b/reference/tests/unit/http/test_headers.py index d0e6b692e9ce..d2a5f54c1a1a 100644 --- a/reference/tests/unit/http/test_headers.py +++ b/reference/tests/unit/http/test_headers.py @@ -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 @@ -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 @@ -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 diff --git a/reference/tests/unit/test_settings.py b/reference/tests/unit/test_settings.py index e2243227559b..a340ab25792a 100644 --- a/reference/tests/unit/test_settings.py +++ b/reference/tests/unit/test_settings.py @@ -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')