You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "Shivd131 (via GitHub)" <gi...@apache.org> on 2026/01/19 13:10:05 UTC
[PR] [FINERACT-2438] Add Micrometer Observability to Reporting API [fineract]
Shivd131 opened a new pull request, #5348:
URL: https://github.com/apache/fineract/pull/5348
## Description
This PR instruments the RunreportsApiResource with Micrometer to resolve visibility gaps in report generation performance.
The standard Spring Boot metrics (`http.server.requests`) aggregate all reporting traffic under the `/runreports/{reportName}` endpoint. This makes it impossible to distinguish between a fast "Client Listing" HTML view and a resource-intensive "General Ledger" PDF export without parsing verbose text logs.
1. New Metric: Exposes fineract.report.execution to track report latency and throughput.
2. Granular Tagging: Metrics are tagged by reportName, format (PDF, XLS, HTML), type, and status.
3. Configuration: Enables Actuator metrics in application.properties.
Standard HTTP metrics aggregate all reporting traffic, making it impossible to identify specific slow reports (e.g., identifying that "General Ledger PDF" is the bottleneck vs "Client Listing"). This data establishes the performance baseline required for future efforts to offload reporting to asynchronous microservices.
## Verification:
Validated locally via curl requests. The /actuator/metrics/fineract.report.execution endpoint now returns precise timing data tagged by report context.
## Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
- [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
- [x] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
- [ ] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made.
- [x] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
- [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
- [x] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute).
Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide).
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FINERACT-2438] Add Micrometer Observability to Reporting API [fineract]
Posted by "IOhacker (via GitHub)" <gi...@apache.org>.
IOhacker commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2705656900
##########
fineract-provider/src/main/resources/application.properties:
##########
@@ -339,8 +339,8 @@ management.endpoints.web.cors.allowed-headers=*
# FINERACT-883
management.info.git.mode=FULL
-management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,prometheus}
-
+management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,metrics,prometheus}
+management.endpoint.metrics.enabled=true
Review Comment:
Please add it as a variable FINERACT_MANAGEMENT_ENDPOINT_METRICS_ENABLED and default value set to false, if the variable is set to true then it will be activated.
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "Shivd131 (via GitHub)" <gi...@apache.org>.
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 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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2727507067
##########
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:
Are you sure we need this configuration?
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FINERACT-2438] Add Micrometer Observability to Reporting API [fineract]
Posted by "Shivd131 (via GitHub)" <gi...@apache.org>.
Shivd131 commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2705747094
##########
fineract-provider/src/main/resources/application.properties:
##########
@@ -339,8 +339,8 @@ management.endpoints.web.cors.allowed-headers=*
# FINERACT-883
management.info.git.mode=FULL
-management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,prometheus}
-
+management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,metrics,prometheus}
+management.endpoint.metrics.enabled=true
Review Comment:
@IOhacker thank you for pointing it out, I have updated it.
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "Shivd131 (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FINERACT-2438] Add Micrometer Observability to Reporting API [fineract]
Posted by "IOhacker (via GitHub)" <gi...@apache.org>.
IOhacker commented on PR #5348:
URL: https://github.com/apache/fineract/pull/5348#issuecomment-3772888916
Squash and commit your changes please
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2720840514
##########
fineract-provider/src/main/resources/application.properties:
##########
@@ -340,8 +339,8 @@ management.endpoints.web.cors.allowed-headers=*
# FINERACT-883
management.info.git.mode=FULL
-management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,prometheus}
-
+management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,metrics,prometheus}
Review Comment:
Please dont change this configuration. Metrics are not exposed by default for a reason!
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "Shivd131 (via GitHub)" <gi...@apache.org>.
Shivd131 commented on PR #5348:
URL: https://github.com/apache/fineract/pull/5348#issuecomment-3795970361
@adamsaghy Thanks for the detailed review.
I have refactored the PR to align with your feedback:
- Reverted application.properties
- Switched to @Timed: Removed the manual Timer boilerplate from the resource file. I added a small MetricsConfig class to enable the TimedAspect bean so the annotation works correctly with Jersey.
- Context on the original approach: The reason I initially used manual instrumentation was to capture dynamic tags like reportName and outputType. For my future projects, determining exactly which specific reports are resource-intensive is crucial for deciding what to offload to a microservice.
The current @Timed implementation aggregates all reports into one metric, which hides that granularity, but I agree this is the cleaner, standard starting point for the codebase.
I am open to any suggestions/corrections if required
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "Shivd131 (via GitHub)" <gi...@apache.org>.
Shivd131 commented on PR #5348:
URL: https://github.com/apache/fineract/pull/5348#issuecomment-3796064803
@IOhacker I think I made a mistake while copying the license header at the top of the code file earlier, which I suspect made the code fail the check. I’ve corrected it now, and the build check should pass.
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "Shivd131 (via GitHub)" <gi...@apache.org>.
Shivd131 commented on PR #5348:
URL: https://github.com/apache/fineract/pull/5348#issuecomment-3773627503
@IOhacker I have squashed the changes into a single commit.
Thank you
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #5348:
URL: https://github.com/apache/fineract/pull/5348
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2720850099
##########
fineract-provider/src/main/resources/application.properties:
##########
@@ -340,8 +339,8 @@ management.endpoints.web.cors.allowed-headers=*
# FINERACT-883
management.info.git.mode=FULL
-management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,prometheus}
-
+management.endpoints.web.exposure.include=${FINERACT_MANAGEMENT_ENDPOINT_WEB_EXPOSURE_INCLUDE:health,info,metrics,prometheus}
+management.endpoint.metrics.enabled=${FINERACT_MANAGEMENT_ENDPOINT_METRICS_ENABLED:false}
Review Comment:
I dont think it is valid endpoint anymore, it was changed to be `management.endpoints.web.exposure.include=metrics` no?
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2438: Add Micrometer Observability to Reporting API [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5348:
URL: https://github.com/apache/fineract/pull/5348#discussion_r2720839022
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java:
##########
Review Comment:
I dont like the idea of injecting and doing manually the metric collection.
Please use "Spring (Boot 3 / Micrometer Observation): @Observed" or "Classic Micrometer annotations: @Timed" instead.
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org