You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by nik600 <ni...@gmail.com> on 2014/12/07 01:36:32 UTC
is ap_hook_log_transaction the wright place where to write my stats
code ?
Dear all
i've written a custom module to handle the cache of my CMS system.
Basically this module works in ap_hook_translate_name and decides
(following some custom logic) if the request can be served or not from the
cache.
If yes, the r->uri is changed to be served locally from my cache dir
if no, the r->filename is changed to be server from
a proxy:balancer://cluster config
In the ap_hook_log_transaction i'd like to compute the time of content
generation using:
>float request_duration_sec=(float)(apr_time_now() -
r->request_time)/1000000;
Is this approach correct?
Is there any other hook more appropriate to do that?
Thanks all in advance.
Bye
--
/*************/
nik600
http://www.kumbe.it
Re: is ap_hook_log_transaction the wright place where to write my
stats code ?
Posted by nik600 <ni...@gmail.com>.
Thanka for your reply!
Is not so simple...the custom logic is a mixture of regex, memcached get,
json, cookies and http headers so i had to write a custom module.
Btw, thanks for your help!
Il 07/dic/2014 10:25 "Sorin Manolache" <so...@gmail.com> ha scritto:
> On 2014-12-07 01:36, nik600 wrote:
>
>> Dear all
>>
>> i've written a custom module to handle the cache of my CMS system.
>>
>> Basically this module works in ap_hook_translate_name and decides
>> (following some custom logic) if the request can be served or not from the
>> cache.
>>
>> If yes, the r->uri is changed to be served locally from my cache dir
>> if no, the r->filename is changed to be server from
>> a proxy:balancer://cluster config
>>
>> In the ap_hook_log_transaction i'd like to compute the time of content
>> generation using:
>>
>> float request_duration_sec=(float)(apr_time_now() -
>>>
>> r->request_time)/1000000;
>>
>> Is this approach correct?
>>
>> Is there any other hook more appropriate to do that?
>>
>> Thanks all in advance.
>>
>
> Hello,
>
> I think your approach is correct. However, have a look at the LogFormat
> directive. The %D directive might do exactly what you want and implemented
> in log_transaction.
>
> Have a look at the RewriteCond and RewriteRule directives. The selective
> proxying could be implemented by these directives without writing any code.
>
> E.g.:
>
> <LocationMatch ^/your_url_pattern>
> RewriteEngine On
> RewriteCond ...
> RewriteCond ...
> RewriteRule .* http://proxy/path?args keepalive=on [P]
> </LocationMatch>
>
> <Proxy http://proxy/path>
> ...
> </Proxy>
>
> I have not tried it with balancers but I think it works and the
> configuration is similar (balancer:// instead of http://).
>
> Sorin
>
>
>> Bye
>>
>>
>
Re: is ap_hook_log_transaction the wright place where to write my
stats code ?
Posted by Sorin Manolache <so...@gmail.com>.
On 2014-12-07 01:36, nik600 wrote:
> Dear all
>
> i've written a custom module to handle the cache of my CMS system.
>
> Basically this module works in ap_hook_translate_name and decides
> (following some custom logic) if the request can be served or not from the
> cache.
>
> If yes, the r->uri is changed to be served locally from my cache dir
> if no, the r->filename is changed to be server from
> a proxy:balancer://cluster config
>
> In the ap_hook_log_transaction i'd like to compute the time of content
> generation using:
>
>> float request_duration_sec=(float)(apr_time_now() -
> r->request_time)/1000000;
>
> Is this approach correct?
>
> Is there any other hook more appropriate to do that?
>
> Thanks all in advance.
Hello,
I think your approach is correct. However, have a look at the LogFormat
directive. The %D directive might do exactly what you want and
implemented in log_transaction.
Have a look at the RewriteCond and RewriteRule directives. The selective
proxying could be implemented by these directives without writing any code.
E.g.:
<LocationMatch ^/your_url_pattern>
RewriteEngine On
RewriteCond ...
RewriteCond ...
RewriteRule .* http://proxy/path?args keepalive=on [P]
</LocationMatch>
<Proxy http://proxy/path>
...
</Proxy>
I have not tried it with balancers but I think it works and the
configuration is similar (balancer:// instead of http://).
Sorin
>
> Bye
>