This module is part of a company project which aims to locate the bottlenecks
of backend servers from the client-side point of view. It records a request's
start-time and finish-time into the header set by spent_header
, by the mean
time, keeping every en route phase's in it.
-
Configuration
location /static/js/ { spent passive; spent_header X-Spent; spent_header p; }
-
Part of response headers seen by client (timestamp prefix by
d
is generated by some other backend server (another Nignx instance, php-fpm etc.)).... Content-Type: text/plain\r\n X-Spent: p100.123;d100.124;d100.125;p100.126\r\n ...
syntax: spent passive
| active
| off
default: spent off
context: http, server, location
It enables the module working in different mode, or just disable it completely in a given context.
off
turns the module off;passive
means the operation is triggered by header from upstream;active
makes header specified byspent_header
added whatsoever;
syntax: spent_header customized_header
default: spent_header X-Spent
context: http, server, location
It specifies which header to operate on.
syntax: spent_prefix identifier
default: spent_prefix p
context: http, server, location
It specifies prefix of timestamp generate by current Nginx instance.
-
Avoid using standard headers or Nginx pre-defined headers. Nginx may hide them from downstream.
-
Nginx timestamps returned by
ngx_timeofday
are not produced in real-time by syscall s. They are from a cache, actually. So you may observe finish-time equals to start-time quite often if your request is processed very quickly.