r4315 - in branches/2.0/varnish-cache: bin/varnishd include

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Oct 8 17:33:25 CEST 2009


Author: tfheen
Date: 2009-10-08 17:33:25 +0200 (Thu, 08 Oct 2009)
New Revision: 4315

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c
   branches/2.0/varnish-cache/include/stat_field.h
Log:
Merge r4231: Add counters

Add a family of 9 counters to tell us how fetching from the backends
progress.



Modified: branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c	2009-10-08 15:19:34 UTC (rev 4314)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c	2009-10-08 15:33:25 UTC (rev 4315)
@@ -407,14 +407,17 @@
 	cls = 0;
 	mklen = 0;
 	if (is_head) {
-		/* nothing */
+		VSL_stats->fetch_head++;
 	} else if (http_GetHdr(hp, H_Content_Length, &b)) {
+		VSL_stats->fetch_length++;
 		cls = fetch_straight(sp, htc, b);
 		mklen = 1;
 	} else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) {
+		VSL_stats->fetch_chunked++;
 		cls = fetch_chunked(sp, htc);
 		mklen = 1;
 	} else if (http_GetHdr(hp, H_Transfer_Encoding, &b)) {
+		VSL_stats->fetch_bad++;
 		/* XXX: AUGH! */
 		WSL(sp->wrk, SLT_Debug, vc->fd, "Invalid Transfer-Encoding");
 		VBE_ClosedFd(sp);
@@ -427,6 +430,7 @@
 		 */
 		mklen = 1;
 	} else if (http_HdrIs(hp, H_Connection, "close")) {
+		VSL_stats->fetch_close++;
 		/*
 		 * If we have connection closed, it is safe to read what
 		 * comes in any case.
@@ -434,19 +438,23 @@
 		cls = fetch_eof(sp, htc);
 		mklen = 1;
 	} else if (hp->protover < 1.1) {
+		VSL_stats->fetch_oldhttp++;
 		/*
 		 * With no Connection header, assume EOF
 		 */
 		cls = fetch_eof(sp, htc);
 		mklen = 1;
 	} else {
+		VSL_stats->fetch_zero++;
 		/*
 		 * Assume zero length
+		 * XXX:  ??? 
 		 */
 		mklen = 1;
 	}
 
 	if (cls < 0) {
+		VSL_stats->fetch_failed++;
 		/* XXX: Wouldn't this store automatically be released ? */
 		while (!VTAILQ_EMPTY(&sp->obj->store)) {
 			st = VTAILQ_FIRST(&sp->obj->store);

Modified: branches/2.0/varnish-cache/include/stat_field.h
===================================================================
--- branches/2.0/varnish-cache/include/stat_field.h	2009-10-08 15:19:34 UTC (rev 4314)
+++ branches/2.0/varnish-cache/include/stat_field.h	2009-10-08 15:33:25 UTC (rev 4315)
@@ -46,6 +46,17 @@
 MAC_STAT(backend_recycle,	uint64_t, 'a', "Backend conn. recycles")
 MAC_STAT(backend_unused,	uint64_t, 'a', "Backend conn. unused")
 
+
+MAC_STAT(fetch_head,		uint64_t, 'a', "Fetch head")
+MAC_STAT(fetch_length,		uint64_t, 'a', "Fetch with Length")
+MAC_STAT(fetch_chunked,		uint64_t, 'a', "Fetch chunked")
+MAC_STAT(fetch_eof,		uint64_t, 'a', "Fetch EOF")
+MAC_STAT(fetch_bad,		uint64_t, 'a', "Fetch had bad headers")
+MAC_STAT(fetch_close,		uint64_t, 'a', "Fetch wanted close")
+MAC_STAT(fetch_oldhttp,		uint64_t, 'a', "Fetch pre HTTP/1.1 closed")
+MAC_STAT(fetch_zero,		uint64_t, 'a', "Fetch zero len")
+MAC_STAT(fetch_failed,		uint64_t, 'a', "Fetch failed")
+
 MAC_STAT(n_srcaddr,		uint64_t, 'i', "N struct srcaddr")
 MAC_STAT(n_srcaddr_act,		uint64_t, 'i', "N active struct srcaddr")
 MAC_STAT(n_sess_mem,		uint64_t, 'i', "N struct sess_mem")



More information about the varnish-commit mailing list