chore(lint): migrate os.environ to env in data streams processor#17221
Open
chore(lint): migrate os.environ to env in data streams processor#17221
Conversation
Migrate `os.environ`/`os.getenv` to `ddtrace.internal.settings.env` in: - ddtrace/internal/datastreams/processor.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bm1549
added a commit
that referenced
this pull request
Mar 31, 2026
All `os.environ`/`os.getenv` usages in `ddtrace/` have been migrated to `ddtrace.internal.settings.env` via the split migration PRs: - apm-sdk-capabilities-python: #16724 - apm-core-python: #16725 - ci-app-libraries: #16726 - apm-idm-python (contrib): #16727 - asm-python: #17218 - ml-observability: #17219 - profiling-python: #17220 - data-streams-monitoring: #17221 This PR removes the "to be migrated" ignore lists, leaving only the permanent exceptions: - ddtrace/__init__.py — bootstrap: circular import with settings - ddtrace/internal/native/__init__.py — bootstrap: imported before settings Merge after all 8 migration PRs above are merged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of a series migrating all
os.environ/os.getenvusage inddtrace/to the centralizedenvMutableMapping fromddtrace.internal.settings(introduced in #17149).This PR covers
@DataDog/data-streams-monitoringowned files (1 file):ddtrace/internal/datastreams/processor.pyStacks on: #17149
Sister PRs (same migration, different owners):
apm-sdk-capabilities-python: chore(lint): migrate os.environ to env in sdk-capabilities modules #16724apm-core-python: chore(lint): migrate os.environ to env in core modules #16725ci-app-libraries: chore(lint): migrate os.environ to env in CI visibility modules #16726apm-idm-python(contrib): chore(lint): migrate os.environ to env in contrib integrations #16727asm-python: chore(lint): migrate os.environ to env in appsec modules #17218ml-observability: chore(lint): migrate os.environ to env in MLObs integrations #17219profiling-python: chore(lint): migrate os.environ to env in profiling modules #17220Testing
ruff check --no-cache .)sg test)Risks
None — mechanical replacement of
os.environ→envandos.getenv(k)→env.get(k). No logic changes.Additional Notes
The
envobject is aMutableMappingwrappingos.environ, so it is a drop-in replacement. See #17149 for design details.