<div dir="auto"><div><br>That's the way to do it in a vmod, indeed.<div dir="auto"><br></div><div dir="auto">However Ryan, I don't get why you are reluctant to use the logs. By using the c api, you can just define callbacks and get called everything a request/transaction ends, so you don't need to read regularly. <br><div data-smartmail="gmail_signature" dir="auto">-- <br>Guillaume Quintard </div></div><br><div class="gmail_extra"><br><div class="gmail_quote">On May 8, 2017 17:45, "Reza Naghibi" <<a href="mailto:reza@varnish-software.com">reza@varnish-software.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You can do this in a VMOD via PRIV_TASK:<div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="m_1391455337633287076gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--<br>Reza Naghibi<br>Varnish Software</div></div></div><div class="elided-text">
<br><div class="gmail_quote">On Fri, May 5, 2017 at 10:15 PM, Ryan Burn <span dir="ltr"><<a href="mailto:rnickb731@gmail.com" target="_blank">rnickb731@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
>From VCL, is it possible to execute code that runs after a request has<br>
been processed?<br>
<br>
I'm looking into writing a module that enables Varnish for distributed<br>
tracing using the OpenTracing project [<a href="http://opentracing.io" rel="noreferrer" target="_blank">opentracing.io</a>]. This requires<br>
invoking code at the beginning of a request to start a span and insert<br>
tracing context into the request's headers and invoking code after a<br>
request's been processed to finish the span and measure how long it<br>
took to process.<br>
<br>
I recently did a similar project for nginx<br>
[<a href="http://github.com/rnburn/nginx-opentracing" rel="noreferrer" target="_blank">github.com/rnburn/nginx-opent<wbr>racing</a>]. Nginx provides an<br>
NGX_HTTP_LOG_PHASE [<a href="http://www.nginxguts.com/2011/01/phases/" rel="noreferrer" target="_blank">www.nginxguts.com/2011/01/pha<wbr>ses/</a>] that allows you<br>
to set up handlers run after requests are serviced. Can anything<br>
equivalent be done using VCL?<br>
<br>
I image you could accomplish this by subscribing and regularly reading<br>
from Varnish's shared memory log, but I'd much rather do it directly<br>
if possible.<br>
<br>
Thanks, Ryan<br>
<br>
______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-misc</a><br>
</blockquote></div><br></div></div>
<br>______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/<wbr>varnish-misc</a><br></blockquote></div><br></div></div></div>