Collecting and visualizing metrics with Ballerina
Collecting metrics is a critical aspect of monitoring an application. It helps system engineers to identify the system status and how those applications have performed. In this section, we will learn how to expose Ballerina metrics to Prometheus and visualize those metrics with the Grafana dashboard. We will also discuss building our own custom metrics to observe important metrics on the system.
Exposing metrics from Ballerina
Ballerina has built-in support for exposing metrics. If you are creating a service, Ballerina exposes some useful metrics to the observability tools that can be used to analyze the performance and the load. For example, we can create the following simple HTTP service using Ballerina that returns a value back to the caller
endpoint:
import ballerina/http; import ballerinax/prometheus as _; service /Customer on new http:Listener(9092) { resource function get getCustomerName(http...