Is it possible to monitor the duration of HTTP requests? (from the moment that the request is received by the load balancer, to the time when the response is returned to the client by the load balancer)
I would like to monitor this metric in the frontend, because I want to include the queue time. If I measure the duration of the backend I may get good stats but the real performance can be bad (for example if the request gets queued in the load balancer itself).
For example I would like to monitor a web application during traffic spikes to make sure that the responses are still fast, from the point of view of the user (e.g. < 3 seconds).
Best Answer
HAproxy offers all those informations in the logs .
see Haproxy HTTP Log Format
In particular you are looking for the section number 6 ,
where
Exporting those metrics from the logs to a more useful format / backend can be done in many ways, Logstash comes to mind since it can parse those logs and send them to many different backends