[master] e968899 Increment fetch_failed for all causes
Federico G. Schwindt
fgsch at lodoss.net
Mon Jan 16 00:09:05 CET 2017
commit e96889983d14abca14894b66729e8b6077206f89
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Sun Jan 15 20:11:48 2017 +0000
Increment fetch_failed for all causes
IOW if we ended up in vcl_backend_error{} or failed after returning
delivery in vcl_backend_response{} (e.g. we did not receive enough bytes)
we will bump this counter.
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 9c4841d..05ad0bf 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -544,6 +544,7 @@ vbf_stp_fetchbody(struct worker *wrk, struct busyobj *bo)
// XXX: doclose = ?
return (F_STP_ERROR);
} else {
+ wrk->stats->fetch_failed++;
return (F_STP_FAIL);
}
}
@@ -794,6 +795,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
(void)VFP_Error(bo->vfc, "Template object failed");
if (bo->vfc->failed) {
VDI_Finish(bo->wrk, bo);
+ wrk->stats->fetch_failed++;
return (F_STP_FAIL);
}
return (F_STP_FETCHEND);
@@ -817,6 +819,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
AN(bo->fetch_objcore->flags & OC_F_BUSY);
assert(bo->director_state == DIR_S_NULL);
+ wrk->stats->fetch_failed++;
+
now = W_TIM_real(wrk);
VSLb_ts_busyobj(bo, "Error", now);
@@ -915,7 +919,6 @@ vbf_stp_fail(struct worker *wrk, const struct busyobj *bo)
if (!(bo->fetch_objcore->flags & OC_F_BUSY))
HSH_Kill(bo->fetch_objcore);
ObjSetState(wrk, bo->fetch_objcore, BOS_FAILED);
- wrk->stats->fetch_failed++;
return (F_STP_DONE);
}
diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc
index c51586b..1f0427c 100644
--- a/bin/varnishtest/tests/b00020.vtc
+++ b/bin/varnishtest/tests/b00020.vtc
@@ -46,4 +46,4 @@ client c1 {
varnish v1 -expect n_object == 1
varnish v1 -expect n_objectcore == 1
-
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/b00023.vtc b/bin/varnishtest/tests/b00023.vtc
index 7685f66..d418904 100644
--- a/bin/varnishtest/tests/b00023.vtc
+++ b/bin/varnishtest/tests/b00023.vtc
@@ -17,7 +17,6 @@ client c1 {
expect resp.status == 503
} -run
-
server s1 {
rxreq
delay 0.5
@@ -29,3 +28,5 @@ client c1 {
rxresp
expect resp.status == 200
} -run
+
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/b00038.vtc b/bin/varnishtest/tests/b00038.vtc
index b963b4f..871ce93 100644
--- a/bin/varnishtest/tests/b00038.vtc
+++ b/bin/varnishtest/tests/b00038.vtc
@@ -35,3 +35,5 @@ client c1 {
rxresp
expect resp.status == 503
} -run
+
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/c00061.vtc b/bin/varnishtest/tests/c00061.vtc
index d41ca79..1dba103 100644
--- a/bin/varnishtest/tests/c00061.vtc
+++ b/bin/varnishtest/tests/c00061.vtc
@@ -22,3 +22,6 @@ client c1 {
rxresp
expect resp.status == 504
} -run
+
+varnish v1 -expect backend_fail == 3
+varnish v1 -expect fetch_failed == 3
diff --git a/bin/varnishtest/tests/r01624.vtc b/bin/varnishtest/tests/r01624.vtc
index 3232f42..c18ba11 100644
--- a/bin/varnishtest/tests/r01624.vtc
+++ b/bin/varnishtest/tests/r01624.vtc
@@ -25,9 +25,10 @@ varnish v1 -vcl+backend {} -start
client c1 {
txreq
+ rxresphdrs
+ expect resp.status == 200
non_fatal
- timeout 3
- rxresp
+ rxrespbody
} -run
delay .2
@@ -38,3 +39,5 @@ client c1 {
rxresp
expect resp.bodylen == 7
} -run
+
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/r01648.vtc b/bin/varnishtest/tests/r01648.vtc
index 1a8cef9..2780db8 100644
--- a/bin/varnishtest/tests/r01648.vtc
+++ b/bin/varnishtest/tests/r01648.vtc
@@ -75,3 +75,5 @@ client c3 {
expect resp.status == 200
expect resp.body == "abcdef"
} -run
+
+varnish v1 -expect fetch_failed == 2
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index 6d9b369..7dbc87d 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -199,7 +199,7 @@ VSC_FF(fetch_304, uint64_t, 1, 'c', 'i', info,
)
VSC_FF(fetch_failed, uint64_t, 1, 'c', 'i', info,
- "Fetch failed (all causes), where we do get hold of the backend.",
+ "Fetch failed (all causes)",
"beresp fetch failed."
)
More information about the varnish-commit
mailing list