Commit 33eca69a authored by Geoff Simmons's avatar Geoff Simmons

Add decrypter.create_stats().

parent 766d3b42
......@@ -31,6 +31,7 @@ varnish v1 -arg "-p vsl_mask=+VfpAcct" -vcl+backend {
# With all params set to defaults, the decrypter is
# just like the default ece_decrypt VFP.
new default_dup = ece.decrypter("default_dup");
default_dup.create_stats();
ece.set_key("", blob.decode(BASE64URLNOPAD,
encoded="yqdlZ-tYemfogSmv7Ws5PQ"));
ece.set_key("a1", blob.decode(BASE64URLNOPAD,
......@@ -76,6 +77,10 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect * = End
} -run
varnish v1 -expect ECE.vfp.vcl1.default_dup.ops == 2
varnish v1 -expect ECE.vfp.vcl1.default_dup.in == 126
varnish v1 -expect ECE.vfp.vcl1.default_dup.out == 30
server s1 -wait
server s1 -start
......@@ -85,6 +90,7 @@ varnish v1 -vcl+backend {
sub vcl_init {
# Use a chunk size that is smaller than the default.
new chunk4k = ece.decrypter("chunk4k", chunksz=4k);
chunk4k.create_stats();
}
sub vcl_backend_response {
......@@ -114,6 +120,10 @@ client c1 -run
logexpect l1 -wait
varnish v1 -expect ECE.vfp.vcl2.chunk4k.ops == 2
varnish v1 -expect ECE.vfp.vcl2.chunk4k.in == 126
varnish v1 -expect ECE.vfp.vcl2.chunk4k.out == 30
server s1 -wait
server s1 -start
......@@ -122,7 +132,8 @@ varnish v1 -vcl+backend {
sub vcl_init {
# max_rs=0 means that record sizes are only limited by INT_MAX.
new chunk4k = ece.decrypter("maxrs0", max_rs=0B);
new maxrs0 = ece.decrypter("maxrs0", max_rs=0B);
maxrs0.create_stats();
}
sub vcl_backend_response {
......@@ -150,6 +161,12 @@ logexpect l1 -v v1 -d 0 -g vxid -q "VfpAcct" {
client c1 -run
logexpect l1 -wait
varnish v1 -expect ECE.vfp.vcl3.maxrs0.ops == 2
varnish v1 -expect ECE.vfp.vcl3.maxrs0.in == 126
varnish v1 -expect ECE.vfp.vcl3.maxrs0.out == 30
server s1 -wait
server s1 {
rxreq
......
......@@ -170,6 +170,7 @@ varnish v1 -vcl+backend {
rs128.create_stats();
# Decrypter uses 8k chunk size.
new chunk8k = ece.decrypter("chunk8k", chunksz=8k);
chunk8k.create_stats();
}
sub vcl_backend_response {
......@@ -226,10 +227,15 @@ client c1 -run
logexpect l1 -wait
# Verify in the logs for the custom VFPs that encrypter.out == decrypter.in
varnish v1 -expect ECE.vfp.vcl2.rs128.ops == 6
varnish v1 -expect ECE.vfp.vcl2.rs128.in == 199975
varnish v1 -expect ECE.vfp.vcl2.rs128.out > 199975
varnish v1 -expect ECE.vfp.vcl2.chunk8k.ops == 6
varnish v1 -expect ECE.vfp.vcl2.chunk8k.in > 199975
varnish v1 -expect ECE.vfp.vcl2.chunk8k.out == 199975
varnish v1 -vcl+backend {
import ${vmod_ece};
......@@ -237,6 +243,7 @@ varnish v1 -vcl+backend {
new rs815 = ece.encrypter("rs815", rs=815B);
rs815.create_stats();
new chunk4711 = ece.decrypter("chunk4711", chunksz=4711B);
chunk4711.create_stats();
}
sub vcl_backend_response {
......@@ -297,6 +304,10 @@ varnish v1 -expect ECE.vfp.vcl3.rs815.ops == 6
varnish v1 -expect ECE.vfp.vcl3.rs815.in == 199975
varnish v1 -expect ECE.vfp.vcl3.rs815.out > 199975
varnish v1 -expect ECE.vfp.vcl3.chunk4711.ops == 6
varnish v1 -expect ECE.vfp.vcl3.chunk4711.in > 199975
varnish v1 -expect ECE.vfp.vcl3.chunk4711.out == 199975
varnish v1 -cli "vcl.discard vcl1"
varnish v1 -cli "vcl.discard vcl2"
varnish v1 -cli "vcl.list"
......@@ -503,6 +503,13 @@ VCL_VOID vmod_decrypter__fini(struct VPFX(ece_decrypter) **decp)
FREE_OBJ(dec);
}
VCL_VOID
vmod_decrypter_create_stats(VRT_CTX, struct VPFX(ece_decrypter) * dec)
{
CHECK_OBJ_NOTNULL(dec, ECE_DECRYPTER_MAGIC);
create_stats(ctx, dec->vfp, dec->vcl_name);
}
/* Key manipulation functions */
#define CHECK_ID(ctx, id, len, ret) \
......
......@@ -79,6 +79,14 @@ Create a decryption filter named ``name`` with custom parameters.
XXX ...
$Method VOID .create_stats()
Create statistics for the custom decryption filter, the same as the
counters created for the standard ``"ece_decrypt"`` filter. See
`STATISTICS`_ for details.
XXX ...
$Function VOID add_key(STRING id, BLOB key)
Add the keying material identified by ``id`` with the contents of the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment