Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to measure the time of full request stack. The New Relic capture time of the middleware (e.g. java, python, ruby) and request time (See For this, I need to configure the X-Request-Start header as the request pass through the HAProxy load balance. The haproxy.cfg should look like:

backend www
  balance roundrobin
  mode http
reqadd      "X-Request-Start"  UNKNOWN_TIME_FUNCTION()
server servername weight 1 check

There is a haproxy native function to replace the UNKNOWN_TIME_FUNCTION()?

share|improve this question

migrated from Nov 9 '12 at 9:18

This question came from our site for professional and enthusiast programmers.

Out of curiosity, are you front loading your haproxy with an nginx? I'm wary of recompiling nginx with the provided patch – John K. Chow Nov 20 '12 at 4:21
No, my front is HAProxy which pass the requests to nginx. – Tupy Jan 24 '13 at 2:02
I'm curious, @Tupy, did you ever discover a solution to this? I would also like to setup New Relic to work with HAProxy. – Chris W. Mar 1 '13 at 20:06
up vote 3 down vote accepted

You can't do that right now, though it will be possible after we can pass SSL info because we'll permit to pass any dynamic information in a header. This piece of information would as well be the current time.

If you absolutely need this, it's not terribly difficult to implement in the code. Ideally it should be done in the function which is also able to send the server name in a header, so that in case of connect retry or redispatch, the time is updated, though that does not seem critical.

Oh and BTW, why don't you simply use haproxy's logs as everyone to measure your precise processing time ? It does exactly what you need with more details (eg: split connect/processing/transfer) without having to change anything in the server, and with more accuracy (having two machines synchronized at less than 1 millisecond is not easy).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.