Conversation
🤖 GitHub commentsJust comment with:
|
|
This pull request does not have a backport label. Could you fix it @andsel? 🙏
|
|
run exhaustive tests |
| subject.set(5) | ||
| expect(subject.value).to eq(LogStash::Util::TimeValue.new(5, :nanosecond)) | ||
| expect(subject.value.to_nanos).to eq(5) | ||
|
|
There was a problem hiding this comment.
Note for reviewer
The verification of deprecation logger switched implementation. However, this case is covered by the JUnit test case
There was a problem hiding this comment.
Pull request overview
This PR moves the TimeValue-typed setting implementation from Ruby into a Java TimeValueSetting, updates Logstash core and x-pack to use it, and adds/updates tests to validate behavior across Java and Ruby.
Changes:
- Introduces
org.logstash.settings.TimeValueSetting(Java) with coercion and deprecation logging behavior. - Updates core and x-pack settings registration to use
LogStash::Setting::TimeValueSetting. - Adds a Java unit test for
TimeValueSettingand adapts the existing Ruby spec to target the new class.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| x-pack/spec/config_management/extension_spec.rb | Updates spec expectations to reference TimeValueSetting. |
| x-pack/lib/monitoring/monitoring.rb | Switches monitoring time-based settings to TimeValueSetting. |
| x-pack/lib/geoip_database_management/extension.rb | Switches GeoIP poll interval setting to TimeValueSetting. |
| x-pack/lib/config_management/extension.rb | Switches x-pack management poll interval setting to TimeValueSetting. |
| logstash-core/src/test/java/org/logstash/settings/TimeValueSettingTest.java | Adds Java unit tests for default coercion, invalid values, and deprecation logging. |
| logstash-core/src/main/java/org/logstash/settings/TimeValueSetting.java | Adds the new Java implementation of the time-value setting coercion. |
| logstash-core/spec/logstash/settings/time_value_spec.rb | Updates Ruby spec to target TimeValueSetting and removes deprecation logging assertion. |
| logstash-core/lib/logstash/settings.rb | Removes Ruby TimeValue class and imports the Java TimeValueSetting. |
| logstash-core/lib/logstash/environment.rb | Updates built-in settings to use TimeValueSetting for time-based values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
logstash-core/src/main/java/org/logstash/settings/TimeValueSetting.java
Outdated
Show resolved
Hide resolved
logstash-core/src/main/java/org/logstash/settings/TimeValueSetting.java
Outdated
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @andsel |
Release notes
[rn:skip]
What does this PR do?
Moves the Ruby setting class TimeValue setting to Java. It covers the test in unit test while keeping and adapting the original time_value_spec.rb test suite to prove it still works on Ruby code.
Why is it important/What is the impact to the user?
N/A
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files (and/or docker env variables)Author's Checklist
How to test this PR locally
Change a setting that leverage this implementation and check it works as expected.
create Logstash
pipeline.conffile:Update the reload interval setting in
config/logstash.ymlas:run Logstash
Update the pipeline.conf file, adding a comment for example, and verify in the logs the interval in pipeline reload is greater than 30 seconds.
Related issues
Logs