Overview & Challenge
The client is a leading medical supplies company in the USA, serving over four million people annually. Their operations demand high reliability and responsiveness, with a need for immediate delivery of products upon order.
Challenges
The challenge at hand involved the implementation of a comprehensive solution to effectively track API usage on a per-application basis. The primary obstacle was accurately monitoring the number of calls made to the internal APIs, considering their diverse origins. The objective was to identify the specific application source for each API call to prevent potential overloading of the desired application, whether it was an internal API within the MuleSoft ecosystem or an external call, particularly focusing on the experience APIs aligned with the API-LED connectivity approach.
Furthermore, the challenge encompassed generating precise reports within specific timeframes. The existing solution from Anypoint, involved generating a report to obtain the total API call count or segregating the invocations based on the client application using the Consumer from Anypoint Exchange and proved impractical in our scenario. This was primarily due to the utilization of multiple client applications across diverse environments and for various purposes, which would compromise the accuracy of the generated report.
Objective
The primary objective was to develop a solution for monitoring and accurately tracking API usage, which would enable accurate reporting and prevent the overloading of APIs.
Solution
Analysis & Strategy
The strategy involved using REST APIs provided by the Anypoint Analytics component to create an encapsulated usage report for the desired API. The report would include data on the number of requests made, along with the IP address of the consumer of the API.
Technical Solution
The solution we implemented involves customized functionality within MuleSoft. To generate a report, we simply provide two key details: the name of the application for which we want the report and the desired time span.
By utilizing the REST APIs offered by the Anypoint Analytics component, we generate a comprehensive usage report specific to the desired API. Each request made to the API allows us to extract the IP address of the consumer accessing the API. Concurrently, we gather IP addresses for each of our internally deployed Mule applications. By combining this data, we are able to accurately determine the source of the invocation, whether it originated from an internal application or an external call. Additionally, we can track the frequency of these invocations.
Business Outcomes
The implemented solution has yielded significant benefits for various stakeholders, including developers, DevOps engineers, the QA team, and the project delivery manager. These benefits have improved the monitoring and tracing of transactions in real time, leading to the following outcomes:
Enhanced Visibility: The client now have access to a comprehensive report that provides the precise total number of calls made to a specific API within a defined period. Additionally, the report includes detailed information on the total number of internal calls generated by each application. This increased visibility allows for a better understanding of API usage and provides actionable insights for decision-making.
Streamlined Monitoring: With the availability of a detailed report, the client can easily monitor the usage of each application. This monitoring capability enables proactive management of API usage and facilitates the identification of potential issues or opportunities. By leveraging the analytical information provided in the report, the client can establish plans for ongoing actions and optimize their application ecosystem.
Improved Forecasting: The solution provides a clearer view of API usage patterns, enabling more accurate forecasting of resource needs. By gaining insights into the demand for specific APIs, the client can optimize resource allocation, ensuring efficient utilization and cost reduction. The ability to forecast API usage trends empowers the client to make informed decisions regarding capacity planning and resource scaling.
Overall, the implemented solution has empowered the stakeholders to monitor, analyze, and forecast API usage effectively. This enhanced visibility and proactive approach have resulted in improved resource management, cost optimization, and better decision-making in relation to API utilization.