Request timing headers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Request timing headers

Juraj Masar
Hi guys,

First of all, thank you all for the wonderful work you've done on Squid!

Is it possible for Squid to return request timing information in response headers?
I'm looking for something similar to cURL: namelookup time/connect time/total time/etc.

Is there a configuration directive or a plugin I'm missing?

Thank you & have a great weekend!

Best,
Juraj




_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Request timing headers

Alex Rousskov
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).
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users