<div dir="ltr">Sorry, email misfire.<div><br></div><div>You can do this in a VMOD via PRIV_TASK:</div><div><br></div><div><a href="https://varnish-cache.org/docs/trunk/reference/vmod.html#private-pointers">https://varnish-cache.org/docs/trunk/reference/vmod.html#private-pointers</a><br></div><div><br></div><div>It might make sense to track this stuff in some kind of struct, in which case, put it into *priv and then register a *free callback. Otherwise, just put a dummy value into the *priv. *free will get called after the request is done and you can put your custom code in there.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--<br>Reza Naghibi<br>Varnish Software</div></div></div>
<br><div class="gmail_quote">On Mon, May 8, 2017 at 11:10 AM, Reza Naghibi <span dir="ltr"><<a href="mailto:reza@varnish-software.com" target="_blank">reza@varnish-software.com</a>></span> wrote:<br><blockquote class="gmail_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_-155303014328153734gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--<br>Reza Naghibi<br>Varnish Software</div></div></div><div><div class="h5">
<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></div>
</blockquote></div><br></div>