Calculation bug in requests per backend
towolf opened this issue · 9 comments
I think that PR #60 introduced a bug, the numbers do not add up:
They cumulate up to the total:
nginx_upstream_requests{backend="10.216.0.11:32154",code="total",redacted} 15110
nginx_upstream_requests{backend="10.216.0.12:32154",code="total",redacted} 30210
nginx_upstream_requests{backend="10.216.0.15:32154",code="total",redacted} 45306
nginx_upstream_requests{backend="10.216.0.16:32154",code="total",redacted} 60400
nginx_upstream_requests{backend="10.216.0.17:32154",code="total",redacted} 75493
nginx_upstream_requests{backend="10.216.0.18:32154",code="total",redacted} 90584
nginx_upstream_requests{backend="10.216.0.19:32154",code="total",redacted} 105674
nginx_upstream_requests{backend="10.216.0.21:32154",code="total",redacted} 120764
nginx_upstream_requests{backend="10.216.0.22:32154",code="total",redacted} 135862
nginx_server_requests{code="total",host="redacted"} 135987
@virtualroot Could you verify this?
I went through the code and to my limited understanding, these are quite simple counters. I'm not sure where the problem lies and whether it is actual problem, but please let me know @towolf do you agree with the following:
- All of the requests (total, 1xx, 2xx etc.) are counters (i.e. they only grow over time).
- Initial counter should equal number provided and observed in vts (i.e. not zero or random number).
- Counter should be updated as per value provided by vts we changed over time.
In my observation, the last point is not "entirely" true. Counters are updated, but they differ from what I can see in vts. I cannot tell whether the problem is with my logic (as in: my expectations are not matching reality) or is it a broken software or maybe broken implementation.
@hnlq715 would you be so kind and find some spare moment to have a quick look onto the aforementioned PR #60 -- maybe it's some small omission/gotcha.
I got it, and will fix it ASAP, thanks for reporting!
nice