commit cff0a94: [Minor] Extend /stat response

moisseev moiseev at mezonplus.ru
Wed Aug 5 20:07:09 UTC 2020


Author: moisseev
Date: 2020-08-05 18:04:35 +0300
URL: https://github.com/rspamd/rspamd/commit/cff0a94678a2da9378ced8b5da09d5a4464f165a (refs/pull/3460/head)

[Minor] Extend /stat response

---
 src/controller.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/controller.c b/src/controller.c
index 9abd8f109..e3f810d0e 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -2567,6 +2567,7 @@ rspamd_controller_handle_stat_common (
 	struct rspamd_controller_session *session = conn_ent->ud;
 	ucl_object_t *top, *sub;
 	gint i;
+	int64_t uptime;
 	guint64 spam = 0, ham = 0;
 	rspamd_mempool_stat_t mem_st;
 	struct rspamd_stat *stat, stat_copy;
@@ -2598,6 +2599,13 @@ rspamd_controller_handle_stat_common (
 	task->http_conn = rspamd_http_connection_ref (conn_ent->conn);;
 	task->sock = conn_ent->conn->fd;
 
+	ucl_object_insert_key (top, ucl_object_fromstring (
+			RVERSION), "version",  0, false);
+	ucl_object_insert_key (top, ucl_object_fromstring (
+			session->ctx->cfg->checksum), "config_id", 0, false);
+	uptime = ev_time () - session->ctx->start_time;
+	ucl_object_insert_key (top, ucl_object_fromint (
+			uptime), "uptime", 0, false);
 	ucl_object_insert_key (top, ucl_object_frombool (!session->is_enable),
 			"read_only", 0, false);
 	ucl_object_insert_key (top, ucl_object_fromint (


More information about the Commits mailing list