-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Actuator /configprops shows Duration properties as { "units": [ "SECONDS", "NANOS" ] } #16539
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
Conversation
Wow that was quick! Thanks @dreis2211 ! |
Let me fix the checkstyle issue. Sorry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I don't know Jackson a lot but I wished there was a way to auto-detect standard serializers like this. I've added a question.
@@ -171,6 +176,7 @@ private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata( | |||
*/ | |||
protected void configureObjectMapper(ObjectMapper mapper) { | |||
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); | |||
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that related to the support of Duration
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no - this depends on how you want the durations to be displayed. See https://github.com/FasterXML/jackson-datatype-jsr310/blob/master/src/main/java/com/fasterxml/jackson/datatype/jsr310/ser/DurationSerializer.java#L63
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snicoll I pushed a revised version that registers a module. I've tried this actually before, but it didn't work because I called it before the serializerFactory is overwritten again in applySerializationModifier
. Anyway, this should be easier now. And btw: there would be a way of calling ObjectMapper.findAndRegisterModules
but that might register more than you want and is sort of expensive.
While trying to backport this to I do wonder though if that's what we want to do for the endpoint. Given the endpoint is focused on Flagging for team attention to see what the rest of the team thinks. |
I don't like the idea of the actuator's output format changing depending on what's on the classpath. If we need the The format for a duration in |
Thanks for the feedback and good point on machine readable. Given the side effect of adding the module, I am moving this fix to |
Anything I can do to help here, @snicoll ? |
@dreis2211 if you want to push force an update that adds the jackson module in runtime scope, feel free to do it but I am more than happy to do that as part of the polish later today. |
I would be only available this evening, so feel free to do it. Highly appreciated - as usual :) |
* pr/16539: Polish "Add Duration support in /configprops endpoint" Add Duration support in /configprops endpoint
Thanks again @dreis2211! |
Hi,
this is an attempt to fix #16526 .
Feel free to decline the PR if you had a different solution in mind.
Cheers,
Christoph