1. Home
  2. /
  3. Blog List
  4. /
  5. Cloud Native Platform
  6. /
  7. Microservices and Exposure of Custom KPIs in Cloud Native Environment

Microservices and Exposure of Custom KPIs in Cloud Native Environment

Posted By :
Microservices and Exposure of Custom KPIs in Cloud Native Environment

Introduction

In a cloud-native environment, it is very essential to publish custom metrics of your application for monitoring and to ensure better application health. The user should have data and proper channels available to measure application health. We can publish and monitor a large number of metrics in a simple way.

This requires 3 components in this monitoring system setup:

  • Application exposing custom KPI
  • Prometheus for metrics scraping
  • Grafana for visualization
Microservices and Exposure of Custom KPIs

Nothing special needs to be done to record custom KPIs to Prometheus. We are using a Gradle based Spring Boot application to demonstrate the same.

Prerequisite: 

Basic understanding of Prometheus and Grafana configuration.

Custom KPIs Configuration

For a spring boot application to expose custom KPIs follow the steps below.

  1. Add the following dependencies in the Gradle file.
  • Spring boot actuator
  • Micrometer registry
Custom KPIs Configuration

2. Do the below configuration in the “application.properties” file to enable metrics on the “/actuator/prometheus” endpoint

Custom KPIs Configuration

3. Once the configuration is done, you can add different custom KPI’s to find ‘request execution time’, ‘the total number of requests received’ , ‘find time-consuming API’s, etc.

In the below example, we have added a custom KPIs using Micrometer Library to

  • Record the time taken by creating a User API
  • Record the total number of requests received by the application.
custom KPIs using Micrometer Library
  • The Distribution Summary object records the time taken by the API in the defined bucket, i.e. a request which completes execution in 50ms or between 50ms to 100ms.
  • We can also customize the metrics data as per requirement like recording average execution time etc. “user.create.time” is the query name which in Prometheus will be available by metrics name “user_create_time”. You can also verify metrics on IP:PORT/application_context_path/actuator/metrics/
  • For a more detailed understanding please refer to this link Micrometer documentation

❖ Prometheus metrics scrapping configuration

To scrap metrics from your application add the below configuration in Prometheus configmap.

Prometheus metrics scrapping configuration

To scrap metrics from your application add the below configuration in Prometheus configmap.

Prometheus metrics scrapping configuration

❖ Visualizing in Grafana

Once all the metrics data is available in Prometheus, You can add different dashboards in Grafana for better visualizations and monitoring.  Grafana also supports configuration to set notification alerts based on the published metrics.

Visualizing in Grafana
Sample Graphs with different metrics
Visualizing in Grafana
Average execution time – Create User API
Visualizing in Grafana
Maximum Execution Time – Create User API

The dashboard provides useful information like max and average execution time taken for creating a user, time taken for database operation. With careful monitoring of these dashboards, we can find whether our application is working as per the expectations or not. And if not then we can identify the APIs which are taking more time.

Conclusion:

Micrometer makes it easy to instrument an application and collect a good set of basic metrics which can be stored and visualized using Prometheus and Grafana. You can create metrics according to your needs as this library provides much more than this.

Leave a Reply

Your email address will not be published.

Our Latest Blogs


Managed Service

Driving Value with Managed Services

Technology is evolving at a consistent and rapid pace. Technology specialists are incorporating cutting-edge practices to boost the efficiency of...
Read More
Digital Network

Bridging the Digital Divide in the UK

The Digital Divide in the UK The "digital divide" is a growing concern in the UK, where access to technology...
Read More
Optical Fiber

Debunking the Common Myths about Optical Fibre

As data-intensive applications like video streaming, online gaming, and cloud computing become more common, the need for increased bandwidth has...
Read More
Fiber Optic Testing Tools

How Robotic Tools are Revolutionizing the Detection of Optical Fiber Failures

The fiber optic communication industry has revolutionized the entire Telecommunication industry by providing higher performance, more reliable telecommunication links with...
Read More
Fiber Optic Technology

Recent Advances in Optical Networking Technology: A Look at the Future of Data Transmission

Since several decades ago, optical networking technology has been developing quickly. Fiber optics is becoming a key component of the...
Read More
Optical Interconnect Technology

Optical Interconnect Vs. Electrical Interconnect: All You Need to Know

Interconnectedness is increasingly becoming the backbone of a modern, progressive world. It is what is driving the escalation of digital...
Read More
Network Running

Keep The Network Running in The Remotest Locations: Here’s How STL Can Help

The pandemic has unravelled the importance of reliable connectivity. From smart classes to online groceries, the internet is everywhere. Yet,...
Read More
Managed Service

5 Benefits of Using a Managed Security Services Provider

Investing in cybersecurity is the need of the hour as the cyber threat landscape evolves. But as cyber threats continue...
Read More
Optical Interconnect Technology

An Overview of Optical Interconnects: How They Work and Their Advantages

Optical interconnects are a crucial component of modern electronic systems. They are used to transmit data and power between different...
Read More
Network System Integration

Network System Integration: A Guide to Choosing the Right Optical Fiber Manufacturing Company

One of the crucial factors of a network system integration project is choosing an appropriate fiber cable; they determine the...
Read More
Optical Fiber

10 Ways Optical Fibre Has Changed the World

Optical fiber has revolutionized the way we communicate and access information. From high-speed internet to advanced medical procedures, the benefits...
Read More
Data Center Design

Designing Data Centre Networks: Strategies for Maximum Efficiency and Performance

Data centre design and the data network that supports it are critical components of any organization's IT infrastructure. The way...
Read More
Network Modernization

Accelerating Your Network Modernization Process

Network modernization is crucial for businesses to stay competitive in today's digital economy. However, the process can be time-consuming and...
Read More
Network services

Understanding Network Services and How They Enhance Your Business

A robust network is a must for any type of company in the twenty-first century because most products are digital...
Read More
Data centre

The Rise of Data Centers in India

With data consumption on the rise, cloud adoption accelerating, and technology demand soaring higher than ever before - Indian corporations...
Read More
RAN Services

Building a Faster, More Connected Healthcare Network with Radio Networks

In recent years, the category of linked medical devices has expanded to encompass Internet of Things (IoT) gadgets and a...
Read More
Network services

The Role of Network Integration in Telecom Companies

Network services integration and management are a significant deal. The richness of new telecom technology, whether on-premise or cloud-based, makes...
Read More
Optical Fiber

10 Tips for Simplifying the Installation of Optical Fiber Cables

Installing optical fiber cables can be a complex and time-consuming task. It is crucial to have a well-planned and executed...
Read More
Data Localization

How Would Data Localization Benefit India?

In this age of data ubiquity, localization policies' emergence and wide adoption is a story to be told. India finds...
Read More
Email Security

Complete Guide to Managed Email Security Services

Our email inbox is the gateway to our organization and needs special protection. In recent times, email attacks have become...
Read More

Our Services


Network services

The digital ecosystem and landscape is rapidly to mirror the continuous evolution of communication infrastructure, connectivity, and next gen use cases...
Read More

Fiber Roll out Services

We offer a dependable fiber-based backhaul solution that promises seamless high-speed connectivity and increased reliability for a better network experience...
Read More

Managed Services

We encourage customers to seize business opportunities by simplifying network management and maintenance, which standardized SLAs govern...
Read More

Data Centre Network

Future use cases will require cloud-native infrastructure. With our network transformation services, we out-innovate the current constraints in the data center space...
Read More

RAN Services

The approach of RAN network disaggregation comes at the expense of increased integration touch-points and engineering efforts...
Read More