Quick question regarding how to build a visual on a specific condition of a java counter in Grafana please.
Currently, I have a small piece of java code, straightforward.
private String question(MeterRegistry meterRegistry) {
if (someCondition()) {
Counter.builder("theCounter").tags("GOOD", "GOOD").register(meterRegistry).increment();
return "good";
} else {
LOGGER.warn("it is failing, we should increment failure");
Counter.builder("theCounter").tags("FAIL", "FAIL").register(meterRegistry).increment();
return "fail";
}
}
As you can see, it is very simple, just a "if a condition is met, increment the GOOD counter, if not, increment the FAIL counter"
I am interested in building a dashboard for the failures only.
When I query my /prometheus
endpoint I successfully see:
myCounter_total{FAIL="FAIL",} 7.0
myCounter_total{GOOD="GOOD",} 3.0
Hence, I started using this query.
myCounter_total{_ws_="workspace",_ns_="namespace",_source_="source}
Unfortunately, this query is giving me the visual for everything, the GOOD and the FAIL. In my example, I see all 10 counters, while I just want to see the 7 failures.
I tried putting
myCounter_total{FAIL="FAIL",_ws_="workspace",_ns_="namespace",_source_="source}
{{FAIL}}
But no luck. May I ask what did I miss please?