Health Monitoring of Mule Applications
All APIs developed using Mule must be built with a health check endpoint. This template will help you maintain a uniform structure across all the APIs and their layers.
Join the DZone community and get the full member experience.Join For Free
Health check of an APIs allows near-real-time information about the state of your containers and APIs/microservices. It is critical to multiple aspects of operating APIs and is especially important when orchestrators perform partial application upgrades in phases. It also helps to determine if a running API instance is unable to handle requests.
The health check API operation performs a variety of internal metrics including:
- the status of the connections to the dependent system(s) used by the API instance.
- the resource utilization of the dependent system(s) (e.g., memory, CPU).
- the performance (e.g., average response time) of the dependent system(s).
- application-specific logic.
An API monitoring tool periodically invokes the endpoint to check the overall status of the API.
- Rules can be added at the monitoring layer to proactively identify potential errors:
- Resource exhaustion (e.g., memory, thread, connections, compute).
- Increasing dependent system response times or response payload sizes.
Health check endpoint developed for each experience, process, and system API. Endpoint prepares the status of an API and also include the status of all the calling APIs and downstream system.
API Definition (RAML)
There are two ways to implement this health check API.
- Add as a dependency in implementation API (System, Process, and Experience API) and build health check response by calling flow reference of health check API.
- Build health check API as Mule project and export as a jar file:
Add jar file in pom.xml file of implementation project as a dependency:XML
Import xml file:
- Prepare health response as health check API and call flow as flow ref.
- Implement health check API and data structure as per the above specification in each API.
Opinions expressed by DZone contributors are their own.