Any way to get timestamps for upstream-downstream events?

Maxim Dounin mdounin at mdounin.ru
Mon Jun 10 13:40:51 UTC 2019


Hello!

On Fri, Jun 07, 2019 at 12:54:22PM -0700, Ryan Burn wrote:

> Hello everyone,
> 
> I work on a module that provides distributed tracing for NGINX
> (https://github.com/opentracing-contrib/nginx-opentracing). If
> possible, I would like to include in the tracing data timestamps for
> the following events:
> 
> * When the last byte from a downstream request was read

This information isn't generally available.  If you need it, you 
can record this in your own module.

> * When the first byte of an upstream request was sent

This is more or less the same as the time connect was finished.  
For each peer tried during request processing related information 
can be found in the $upstream_connect_time variable.

Note that, much like other upstream-related variables, these 
timings are a) per upstream connection attempt, so there can be 
many for a given request, and b) not absolute, and instead specify 
duration of appropriate operations.

> * When the last byte of an upstream request was sent

This information isn't generally available.

> * When the first byte of an upstream response was read

Closest information available is $upstream_header_time.

> * When the last byte of an upstream response was read

Check $upstream_response_time.

> * When the first byte of a downstream response was sent

This information is not generally available.

> * When the last byte of a downstream response was sent

Check $response_time.  Alternatively, you can record this 
information in your own module.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list