Closed da77a closed 8 months ago
in case not obvious I think this should simply be
if prev.(uint64) > value {
// counter reset to 0, then incremented from 0..value
return value, true
}
Pinging @elastic/integrations (Team:Integrations)
@exekias any thoughts on this?
cc: @MichaelKatsoulis @jsoriano
I think this is a good point, we could review the implementation to better handle these
Happy to do a PR with tests, as noted actual code change is trivial.
Hi! We just realized that we haven't looked into this issue in a while. We're sorry!
We're labeling this issue as Stale
to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1
.
Thank you for your contribution!
I should do that PR...
Hi! We just realized that we haven't looked into this issue in a while. We're sorry!
We're labeling this issue as Stale
to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1
.
Thank you for your contribution!
Promql, when it encounters a new counter value that is less than the previous value, assumes that there was a reset to a value of 0 between when the the previous counter value was sampled and the new sample. Under this assumption the "true rate" is not less than the new sample value. What it definitely is not (unless the new value is 0) is 0.
metricbeat prometheus module should apply the same logic/calculation that promql uses for improved accuracy and consistency with prometheus.
Contrast this definition: https://promlabs.com/blog/2021/01/29/how-exactly-does-promql-calculate-rates#dealing-with-counter-resets with this code: https://github.com/elastic/beats/blob/507d0d878b042c419413a6881dff90229aa6e448/x-pack/metricbeat/module/prometheus/collector/counter.go#L57-L60