Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 https://newrelic.com/docs/features/tracking-front-end-time). 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 192.168.0.1:80 weight 1 check

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

share|improve this question

migrated from stackoverflow.com 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
1  
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
add comment

1 Answer 1

up vote 2 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
add comment

Your Answer

 
discard

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.