Warn when ignoring on_error argument due to it not being a proc#4611
Conversation
958c18e to
dd00409
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4611 +/- ##
==========================================
- Coverage 97.74% 97.73% -0.02%
==========================================
Files 1412 1412
Lines 86256 86260 +4
Branches 4354 4357 +3
==========================================
- Hits 84315 84310 -5
- Misses 1941 1950 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Datadog ReportBranch report: ✅ 0 Failed, 20838 Passed, 1376 Skipped, 3m 31.22s Total Time |
BenchmarksBenchmark execution time: 2025-04-28 18:20:32 Comparing candidate commit 7d9788b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 31 metrics, 2 unstable metrics. |
* 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 ...
|
@p-datadog, @marcotc, with this change it seems that when there's no |
|
#4670 is a direct consequence |
|
@totus We are looking into the generated warnings, thank you very much for pointing them out. The warnings however should only be produced when
Do you mean when you did not provide an |
|
@p-datadog, exactly. When a gem is simply being included without any specific configuration, it produces the warnings. To be more specific, even in our test repo with a configuration like this: # Datadog tracing
require "datadog/auto_instrument" if ENV["DD_ENV"] == "ci"
Datadog.configure do |c|
c.ci.enabled = ENV.fetch("DD_ENV", false) == "ci"
c.tracing.enabled = ENV.fetch("DD_ENV", false) == "ci"
c.service = ENV.fetch("DD_SERVICE", nil)
c.ci.instrument :cucumber
endThe test execution is polluted with log entries: |
What does this PR do?
Adds a warning when customer provides
on_errorargument which is not aProc. Previously the argument was silently ignored.Motivation:
Better diagnostics of unexpected/incorrect usage of the library
Change log entry
Yes: warn when
on_errorargument is not aProc(and would therefore be ignored)Additional Notes:
The existing tests for on_error behavior had incorrect setup and did not actually test the path when on_error argument was not a proc.
How to test the change?
Repaired unit tests in this PR.