Skip to content

Commit 23c9011

Browse files
chore(asm): less appsec imports (#8057)
For now `ddtrace.appsec._constants` does not depend of other appsec modules. So importing it is lightweight. By moving one import in `ddtrace/appsec/_utils.py` from global to local scope, this allows `ddtrace.appsec._utils` and `ddtrace.appsec._capabilities` to also not depend of all other appsec modules, ensuring less memory usage when asm stays disabled. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] 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) - [x] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [x] This PR doesn't touch any of that.
1 parent 5fb7826 commit 23c9011

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ddtrace/appsec/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import uuid
33

4-
from ddtrace.appsec import _asm_request_context
54
from ddtrace.appsec._constants import API_SECURITY
65
from ddtrace.constants import APPSEC_ENV
76
from ddtrace.internal.logger import get_logger
@@ -20,6 +19,7 @@ def parse_response_body(raw_body):
2019

2120
import xmltodict
2221

22+
from ddtrace.appsec import _asm_request_context
2323
from ddtrace.appsec._constants import SPAN_DATA_NAMES
2424
from ddtrace.contrib.trace_utils import _get_header_value_case_insensitive
2525

0 commit comments

Comments
 (0)