On 04/12/2020 21:54, Victor Augusto Farias Dinis wrote:
Hi there!

I am trying to build a few set of metrics for the health information of my Spring Boot Application (it has the Actuator framework as the metrics aggregator). At first, I have tried to implement a gauge metric, intercepting the result of all health checks that my app does. When I saw the result, the metrics appeared to be static, even though I was setting it to 1 and -1, depending on the UP and DOWN information. Because of that, I tried to implement a summary metric, but when I tried to put those info into a Grafana Dashboard, it was getting really difficult to achieve what I was intending to.

That said, I have two questions:
1. Am I trying to do something wrong, considering a gauge metric like a "boolean" metric? Because is exactly that that I wish to achieve in the end.
2. What am I doing wrong, so that the metric kept its first value set?

Here is the snippet of the code:

*/meterRegistry.gauge("health_state", tagsHealth, healthResponse.getStatus().equals(Status.UP) ? 1 : -1)/*
*/
/*
I tried to use other constructors, but the result was the same. With the Gauge API, I was getting another error.

Has anyone received the same error or a similar one?

*Important info:*
*Java Version:* 12
*Spring Boot Version:* 2.3.4.RELEASE

Using a gauge to express a boolean or other fixed options is quite normal.

In fact Prometheus does it itself with the "up" metric. However it is normal to use 1 and 0 for the true/false values (which also makes some queries simpler).

--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/80fb60e9-f860-92f8-d3d2-596593144a92%40Jahingo.com.

Reply via email to