Hi Willy and Krzysztof,

It appears that "option contstats" added in haproxy 1.3.14 is broken since 1.3.16 and is still broken in 1.4 and 1.5 branches.

It's easier to show the issue with long tcp connections : counters are updated only on connection close. In my case, it prevents tracking mysql activity when a connection pool is used on the client side.

Examle :
listen stats :4000
        mode http
        stats enable
        
listen test :3307
        mode tcp
        option contstats
        server mysql localhost:3306


Before trying to fix this, I'd like to discuss about it.
In haproxy 1.5, a stream interface contains a reference to the current session by walking thru si->owner->context. I wonder if it shouldn't be the role of the stream interface to update the counters, maybe at the end of si_conn_send_loop().

In the same way, for haproxy 1.4, counters could be updated at the end of stream_sock_read() (then we should always initialize si->private to provide a pointer to the current session).

Do you see a better way to do this ? Tell me if you prefer an initial patch, it's sometimes better than explanations ;-)

--
Cyril Bonté

Reply via email to