We'd like to track request queue times, and as per https://docs.newrelic.com/docs/apm/other-features/request-queueing/configuring-request-queue-reporting, we need to add X-Request-Start
or X-Queue-Start
with the timestamp in milliseconds.
Using %Ts
is NOT the correct solution as it is the start time of the session (stream) and not the request time. Multiple requests will use the same %Ts
time. See more details here
The correct solution for haproxy version <1.9 is to use the following in the frontend
block. Unfortunately it only has seconds resolution.
http-request set-header X-Request-Start t=%[date()]
If you are using haproxy version >=1.9 there is a new sample fetch method date_us() which can be used to get microseconds resolution.
http-request set-header X-Request-Start t=%[date()]%[date_us()]
Note: The newrelic agents can automatically handle timestamps values sent using seconds, milliseconds, or as microseconds.
The solution is to add this line in your frontend
block. You'll need one for HTTP and HTTPS.
http-request set-header X-Request-Start t=%Ts%ms
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With