I am collecting ZFS metrics in Prometheus v.2.19 from Linux servers using ZFS Exporter. The data is being collected from all targets and the values are correct, however there is this strange issue: I want to calculate the percentage of the ratio of ARC misses vs. ARC hits, so I use the following formula:
100 * rate(zfs_arc_stats{stat='misses'}[5m]) / rate(zfs_arc_stats{stat='hits'}[5m])
but it produces no data. I can get the values from each of the rate expressions individually, but not from the above formula. If I use the formula with the same labels, ie.:
100 * rate(zfs_arc_stats{stat='hits'}[5m]) / rate(zfs_arc_stats{stat='hits'}[5m])
it gives the correct results of 100, because the ratio of misses to misses or hits to hits is always 1:1. I tried similar formulas with metrics from other sources (ie. PCP, Collectd) and those work fine, ie. I could calculate ratios of same metrics with different labels, so it seems like the problem could be specific to the metrics from ZFS Exporter. This exporter has a very few metrics, but each metric has many different stats identified by the value of the 'stat' label. All the metrics are of gauge type, but I do not think it really matters for the rate
function in PromQL. Anyway like I mentioned before the rates can be computed separately, only the ratio fails. Somebody please suggest how to tackle this issue.
100 * rate(zfs_arc_stats{stat='hits'}[5m]) / ignoring(stat) (rate(zfs_arc_stats{stat='hits'}[5m]) + ignoring(stat) rate(zfs_arc_stats{stat='misses'}[5m]))
– mac13klabelhell
branch. – mac13k