We have a system with a Prometheus exporter. It exposes a counter metric. However, the exporter sometimes misbehaves and breaks monotonicity like this:
- T1: X
- T2: X + 1
- T3: X
Example:
As a result, when applying rate() or increase() on the counter, we get huge spikes, because Prometheus understands that the counter was reset to 0, and then increased again. So we get increases series like:
- T1: 0
- T2: 1
- T3: X
X can be in the thousands, so this completely messes with the aggregated metrics.
Example of increase(metric[3d]):
Do you have any idea of how could we work around this wrong values with native PromQL? For simplicity, let's assume that the errors are always in the form of X/X+1/X.
I've thought of using delta() as if this metric were a gauge, but we can't do that, because in some scenarios it actually resets to 0 as counters normally do, and delta() won't understand it.
Fixing the exporter is out of scope.

