Shivd131 commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2727746066
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/MetricsConfig.java:
##########
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.loanorigination.config;
-import org.apache.fineract.infrastructure.core.condition.PropertiesCondition;
-import org.apache.fineract.infrastructure.core.config.FineractProperties;
+package org.apache.fineract.infrastructure.core.config;
-public class LoanOriginationModuleIsEnabledCondition extends
PropertiesCondition {
+import io.micrometer.core.aop.TimedAspect;
+import io.micrometer.core.instrument.MeterRegistry;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
- @Override
- protected boolean matches(FineractProperties properties) {
- return properties.getModule().getLoanOrigination().isEnabled();
+@Configuration
+@EnableAspectJAutoProxy
+public class MetricsConfig {
+
+ @Bean
+ public TimedAspect timedAspect(MeterRegistry registry) {
+ return new TimedAspect(registry);
}
}
Review Comment:
@adamsaghy I added this explicit configuration because I was getting
unsuccessful build, as the default auto-configuration was not picking it up in
this context. the TimedAspect bean is required to process the @Timed
annotations; without it, the AOP proxy is not created and the annotation is
effectively ignored. (Reading:[This comment from stack
overflow](https://stackoverflow.com/questions/56377196/timed-not-working-despite-registering-timedaspect-explicitly-spring-boot-2-1#:~:text=9,to%2Dlive%3A%2010s),
and [found it on the docs
now](https://docs.micrometer.io/micrometer/reference/concepts/timers.html#:~:text=we%20are%20timing.-,The%20%40Timed%20Annotation,public%20TimedAspect%20timedAspect(MeterRegistry%20registry)%20%7B%0A%20%20%20%20%20%20return%20new%20TimedAspect(registry)%3B%0A%20%20%20%7D%0A%7D,-Copied!))
Is there a preferred existing configuration class where you would like me to
move this bean instead, or suggest me a better way of doing it?
would be happy to learn and commit that way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]