[master] b02d927 Include a timestamp in all CLI JSON responses.

Poul-Henning Kamp phk at FreeBSD.org
Wed Jun 6 08:33:11 UTC 2018


commit b02d92735d82e2e017cc6f00db3d888ce62274d7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 6 08:28:53 2018 +0000

    Include a timestamp in all CLI JSON responses.

diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index a80f751..ed1309d 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -370,7 +370,7 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv)
 		return;
 	}
 	if (la->j) {
-		VCLI_JSON_begin(cli, 1, av);
+		VCLI_JSON_begin(cli, 2, av);
 		VCLI_Out(cli, ",\n");
 		VCLI_Out(cli, "{\n");
 		VSB_indent(cli->sb, 2);
diff --git a/lib/libvarnish/vcli_serve.c b/lib/libvarnish/vcli_serve.c
index b1084a1..de7ebdb 100644
--- a/lib/libvarnish/vcli_serve.c
+++ b/lib/libvarnish/vcli_serve.c
@@ -50,6 +50,7 @@
 #include "vav.h"
 #include "vcli_serve.h"
 #include "vsb.h"
+#include "vtim.h"
 
 struct VCLS_fd {
 	unsigned			magic;
@@ -159,7 +160,7 @@ VCLS_func_help_json(struct cli *cli, const char * const *av, void *priv)
 	cs = cli->cls;
 	CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC);
 
-	VCLI_JSON_begin(cli, 1, av);
+	VCLI_JSON_begin(cli, 2, av);
 	VTAILQ_FOREACH(clp, &cs->funcs, list) {
 		if (clp->auth > cli->auth)
 			continue;
@@ -674,7 +675,7 @@ VCLI_JSON_begin(struct cli *cli, unsigned ver, const char * const * av)
 		if (av[i + 1] != NULL)
 			VCLI_Out(cli, ", ");
 	}
-	VCLI_Out(cli, "]");
+	VCLI_Out(cli, "], %.3f", VTIM_real());
 	VSB_indent(cli->sb, 2);
 }
 


More information about the varnish-commit mailing list