wso2 / api-manager

All issues, tasks, improvements and new features of WSO2 API Manager
Apache License 2.0
34 stars 8 forks source link

Add Prometheus monitoring capabilities #1852

Open vozzy opened 1 year ago

vozzy commented 1 year ago

Problem

Dear development team,

I am writing to request the addition of Prometheus monitoring capabilities to the WSO2 API Manager platform. As you may know, Prometheus is the de facto monitoring standard for Kubernetes, and many users already have Prometheus monitoring set up in their environments. By adding Prometheus monitoring capabilities to the API Manager, users will be able to easily integrate their existing monitoring solutions with the platform.

Currently, the ELK based analytics available for metrics in the API Manager is overly complex and requires a lot of hardware. By adding Prometheus monitoring capabilities, users will have a simpler and more efficient monitoring solution that requires less hardware.

In addition to the above points, I would like to suggest some Prometheus metrics that could be useful for monitoring the WSO2 API Manager platform and functional monitoring of deployed APIs. These metrics include:

API Manager Platform Metrics:
    Number of requests per second
    Number of errors per second
    Average response time
    CPU and memory usage
    Number of active connections
    Number of API calls by user
    Number of API calls by application
    Number of API calls by API

Deployed API Metrics:
    Number of requests per second
    Number of errors per second
    Average response time
    CPU and memory usage
    Number of active connections
    Number of successful requests by user
    Number of failed requests by user
    Number of successful requests by application
    Number of failed requests by application

By providing these metrics, users will be able to easily monitor the performance of their APIs and the API Manager platform. This will allow for quick identification and resolution of any issues that may arise, ultimately leading to a better user experience.

Thank you for considering this feature request.

Sincerely, vozzy

Solution

High-Level Solution: Adding Prometheus Monitoring Capabilities to WSO2 API Manager Platform

  1. Integration with Prometheus: Integrate the API Manager platform with Prometheus by creating a Prometheus endpoint within the platform that exposes the necessary metrics.

  2. Define Prometheus Metrics: Define the relevant metrics to be monitored for both the API Manager platform and the deployed APIs.

  3. Collecting Metrics: Collect the defined metrics using a Prometheus client library within the API Manager platform. The client library would periodically collect the defined metrics and expose them through the Prometheus endpoint.

  4. Visualizing Metrics: Visualize the collected metrics using a Prometheus dashboard to allow users to view the metrics in real-time and monitor the performance of the API Manager platform and deployed APIs.

  5. Alerting: Set up alerts based on the collected metrics to notify users in case of any issues that may arise with the API Manager platform or deployed APIs.

  6. Documentation: Provide documentation to guide users on how to set up and use the Prometheus monitoring capabilities within the API Manager platform.

By following the above steps, users will be able to easily integrate their existing Prometheus monitoring solutions with the API Manager platform. This will provide a simpler and more efficient monitoring solution that requires less hardware. Additionally, the defined metrics will allow users to monitor the performance of the API Manager platform and deployed APIs, leading to a better user experience.

Affected Component

APIM

Version

3.2.0

Implementation

No response

Related Issues

No response

Suggested Labels

No response

lkokila commented 1 year ago

There is an existing Prometheus Integration using the JMX exporter [1]. The following article [2] has some details on this.

There are synapse-level JMX MBeans [3] too. Might be worthwhile checking if the roadmap includes a similar integration in the future too.

[1]. https://github.com/prometheus/jmx_exporter [2]. https://lashan.medium.com/wso2-api-manager-3-2-0-monitoring-prometheus-grafana-alerts-75cca6df607e [3]. https://github.com/wso2/wso2-synapse/tree/v2.1.7-wso2v80/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/jmx