[PATCH] Feature: $msec and $start_msec http variables, useful for setting in proxy headers before sending request to backend servers so processing and queue times can be measured.
Ruslan Ermilov
ru at nginx.com
Sun Dec 2 17:57:14 UTC 2012
On Sat, Dec 01, 2012 at 10:33:48PM +1100, Lawrence Pit wrote:
[...]
> After I finished this patch I checked the 1.3 branch, and noticed it
> already has an $msec http variable defined. But it's output is with a
> dot character before the milliseconds part. Why is that?
The idea is to make all "log only" variables the normal ones.
> New Relic has decribed something similar:
> https://newrelic.com/docs/features/tracking-front-end-time
>
> Aside: note that New Relic requires the time in microseconds. The only
> way I could find to do this (with my patch) was a workaround using the
> set command. With the 1.3 branch version of $msec there's no way I think
> (or is there?).
http {
map $msec $s {
~(?<x>.*)\. $x;
}
map $msec $ms {
~\.(?<x>.*) $x;
}
server {
return 200 "msec=$msec usec=${s}${ms}000\n";
}
}
$ curl http://localhost:8000/
msec=1354471012.591 usec=1354471012591000
More information about the nginx-devel
mailing list