Show source index in VCL_trace

kokoniimasu kokoniimasu at gmail.com
Mon Aug 28 07:47:21 CEST 2017


Hello,

I'm using VCL_trace for debugging.
But, VCL_trace is not enough little info, if using multipe VCLs.


  24025048 VCL_trace      c 3 14.5
  24025048 VCL_trace      c 4 18.9
                            |  |  |
                            |  |  +- VCL program line position
                            |  +---- VCL program line number
                            +------- VCL trace point index


VCL_trace does not have identify source file way in VSL.
To identify, need to run varnishd "varnishd -C -f [file]"


  $varnishd -C -f /etc/varnish/default.vcl 2>&1 |less
  ...
  static struct vrt_ref VGC_ref[VGC_NREFS] = {
    [  1] = { 2,     1670,   66,   3,  "new" },
    [  2] = { 0,      143,    7,   3,  "new" },
    [  3] = { 0,      289,   14,   5,  "if" },
    [  4] = { 0,      392,   18,   9,  "set" },
  ...


This way have a problem, because it can't be guaranteed same as a
running config.

I thought 2 pattern solution.

- Add vcl source index in vcl_trace.
https://github.com/varnishcache/varnish-cache/compare/master...xcir:patch/modify_vcl_trace?expand=1

   32770 VCL_trace      c 1 2.3.3
   32770 VCL_trace      c 2 2.4.5
                          | | | |
                          | | | +---- VCL program line position
                          | | +------ VCL program line number
                          | +-------- VCL program source index
                          +---------- VCL trace point index



- Add -t(trace) option in vcl.show
https://github.com/varnishcache/varnish-cache/compare/master...xcir:patch/add_t_opt_cli?expand=1
This patch dumps VGC_ref.

   $ sudo varnishadm vcl.show -t boot
   index src  line  pos token
       1   2     3    3 "if"
       2   2     4    5 "std.log"
   ...
      36   1   189    5 "return"
      37   1   193    5 "return"

I think modify to vcl_trace is better.
But, VSL format change is painful.

I'll like to create either pull-request.
Can I get your opinion?

Regards,
--
Shohei Tanaka(@xcir)
http://blog.xcir.net/ (JP)



More information about the varnish-misc mailing list