request start_time variable
June 07, 2011 04:55PM
It would be nice if there was a start_time variable from the request for Rails users using New Relic monitoring. Here's the diff.

https://gist.github.com/713738
Re: request start_time variable
June 20, 2011 02:19PM
Here's the diff for 1.0.4

diff -r nginx-1.0.4/src/http/ngx_http_variables.c nginx-1.0.4.patched/src/http/ngx_http_variables.c
94a95,96
> static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
> ngx_http_variable_value_t *v, uintptr_t data);
256a259,261
> { ngx_string("start_time"), NULL, ngx_http_variable_start_time,
> 0, 0, 0 },
>
1653a1659,1681
> v->valid = 1;
> v->no_cacheable = 0;
> v->not_found = 0;
> v->data = p;
>
> return NGX_OK;
> }
>
>
> static ngx_int_t
> ngx_http_variable_start_time(ngx_http_request_t *r,
> ngx_http_variable_value_t *v, uintptr_t data)
> {
> u_char *p;
>
> p = ngx_pnalloc(r->pool, NGX_INT64_LEN);
> if (p == NULL) {
> return NGX_ERROR;
> }
>
> uint64_t usec = (((uint64_t)r->start_sec * 1000 * 1000) + ((uint64_t)r->start_msec * 1000));
>
> v->len = ngx_sprintf(p, "%L", usec) - p;
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready