-
Notifications
You must be signed in to change notification settings - Fork 993
DeclarativeConfigPropertiesBridge - Handling time unit in the Duration type properties #14627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
DeclarativeConfigPropertiesBridge - Handling time unit in the Duration type properties #14627
Conversation
the spec says that durations must be integers:
so we'd need to change the spec first. |
The change I made is applicable for properties defined in |
good point for discussion
can you provide more context?
the default logic should work already: default Duration getDuration(String name, Duration defaultValue) {
return defaultIfNull(getDuration(name), defaultValue);
} |
So I'm implementing support for declarative config in the Splunk Java agent. We have a lot of existing code and I need to make sure that it correctly works with declarative config. If possible I'd like to avoid making changes to this existing code.
You are right, however the existing code I mentioned use properties supplier to provide default value of this Duration config property. I blindly ported this code, but actually it was not necessary because all the places that were retrieving this value was indeed using getDuration with default anyway (I did not realize that). |
let's discuss this in the declarative config call later today I've also just created a PoC for our distro - and your feedback is highly welcome 😄 see #14563 |
@robsunday can you add the exception you got with the current code? |
Current implementation of Duration type properties does't support time unit provided as a part of property value.
This PR adds a support of time units, as described in Java doc of ConfigProperties::getDuration
The implementation is mostly based on the implementation from DefaultConfigProperties class.
It supports additionally 'us' and 'ns' time units besides the units mentioned in the Java doc of ConfigProperties::getDuration