[squid-users] Request timing headers

Alex Rousskov rousskov at measurement-factory.com
Sat Oct 17 21:35:01 UTC 2020


On 10/17/20 5:14 PM, Juraj Masar wrote:

> Is it possible for Squid to return request timing information in
> response headers?

Interesting question! In theory, a custom response header can use
logformat %codes, including %codes that carry timing information, such
as %tr and %dt. You will need to quote the whole customer header value
for those %codes to be honored. See reply_header_add and logformat
directives for more info.

However, I did not test whether this actually works. Some Squid code may
(increasingly incorrectly) assume that a particular %code is only
expanded after the master transaction is done. Needless to say, the
transaction is still ongoing when the response header is being formed.
If you face such problems, you may want to just add %master_xaction to
your custom response header (and to access.log records) and then match
the response with the access log record containing all the details.
Adding %tS may also help in this case (if that %code works in the
response header context).


HTH,

Alex.

> 		tr	Response time (milliseconds)
> 		dt	Total time spent making DNS lookups (milliseconds)
> 		tS	Approximate master transaction start time in 
> 			<full seconds since epoch>.<fractional seconds> format.
> 			Currently, Squid considers the master transaction
> 			started when a complete HTTP request header initiating
> 			the transaction is received from the client. This is
> 			the same value that Squid uses to calculate transaction
> 			response time when logging %tr to access.log. Currently,
> 			Squid uses millisecond resolution for %tS values,
> 			similar to the default access.log "current time" field
> 			(%ts.%03tu).


More information about the squid-users mailing list