Allow configuring observation registry directly#3643
Allow configuring observation registry directly#3643artembilan merged 1 commit intospring-projects:mainfrom cfredri4:allow-configuring-observation-registry-directly
Conversation
|
@ cfredri4 I think this needs more discussion. These changes modify the behavior of setting the default |
This was for simplicity's sake as the registry is nullable and null and NOOP are treated the same. But I can change back to NOOP if desired.
I have two situations where this change would be beneficial:
Both of these situations would be trivial had it been possible to configure the observation registry directly. |
|
@cfredri4 We are ok with the changes. However, could you re-work your solution so we don't break any existing behavior? Specifically, the default |
|
Also, please add the author tag with your name in all the classes you changed. Thanks! |
artembilan
left a comment
There was a problem hiding this comment.
Please, consider to address reviews by tomorrow.
We have release on Monday, so might be great to have this in.
Thank you!
spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java
Outdated
Show resolved
Hide resolved
spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java
Show resolved
Hide resolved
...ng-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java
Show resolved
Hide resolved
|
I have pushed some updates, please check. |
artembilan
left a comment
There was a problem hiding this comment.
Well, sorry for the noise, but apparently there are some Checkstyle violations:
Error: eckstyle] [ERROR] /home/runner/work/spring-kafka/spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java:496: Line matches the illegal pattern 'Trailing whitespace'. [Regexp]
Error: eckstyle] [ERROR] /home/runner/work/spring-kafka/spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/listener/ContainerProperties.java:45:1: Wrong order for 'io.micrometer.observation.ObservationRegistry' import. [ImportOrder]
> Task :spring-kafka:checkstyleMain
Error: eckstyle] [ERROR] /home/runner/work/spring-kafka/spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java:81:8: Unused import - org.springframework.beans.factory.ObjectProvider. [UnusedImports]
Please, consider to use Gradle check task before pushing commits to the PR.
Thanks
This changes allows configuring the observation registry directly, instead of it being fetched from the application context. This is to allow observability when KafkaTemplate/KafkaMessageListenerContainer are used without an application context.
|
Fixed. |
This changes allows configuring the observation registry directly, instead of it being fetched from the application context. This is to allow observability when KafkaTemplate/KafkaMessageListenerContainer are used without an application context.