From bcde7d898fca1b35d439b9fa2e4998d5df1df87c Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 21 Apr 2015 18:31:43 +0100 Subject: [PATCH] Provide data for fuzzy checks statistics. --- src/controller.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/controller.c b/src/controller.c index ece5c86b0..40e7ac7ce 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1323,6 +1323,22 @@ rspamd_controller_handle_stat_common ( ucl_object_fromint ( stat->fuzzy_hashes_expired), "fuzzy_expired", 0, false); + /* Fuzzy epoch statistics */ + sub = ucl_object_typed_new (UCL_ARRAY); + + for (i = RSPAMD_FUZZY_EPOCH6; i < RSPAMD_FUZZY_EPOCH_MAX; i ++) { + ucl_array_append (sub, ucl_object_fromint (stat->fuzzy_hashes_checked[i])); + } + + ucl_object_insert_key (top, sub, "fuzzy_checked", 0, false); + sub = ucl_object_typed_new (UCL_ARRAY); + + for (i = RSPAMD_FUZZY_EPOCH6; i < RSPAMD_FUZZY_EPOCH_MAX; i ++) { + ucl_array_append (sub, ucl_object_fromint (stat->fuzzy_hashes_found[i])); + } + + ucl_object_insert_key (top, sub, "fuzzy_found", 0, false); + /* Now write statistics for each statfile */ sub = rspamd_stat_statistics (session->ctx->cfg, &learned); @@ -1335,6 +1351,10 @@ rspamd_controller_handle_stat_common ( session->ctx->srv->stat->messages_learned = 0; session->ctx->srv->stat->connections_count = 0; session->ctx->srv->stat->control_connections_count = 0; + memset (stat->fuzzy_hashes_checked, 0, + sizeof (stat->fuzzy_hashes_checked)); + memset (stat->fuzzy_hashes_found, 0, + sizeof (stat->fuzzy_hashes_found)); rspamd_mempool_stat_reset (); } -- 2.39.5