Skip to content

[NO-TICKET] Decouple environment variable from programmatic config precedence#4610

Merged
vpellan merged 7 commits into
masterfrom
vpellan/decouple-env-and-programmatic-config-precedence
Apr 29, 2025
Merged

[NO-TICKET] Decouple environment variable from programmatic config precedence#4610
vpellan merged 7 commits into
masterfrom
vpellan/decouple-env-and-programmatic-config-precedence

Conversation

@vpellan

@vpellan vpellan commented Apr 28, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR decouples environment variables and programmatic configuration precedence value by adding an environment precedence value.

Motivation:

in #4592, I need to add a new precedence value higher than environment but lower than programmatic.

Change log entry

Yes. Change behaviour of programmatic configurations previously overwriting environment variables. Unsetting a programmatic configuration will now restore the environment variable value.

Additional Notes:

I'm not sure if this is considered a breaking change, it seems like this was a bug in the first place (booting an app with an env var, a programmatic config and unsetting that programmatic config previously dismissed the env var too)

How to test the change?

CI.

@vpellan
vpellan requested a review from a team as a code owner April 28, 2025 12:01
@github-actions github-actions Bot added the core Involves Datadog core libraries label Apr 28, 2025
@codecov-commenter

codecov-commenter commented Apr 28, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.72%. Comparing base (1cac121) to head (098b100).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4610   +/-   ##
=======================================
  Coverage   97.72%   97.72%           
=======================================
  Files        1412     1412           
  Lines       86260    86273   +13     
  Branches     4357     4348    -9     
=======================================
+ Hits        84300    84313   +13     
  Misses       1960     1960           

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

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Apr 28, 2025

Copy link
Copy Markdown
Contributor

Datadog Report

Branch report: vpellan/decouple-env-and-programmatic-config-precedence
Commit report: 098b100
Test service: dd-trace-rb

✅ 0 Failed, 20821 Passed, 1376 Skipped, 3m 37.78s Total Time

@Strech Strech left a comment

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.

I think it's a great change, but I do think that testing gone a bit over the edge.

Comment thread spec/datadog/core/configuration/option_spec.rb Outdated
Comment thread sig/datadog/core/configuration/options.rbs Outdated
@pr-commenter

pr-commenter Bot commented Apr 28, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-04-29 13:04:12

Comparing candidate commit 098b100 in PR branch vpellan/decouple-env-and-programmatic-config-precedence with baseline commit 1cac121 in branch master.

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

@Strech Strech left a comment

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.

I have a few suggestions for tests

Comment thread spec/datadog/core/configuration/option_spec.rb Outdated
@vpellan
vpellan merged commit bc5c2d6 into master Apr 29, 2025
@vpellan
vpellan deleted the vpellan/decouple-env-and-programmatic-config-precedence branch April 29, 2025 13:14
@github-actions github-actions Bot added this to the 2.16.0 milestone Apr 29, 2025
p-datadog pushed a commit to p-datadog/dd-trace-rb that referenced this pull request Apr 30, 2025
* master: (25 commits)
  Continue on error
  Comment on Gemfile
  Run CI
  Avoid example redefinition warning in test suite (DataDog#4612)
  [NO-TICKET] Decouple environment variable from programmatic config precedence (DataDog#4610)
  Update rack/rails/sinatra to use security events
  Rewrite Event.record logic for non-attack events
  Warn when ignoring on_error argument due to it not being a proc (DataDog#4611)
  Bump the gh-actions-packages group across 3 directories with 6 updates
  Update Event to use SecurityEvent class
  Replace events with new SecurityEvent class
  Add new class SecurityEvent
  Rename AppSec API security method
  Rewrite Event#record public interface
  Add attack headers test to the rails contib
  Remove unused keys from the events
  Add new test scenarios for security event
  Change visibility of Event internal methods
  Rewrite Event#record specs
  Return complete rule files into assets
  ...
@Strech Strech mentioned this pull request May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants