Skip to content

Commit 1cd1e73

Browse files
chore: replaced with _get_config for pyramid integration (#13122)
## 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) --------- Co-authored-by: Emmett Butler <[email protected]>
1 parent 550ecdf commit 1cd1e73

File tree

1 file changed

+6
-8
lines changed
  • ddtrace/contrib/internal/pyramid

1 file changed

+6
-8
lines changed

ddtrace/contrib/internal/pyramid/patch.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import os
2-
31
import pyramid
42
import pyramid.config
53
import wrapt
64

75
from ddtrace import config
86
from ddtrace.internal.utils.formats import asbool
7+
from ddtrace.settings._config import _get_config
98

109
from .constants import SETTINGS_ANALYTICS_ENABLED
1110
from .constants import SETTINGS_ANALYTICS_SAMPLE_RATE
@@ -18,7 +17,7 @@
1817
config._add(
1918
"pyramid",
2019
dict(
21-
distributed_tracing=asbool(os.getenv("DD_PYRAMID_DISTRIBUTED_TRACING", default=True)),
20+
distributed_tracing=asbool(_get_config("DD_PYRAMID_DISTRIBUTED_TRACING", default=True)),
2221
),
2322
)
2423

@@ -51,13 +50,12 @@ def traced_init(wrapped, instance, args, kwargs):
5150
service = config._get_service(default="pyramid")
5251
# DEV: integration-specific analytics flag can be not set but still enabled
5352
# globally for web frameworks
54-
old_analytics_enabled = os.getenv("DD_PYRAMID_ANALYTICS_ENABLED")
55-
analytics_enabled = os.environ.get("DD_TRACE_PYRAMID_ANALYTICS_ENABLED", old_analytics_enabled)
53+
old_analytics_enabled = _get_config("DD_PYRAMID_ANALYTICS_ENABLED")
54+
analytics_enabled = _get_config("DD_TRACE_PYRAMID_ANALYTICS_ENABLED", default=old_analytics_enabled)
5655
if analytics_enabled is not None:
5756
analytics_enabled = asbool(analytics_enabled)
58-
# TODO: why is analytics sample rate a string or a bool here?
59-
old_analytics_sample_rate = os.getenv("DD_PYRAMID_ANALYTICS_SAMPLE_RATE", default=True)
60-
analytics_sample_rate = os.environ.get("DD_TRACE_PYRAMID_ANALYTICS_SAMPLE_RATE", old_analytics_sample_rate)
57+
analytics_sample_rate = _get_config("DD_TRACE_PYRAMID_ANALYTICS_SAMPLE_RATE")
58+
6159
trace_settings = {
6260
SETTINGS_SERVICE: service,
6361
SETTINGS_DISTRIBUTED_TRACING: config.pyramid.distributed_tracing,

0 commit comments

Comments
 (0)