I'm displaying Prometheus query on a Grafana table.
That's the query (Counter
metric):
sum(increase(check_fail{app="monitor"}[20m])) by (reason)
The result is a table of failure reason and its count.
The problem is that the table is also showing reasons that happened 0 times in the time frame and I don't want to display them.
AFAIK it's not possible to hide them through Grafana.
I know prometheus has comparison operators but I wasn't able to apply them.
NaN is just a number in Prometheus. Some monitoring systems use NaN as a null or missing value, however in Prometheus NaN is just another floating point value. The way Prometheus represents missing data is to have the data, uhm, missing.
Prometheus uses the tilde character ~ to indicate a query contains a wildcard. Inside the label-query the "dot plus" ( . + ) character combination is used where all characters are accepted.
To filter out unwanted metrics from a target, use the ignore_metrics configuration option. To filter out targets instead of the metrics, use the scrape_enabled_label configuration option.
The offset modifier allows changing the time offset for individual instant and range vectors in a query. For example, the following expression returns the value of http_requests_total 5 minutes in the past relative to the current query evaluation time: http_requests_total offset 5m.
I don't know how you tried to apply the comparison operators, but if I use this very similar query:
sum(increase(up[1d])) by (job)
I get a result of zero for all jobs that have not restarted over the past day and a non-zero result for jobs that have had instances restart.
If I now tack on a != 0
to the end of it, all zero values are filtered out:
sum(increase(up[1d])) by (job) != 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With