Skip to content

refactor(config): use getEnv instead of getEnvironmentVariables#7147

Merged
BridgeAR merged 3 commits intomasterfrom
watson/config-cleanup
Dec 19, 2025
Merged

refactor(config): use getEnv instead of getEnvironmentVariables#7147
BridgeAR merged 3 commits intomasterfrom
watson/config-cleanup

Conversation

@watson
Copy link
Copy Markdown
Collaborator

@watson watson commented Dec 19, 2025

What Does This Do?

This PR refactors the Config class to standardize environment variable access by replacing getEnvironmentVariables() with getEnv() for consistency throughout the codebase.

Motivation

Using a consistent method for environment variable access improves code maintainability and readability.

@watson watson requested a review from a team as a code owner December 19, 2025 11:27
@watson watson requested review from BridgeAR and removed request for a team December 19, 2025 11:27
@watson watson self-assigned this Dec 19, 2025
Copy link
Copy Markdown
Collaborator Author

watson commented Dec 19, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@datadog-datadog-prod-us1

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 19, 2025

Overall package size

Self size: 4.36 MB
Deduped: 5.19 MB
No deduping: 5.19 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.0 | 68.46 kB | 797.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.77%. Comparing base (244b082) to head (d7d4f25).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7147      +/-   ##
==========================================
- Coverage   84.78%   84.77%   -0.02%     
==========================================
  Files         521      521              
  Lines       22155    22224      +69     
==========================================
+ Hits        18785    18840      +55     
- Misses       3370     3384      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Dec 19, 2025

Benchmarks

Benchmark execution time: 2025-12-19 21:07:50

Comparing candidate commit d7d4f25 in PR branch watson/config-cleanup with baseline commit 244b082 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 289 metrics, 31 unstable metrics.

Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looking good, while the self part should be reverted in my opinion.

Comment thread packages/dd-trace/src/config.js Outdated
Comment thread packages/dd-trace/src/config.js Outdated
Comment thread packages/dd-trace/src/config.js Outdated
Comment on lines +1512 to +1513
const DD_GIT_FOLDER_PATH = getEnv('DD_GIT_FOLDER_PATH')
const gitFolderPath = DD_GIT_FOLDER_PATH ?? path.join(process.cwd(), '.git')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@watson watson force-pushed the watson/config-cleanup branch from 72ef59e to b21af32 Compare December 19, 2025 20:52
@watson watson changed the title refactor(config): improve type safety and simplify environment variable access refactor(config): use getEnv instead of getEnvironmentVariables Dec 19, 2025
Cast Config instance to Record<string, any> where dynamic properties
from config_defaults are accessed. Resolves TypeScript errors without
runtime overhead.
This reverts commit e8cf0e30e03bc068d50a64fd76a62d1ff8c53182.
@watson watson force-pushed the watson/config-cleanup branch from b21af32 to d7d4f25 Compare December 19, 2025 21:00
@watson watson requested a review from BridgeAR December 19, 2025 21:01
@BridgeAR BridgeAR merged commit 7f5a9d3 into master Dec 19, 2025
793 checks passed
@BridgeAR BridgeAR deleted the watson/config-cleanup branch December 19, 2025 21:53
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants