<div dir="ltr">you can put anything in the priv field of the task, but the issue is that you have to put that data in there, meaning a call to your vmod from the vcl.<div><br></div><div>the VUT.dispatch_f function isn't to be called from a vmod, and I don't think you need to.</div><div><br></div><div>Maybe it's time to take a step back, can you fill us in the whole workflow, notably:</div><div>- what data do you inject, and how do you create it?</div><div>- what do you need to know about the req/resp/bereq/beresp?</div><div><br></div><div>I almost have the feeling that this could be solved through pure vcl+shell.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote">On Thu, May 11, 2017 at 5:33 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">From the free function, is there any way to get the status code or<br>
other properties of the request? I tried using VRT_r_obj_status with a<br>
stored reference to the context, but that doesn't seem to work since<br>
some of the request's resources have already been reclaimed:<br>
<br>
<a href="https://github.com/rnburn/varnish-opentracing/blob/master/opentracing/src/trace.cpp#L22" rel="noreferrer" target="_blank">https://github.com/rnburn/<wbr>varnish-opentracing/blob/<wbr>master/opentracing/src/trace.<wbr>cpp#L22</a><br>
<br>
Is there any other place something like the status would be stored?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Mon, May 8, 2017 at 11:13 AM, Reza Naghibi <<a href="mailto:reza@varnish-software.com">reza@varnish-software.com</a>> wrote:<br>
> Sorry, email misfire.<br>
><br>
> You can do this in a VMOD via PRIV_TASK:<br>
><br>
> <a href="https://varnish-cache.org/docs/trunk/reference/vmod.html#private-pointers" rel="noreferrer" target="_blank">https://varnish-cache.org/<wbr>docs/trunk/reference/vmod.<wbr>html#private-pointers</a><br>
><br>
> It might make sense to track this stuff in some kind of struct, in which<br>
> case, put it into *priv and then register a *free callback. Otherwise, just<br>
> put a dummy value into the *priv. *free will get called after the request is<br>
> done and you can put your custom code in there.<br>
><br>
> --<br>
> Reza Naghibi<br>
> Varnish Software<br>
><br>
> On Mon, May 8, 2017 at 11:10 AM, Reza Naghibi <<a href="mailto:reza@varnish-software.com">reza@varnish-software.com</a>><br>
> wrote:<br>
>><br>
>> You can do this in a VMOD via PRIV_TASK:<br>
>><br>
>><br>
>> --<br>
>> Reza Naghibi<br>
>> Varnish Software<br>
>><br>
>> On Fri, May 5, 2017 at 10:15 PM, Ryan Burn <<a href="mailto:rnickb731@gmail.com">rnickb731@gmail.com</a>> wrote:<br>
>>><br>
>>> 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-<wbr>opentracing</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/<wbr>phases/</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">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>
>><br>
>><br>
><br>
<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>
</div></div></blockquote></div><br></div>