]> err.no Git - varnish/commitdiff
Add more shmemlog tags:
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 24 Jun 2006 19:41:55 +0000 (19:41 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 24 Jun 2006 19:41:55 +0000 (19:41 +0000)
one for each VCL method to record the return
one for errors
one for linking a client session to a backend connection
Use them sensibly.
Put VCL name of backend into struct backend to improve log messages

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@223 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_pool.c
varnish-cache/bin/varnishd/cache_vcl.c
varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/include/shmlog_tags.h
varnish-cache/include/vrt.h
varnish-cache/lib/libvcl/vcl_compile.c
varnish-cache/lib/libvcl/vcl_fixed_token.c

index 7325a63f38aca66949ff74ab9cdcf90b3c268730..86eb682f493d8a3e3bd24baceafc7378beb3b253 100644 (file)
@@ -104,6 +104,7 @@ struct sess {
 };
 
 struct backend {
+       const char      *vcl_name;
        const char      *hostname;
        const char      *portname;
        unsigned        ip;
index 34e82001ad271f967218bcec9376f3d2cad7144a..ed1518f10a96045d7bd34c0781f2cb577b7702e1 100644 (file)
@@ -204,7 +204,7 @@ FetchSession(struct worker *w, struct sess *sp)
 
        fd = VBE_GetFd(sp->backend, &fd_token);
        assert(fd != -1);
-       VSL(SLT_Handling, sp->fd, "Fetch fd %d", fd);
+       VSL(SLT_Backend, sp->fd, "%d %s", fd, sp->backend->vcl_name);
 
        hp = http_New();
        http_BuildSbuf(1, w->sb, sp->http);
index 4810b077e10245180c210e4a39f2dd2492af26f6..cb74cc5d3822d75ff3eeb6b8027da36cf62e56f0 100644 (file)
@@ -110,23 +110,19 @@ CacheWorker(void *priv)
                for (done = 0; !done; ) {
                        switch(sp->handling) {
                        case VCL_RET_LOOKUP:
-                               VSL(SLT_Handling, sp->fd, "Lookup");
                                done = LookupSession(&w, sp);
                                break;
                        case VCL_RET_FETCH:
                                done = FetchSession(&w, sp);
                                break;
                        case VCL_RET_DELIVER:
-                               VSL(SLT_Handling, sp->fd, "Deliver");
                                done = DeliverSession(&w, sp);
                                break;
                        case VCL_RET_PIPE:
-                               VSL(SLT_Handling, sp->fd, "Pipe");
                                PipeSession(&w, sp);
                                done = 1;
                                break;
                        case VCL_RET_PASS:
-                               VSL(SLT_Handling, sp->fd, "Pass");
                                PassSession(&w, sp);
                                done = 1;
                                break;
index 2c70da213b29ff4bdafcd0cc7220ec9e184c9812..3dc49426706b1564cbd4e1ba837e7f9eeae003bd 100644 (file)
@@ -212,15 +212,11 @@ CheckHandling(struct sess *sp, const char *func, unsigned bitmap)
 
        u = sp->handling;
        n = HandlingName(u);
-       if (n != NULL)
-               VSL(SLT_Handling, sp->fd, "%s(): %s", func, n);
-       else
-               VSL(SLT_Handling, sp->fd, "%s(): Illegal: 0x%x", func, u);
        if (u & (u - 1))
-               VSL(SLT_Debug, sp->fd,
+               VSL(SLT_Error, sp->fd,
                    "Illegal handling after %s function: 0x%x", func, u);
        else if (!(u & bitmap))
-               VSL(SLT_Debug, sp->fd,
+               VSL(SLT_Error, sp->fd,
                    "Wrong handling after %s function: 0x%x", func, u);
        else
                return;
@@ -235,6 +231,7 @@ VCL_##func##_method(struct sess *sp)                \
        sp->handling = 0;                       \
        sp->vcl->func##_func(sp);               \
        CheckHandling(sp, #func, (bitmap));     \
+       VSL(SLT_vcl_##func, sp->fd, "%s", HandlingName(sp->handling)); \
 }
 
 #define VCL_RET_MAC(l,u,b)
index 1030f331c032ec4e2ead03403f0485179cd8c645..0cb02c3d239f85666d3a7658f0ca59a40dd006ea 100644 (file)
@@ -102,6 +102,12 @@ VRT_set_backend_portname(struct backend *be, const char *p)
        be->portname = p;
 }
 
+void
+VRT_set_backend_name(struct backend *be, const char *p)
+{
+       be->vcl_name = p;
+}
+
 void
 VRT_alloc_backends(struct VCL_conf *cp)
 {
index 9a0b33ccbc8ba995fbce17eccf23babc78963ae0..2a28ffe846b3948e98ae888453e5f7103418eda5 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 SLTM(Debug)
+SLTM(Error)
 SLTM(CLI)
 SLTM(SessionOpen)
 SLTM(SessionReuse)
@@ -16,7 +17,12 @@ SLTM(BackendReuse)
 SLTM(BackendClose)
 SLTM(HttpError)
 SLTM(ClientAddr)
-SLTM(Handling)
+#define VCL_RET_MAC(l,u,b)
+#define VCL_MET_MAC(l,u,b) SLTM(vcl_##l)
+#include "vcl_returns.h"
+#undef VCL_MET_MAC
+#undef VCL_RET_MAC
+SLTM(Backend)
 SLTM(Request)
 SLTM(Response)
 SLTM(Status)
index 3779a6a4c0e7c04783385825f1cb554486273a7d..62b291e4a47ed227ac7f78378dce681511473595 100644 (file)
@@ -40,6 +40,7 @@ void VRT_handling(struct sess *sp, unsigned hand);
 int VRT_obj_valid(struct sess *);
 int VRT_obj_cacheable(struct sess *);
 
+void VRT_set_backend_name(struct backend *, const char *);
 void VRT_set_backend_hostname(struct backend *, const char *);
 void VRT_set_backend_portname(struct backend *, const char *);
 
index 0d359b54e997e24cac285d2d0a3495a92f39027f..5c9a308dd13b3317d006dc0c972a7707de3cf096 100644 (file)
@@ -42,8 +42,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <sbuf.h>
 #include <stdio.h>
+#include <sbuf.h>
 #include <stdlib.h>
 #include <string.h>
 #include <queue.h>
@@ -1241,6 +1241,11 @@ Backend(struct tokenlist *tl)
            tl->t->e - tl->t->b,
            tl->t->e - tl->t->b, tl->t->b);
        I(tl); sbuf_printf(tl->fc, "\tconst char *p;\n");
+       I(tl); sbuf_printf(tl->fc, "\n");
+       I(tl); sbuf_printf(tl->fc,
+           "\tVRT_set_backend_name(backend, \"%*.*s\");\n",
+           tl->t->e - tl->t->b,
+           tl->t->e - tl->t->b, tl->t->b);
        NextToken(tl);
        ExpectErr(tl, '{');
        NextToken(tl);
index 947e9276bdb68a4c1539a0543bea0ca10e7db541..f10b5ceabb8336bd33cfabc90bfc7c271c245383 100644 (file)
@@ -485,6 +485,7 @@ vcl_output_lang_h(FILE *f)
        fputs("int VRT_obj_valid(struct sess *);\n", f);
        fputs("int VRT_obj_cacheable(struct sess *);\n", f);
        fputs("\n", f);
+       fputs("void VRT_set_backend_name(struct backend *, const char *);\n", f);
        fputs("void VRT_set_backend_hostname(struct backend *, const char *);\n", f);
        fputs("void VRT_set_backend_portname(struct backend *, const char *);\n", f);
        fputs("\n", f);