{{announcement.body}}
{{announcement.title}}

MuleSoft Anypoint Platform Resource Usage and Metrics

DZone 's Guide to

MuleSoft Anypoint Platform Resource Usage and Metrics

One-click Mule utility to capture Anypoint platform resource usage metrics for your organization or a specific environment.

· Integration Zone ·
Free Resource

Introduction

Anypoint Platform provides a rich set of platform APIs to facilitate deployment automation, log management, infrastructure management, and many more...Today we will take a look at a Mule utility that captures Anypoint resource usage metrics at Organization/Environment level.

metrics

Problem Statement

We are almost into the 5th year of APIfication journey on the MuleSoft Anypoint platform. As part of this journey, we have a team of Mulies engaged across programs to support apps running on different runtime versions in a federated C4E structure. While this has been a great model from a delivery standpoint; however, due to the hands-off approach sometimes resource utilization hasn't been optimal.

What's missing — A ability to extract a comprehensive view of resource usage on our platform at the organization level. As a result, we were unable to put controls to identify resource wastage (like — unnecessary resource-intensive configs left behind after load testing / high availability / static IPs, etc is configs, mostly in lower environments) or capture usage trends to derive accurate future projections.   

Approach

As stated above MuleSoft platform provides set of APIs to extract this information but not on click of a button and in a desired format (CSV, JSON, xml). So we decided to develop a utility to bridge this gap.

Solution

We have developed a utility API to capture MuleSoft Anypoint Platform usage metrics using Studio 7.5 & Mule 4.3 runtime. 

Key Features for this utility API:- 

  • Generate a report at a regular interval based on a scheduled job.
  • Provides an API facade for realtime interaction that supports below resources.

api console

  • Complete resource usage metrics available at a click of a button.
  • Supports JSON, CSV & XML response formats.
  • Supports sending the report as an attachment via email.
  • These reports can be fed to DB / Tableau for visualization to identify usage trends.
  • Supports Anypoint credential-based authentication. It can be extended to support SAML assertion based authentication. Please refer links in the reference section.
  • Provides useful metrics like worker configurations, runtime support end date, static IP usage, binary version, etc per application.
  • Provides metrics at the organization level or for a particular environment like Dev, QA, UAT... (Sandbox), and Prod.
  • It provides vCore and active runtime being used for an environment. 

Utility orchestrates through below platform APIs to extract the information

anypoint platform

Below is a list of platform APIs resources being used.

# Anypoint Platform API Description
1 /accounts/login Generate Authorization Bearer token for Anypoint Platform
2

/accounts/API/me

Retrieve Organization Id
3

/accounts/API/organizations/{orgId}/environments

Retrieve a list of environments within Organization
4

/cloudhub/API/v2/applications

Retrieve application details for a particular environment

Conclusion

This utility provides an easy way to capture resource usage metrics which help Anypoint platform teams at an organization level to efficiently manage resources.

Hopefully, this provides a good insight on Anypoint Resource Usage Metrics API Utility. 

The code can be found here and Sample Response in CSV here. Please review README.md for configuration prerequisites.

Topics:
anypoint platform, cloudhub, integration, mulesoft, tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}