Skip to content

Commit 333a9b5

Browse files
authored
chore(configs): make rc and http configs internal [3.0] [backport 2.20] (#12086)
Backports: #12055 ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent bca45d4 commit 333a9b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1126
-1100
lines changed

ddtrace/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# configure ddtrace logger before other modules log
1818
configure_ddtrace_logger() # noqa: E402
1919

20-
from .settings import _config as config
20+
from .settings import _global_config as config
2121

2222

2323
# Enable telemetry writer and excepthook as early as possible to ensure we capture any exceptions from initialization

ddtrace/_monkey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .internal import telemetry
1313
from .internal.logger import get_logger
1414
from .internal.utils import formats
15-
from .settings import _config as config
15+
from .settings import _global_config as config
1616

1717

1818
if TYPE_CHECKING: # pragma: no cover

ddtrace/_trace/sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from ..internal.rate_limiter import RateLimiter
2323
from ..internal.sampling import _get_highest_precedence_rule_matching
2424
from ..internal.sampling import _set_sampling_tags
25-
from ..settings import _config as ddconfig
25+
from ..settings import _global_config as ddconfig
2626
from .sampling_rule import SamplingRule
2727

2828

ddtrace/contrib/flask/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ def index():
8787
# Override service name
8888
config.flask['service_name'] = 'custom-service-name'
8989
90-
# Report 401, and 403 responses as errors
91-
config.http_server.error_statuses = '401,403'
92-
9390
.. __: http://flask.pocoo.org/
9491
9592
:ref:`All HTTP tags <http-tagging>` are supported for this integration.

ddtrace/contrib/httplib/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,8 @@
4242
4343
# Disable distributed tracing globally.
4444
config.httplib['distributed_tracing'] = False
45-
46-
# Change the service distributed tracing option only for this HTTP
47-
# connection.
48-
49-
# Python 2
50-
connection = urllib.HTTPConnection('www.datadog.com')
51-
52-
# Python 3
5345
connection = http.client.HTTPConnection('www.datadog.com')
5446
55-
cfg = config.get_from(connection)
56-
cfg['distributed_tracing'] = True
57-
58-
5947
:ref:`Headers tracing <http-headers-tracing>` is supported for this integration.
6048
"""
6149

ddtrace/contrib/internal/aiohttp/middlewares.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def finish_request_span(request, response):
108108
# DEV: aiohttp is special case maintains separate configuration from config api
109109
trace_query_string = request[REQUEST_CONFIG_KEY].get("trace_query_string")
110110
if trace_query_string is None:
111-
trace_query_string = config.http.trace_query_string
111+
trace_query_string = config._http.trace_query_string
112112
if trace_query_string:
113113
request_span.set_tag_str(http.QUERY_STRING, request.query_string)
114114

ddtrace/contrib/internal/botocore/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from ddtrace.internal.utils.formats import asbool
3434
from ddtrace.internal.utils.formats import deep_getattr
3535
from ddtrace.llmobs._integrations import BedrockIntegration
36-
from ddtrace.settings.config import Config
36+
from ddtrace.settings._config import Config
3737
from ddtrace.trace import Pin
3838

3939
from .services.bedrock import patched_bedrock_api_call

ddtrace/contrib/internal/dramatiq/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from ddtrace.contrib import trace_utils
1212
from ddtrace.ext import SpanKind
1313
from ddtrace.ext import SpanTypes
14-
from ddtrace.settings.config import Config
14+
from ddtrace.settings._config import Config
1515

1616

1717
def get_version() -> str:

ddtrace/contrib/internal/httplib/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def _wrap_request(func, instance, args, kwargs):
9191
if should_skip_request(pin, instance):
9292
return func_to_call(*args, **kwargs)
9393

94-
cfg = config.get_from(instance)
94+
cfg = config._get_from(instance)
9595

9696
try:
9797
# Create a new span and attach to this instance (so we can retrieve/update/close later on the response)

ddtrace/contrib/internal/requests/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _wrap_send(func, instance, args, kwargs):
7575
hostname, path = _extract_hostname_and_path(url)
7676
host_without_port = hostname.split(":")[0] if hostname is not None else None
7777

78-
cfg = config.get_from(instance)
78+
cfg = config._get_from(instance)
7979
service = None
8080
if cfg["split_by_domain"] and hostname:
8181
service = hostname
@@ -97,7 +97,7 @@ def _wrap_send(func, instance, args, kwargs):
9797

9898
# Configure trace search sample rate
9999
# DEV: analytics enabled on per-session basis
100-
cfg = config.get_from(instance)
100+
cfg = config._get_from(instance)
101101
analytics_enabled = cfg.get("analytics_enabled")
102102
if analytics_enabled:
103103
span.set_tag(_ANALYTICS_SAMPLE_RATE_KEY, cfg.get("analytics_sample_rate", True))

0 commit comments

Comments
 (0)