Applying a rate function to positive and negative changes

I’ve set up a new graph in Grafana showing the change of a metric using the rate() function.
However, it seems to work in inverse (showing a positive value when the gauge drops) and does not show any change when the gauge increases. I’ve plotted the original gauge (yellow, right axis) along with the rate function (green, left axis) to demonstrate this behavior:

The following Prometheus queries were used to create them:
Rate of change - min(rate(metric_name{cluster="$cluster", cluster_type=~“master|all”}[1m])) by (cluster)
Original gauge - min(metric_name{cluster="$cluster", cluster_type=~“master|all”}) by (cluster)

What am I missing here?

Thanks for your input :slight_smile:

1 Like

rate() must be applied only to counters. For gauges the deriv() function must be used instead of rate().