Skip to content

Conversation

@vpellan
Copy link
Contributor

@vpellan vpellan commented May 6, 2025

What does this PR do?

This PR separates set_value_from_env_or_default in two methods, set_default_value and set_env_value. It also always calls both of them, which means that the default value will always be set, then the env value if it exists, in which case the default value will be saved in the @value_per_precedence hash, and restored if unset is called on the env value. This also fixes a bug that made it impossible to unset an env value (as it would set it back due to no fallback, reset setting @is_set to false, and get setting it back to the env variable as @is_set is false.

Motivation:

In #4592 , I need to add two similar methods for customer defined config file, and fleet automation config file, with customer config being set after default but before env.

Change log entry

None.

Additional Notes:

How to test the change?

CI.

@vpellan vpellan requested a review from a team as a code owner May 6, 2025 15:01
@github-actions github-actions bot added the core Involves Datadog core libraries label May 6, 2025
@vpellan vpellan marked this pull request as draft May 6, 2025 15:24
@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented May 6, 2025

Datadog Report

Branch report: vpellan/separate-option-setter-from-env-and-default
Commit report: d5625f7
Test service: dd-trace-rb

✅ 0 Failed, 21229 Passed, 1376 Skipped, 3m 34.73s Total Time

@github-actions github-actions bot added the appsec Application Security monitoring product label May 6, 2025
@pr-commenter
Copy link

pr-commenter bot commented May 6, 2025

Benchmarks

Benchmark execution time: 2025-05-09 08:41:44

Comparing candidate commit d5625f7 in PR branch vpellan/separate-option-setter-from-env-and-default with baseline commit 57b5fcd in branch master.

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

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.76%. Comparing base (57b5fcd) to head (d5625f7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4627   +/-   ##
=======================================
  Coverage   97.76%   97.76%           
=======================================
  Files        1412     1412           
  Lines       86250    86259    +9     
  Branches     4347     4351    +4     
=======================================
+ Hits        84322    84332   +10     
+ Misses       1928     1927    -1     

☔ 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.

@vpellan vpellan marked this pull request as ready for review May 7, 2025 08:44
@vpellan vpellan requested a review from a team as a code owner May 7, 2025 08:44
@vpellan vpellan merged commit 9c51235 into master May 9, 2025
442 checks passed
@vpellan vpellan deleted the vpellan/separate-option-setter-from-env-and-default branch May 9, 2025 09:35
@github-actions github-actions bot added this to the 2.16.0 milestone May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appsec Application Security monitoring product core Involves Datadog core libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants