Monitoring your APIs in Anypoint Platform                                                                      

January 06, 2023

Blogger Image

Prakash K M

Senior Software Engineer

Modern applications use independent microservice APIs on a large scale instead of a few large applications. Poor performance of any of these APIs can adversely affect the overall performance of the business application. In addition, isolating a single poor-performing API among hundreds can be a challenge unless proper monitoring is in place. This makes API monitoring and measuring API performance a crucial practice for modern multi-cloud environments. API monitoring is the process of collecting and analyzing data about the performance of an API to identify problems that impact business users proactively.

MuleSoft has released the Anypoint Monitoring platform as part of their cloud offering. Anypoint Platform Monitoring provides insights and visibility into the application network using monitoring capabilities. The main objective of Anypoint Monitoring is to reduce the time taken for error/issue diagnosis in determining a better approach. Anypoint Monitoring tools include dashboards, alerts, data visualization, functional monitoring, aggregated metrics, log aggregation system, among others.

Let’s see how we can configure Anypoint Platform Monitoring for the MuleSoft APIs in CloudHub.

Enabling Anypoint Platform Monitoring for MuleSoft Apps

To configure the default monitoring configuration in Anypoint Platform Monitoring, perform the below steps. This configuration will be applied automatically for all the new applications deployed on the Anypoint platform.

  • Log in to the Anypoint Platform. In the navigation bar or the main Anypoint Platform screen, click Monitoring.
  • In the Anypoint Monitoring navigation menu, click Settings:
    • Select CloudHub and click Enable Anypoint Monitoring for newly deployed CloudHub applications.

This configuration will be applied only for the new applications that will be deployed to CloudHub and will not apply to apps that have been previously deployed and must be configured individually.

Dashboards

Dashboards in MuleSoft Anypoint Monitoring provide multiple views and metrics of the Mule apps and APIs that are deployed to different environments (for example PROD and NON-PROD). By default, Anypoint Platform Monitoring comes with a Built-in Dashboard for monitoring apps. Apart from this, it also allows us to create our own dashboards called Custom Dashboards.

Built-In Dashboards

Built-in dashboards contain graphs that plot the current and historical data collected over a given time and date period. There is a built-in dashboard for each Mule application or API in each environment.

The graphs and tables in built-in dashboards support a wide variety of metrics. The Overview Tab provides a first glance at the performance of your application on Mule Messages, Average Response Time, and Errors. To view more application metrics, click the Inbound, Outbound, and Failure tabs.

These dashboards are very helpful in tracking and isolating an issue in a business process with multiple API calls. For example, we can track the response time taken by each endpoint of a MuleSoft API. Using the dashboard, it’s very easy to find the origin and analyze the root cause of the issue.

Overview Tab

The following charts appear on the Overview Tab -

  • Mule Messages: The number of Mule messages triggered from flow invocations in a Mule application.
  • Average Response time: The average time to process Mule messages in a Mule application.
  • Errors: Number of errors from processing Mule messages in a Mule application.
  • Inbound – Total requests by response type: Number of inbound requests, grouped by the type of response (OK or FAILED).
  • Inbound – Average response time: The average response time of inbound requests.
  • Outbound – Average Response Time: The average response time of outbound requests.
  • JVM - CPU % Utilization: The average percentage of CPU utilized by the Mule runtime JVM process. The JVM used in this chart is the Mule JVM process. This metric is available only for organizations that have a Titanium subscription.
  • JVM - Heap Used: The amount of heap memory utilized by the Mule runtime JVM process.
  • JVM - Thread Count: The average number of threads of the JVM, grouped by worker. The JVM used in this chart is the Mule JVM process.
  • Performance Tab: The following charts appear on the Performance Tab -
    • Mule Messages: The number of mule messages triggered from flow invocations in the mule application.
    • Inbound-Response time by HTTP Endpoint: The average, minimum and maximum response time grouped by endpoint.
    • Outbound-Response time by HTTP Endpoint: The average, minimum and maximum response time grouped by endpoint.

Anypoint Monitoring Custom Dashboards

There are mainly four different types of dashboards available to visualize the data.

Graph:

  • Represents a wide range of metrics in terms of time-series data
  • Supports a query language enabling us to specifically check the data we need to see

Singlestat:

  • Statistics are represented as a summary of a single grouping of time-series data like response time, heap usage, etc.

Table:

  • Represents the time-series data in a tabular format, further facilitating cell coloring along with the date and value formatting

Text:

  • Allows textual representation of data (like headers, titles, etc.) within the rows/cells of the dashboard written in Markdown or HTML

Event-Driven Alerts

Event-driven alerts are custom alerts that can be configured at the application level. They are used mainly to alert the team in case an unexpected event occurs in an application. Alert conditions can be set on various metrics, and users can also create an alert based on a notification captured inside the application published using the CloudHub Connector.

Available severity levels

  • Info: Info is assigned to alerts that do not require immediate attention when triggered. This severity indicates the metric should be passively monitored.
  • Warning: Warning is assigned to alerts that require prompt attention when triggered. This severity indicates an alert should be closely monitored.
  • Critical: Critical is assigned to alerts that require immediate attention when triggered. This severity indicates an alert should receive an immediate response.

You can set up alerts to send email notifications when application or server events occur. The Runtime Manager includes several standard alert types that trigger notifications for some of the common events mentioned below:

  • An application exceeds a specific number of events processed within a specified period.
  • A deployment is complete, either successfully or not.
  • The worker monitoring system notifies CloudHub about a problem with a worker on an application.
  • A server is disconnected or deleted.

Alerts can be triggered based on rules (or thresholds) and policies for your resources. When these thresholds are crossed for a certain period, a notification will be sent to the respective person configured in the Alert for the application. The method of notification depends on the severity of the alert that you define.

Conclusion

MuleSoft APIs, integrations, and microservices can be efficiently monitored in real-time at one place using Anypoint Monitoring. The platform also enables issue identification, root cause analysis with custom dashboard and alerts, dependency mapping and instant access to historical log data which considerably reduces the impact on business. Explore Nous’ MuleSoft services and learn how we can help you leverage MuleSoft Anypoint Platform to the fullest.

Join the conversation

What are your thoughts on this blog? Drop us a line below. We’d love to hear from you.

© 2024 Nous Infosystems. All rights reserved.