Exposing Metrics
Let’s learn how to expose our application’s metrics.
We'll cover the following...
We'll cover the following...
Collecting metrics is a totally different task from exposing them for Prometheus to collect them. This lesson shows how to make the metrics available for collection.
Coding example
The code of samplePro.go is as follows:
We need to use two external packages for communicating with Prometheus.
This is how we define a new counter variable and specify the desired options. The Namespace field is very important because it allows us to group metrics in sets.
This is how we define a new gauge ...