HAProxy community

Stats are not updated


#1

Hi All,

I am seeing issue in our haproxy where backend http responses total stats are not getting updated for few backends. Its a random behavior. We haproxy running in pods and backends are periodically refreshed based on using confd. We use prometheus haproxy exporter to retrieve the stats.

Is there some sort of sampling in the backend http response totals metric? Any special case that it will not update the stats?

Thanks,
Swapnil


#2

Are you perhaps using HAProxy with multiple processes (i.e. by setting nbproc)?

I’m asking because apparently the stats page is individual for each process, and if you don’t use the stats bind-process option, you’ll get the stats from a random process on each request.


#3

No, we don’t have multiple processes. I think what is happening here is when confd is reloading config for haproxy process, it resets the stats. The randomness in the behavior is because confd will only reload haproxy config when there is difference between newly generated config and existing config.

Is there a way of preserving metrics on config reload?


#4

Yes, the statistics are reset whenever the HAProxy process is restarted. (Perhaps even when “reloaded”?)

I’m not sure how to solve this, but you could take a look at server-state-file and load-server-state-from-file perhaps those are helpful in preserving statistics.


#5

This should not be a problem:

https://www.robustperception.io/how-does-a-prometheus-counter-work