]> source.dussan.org Git - rspamd.git/commitdiff
Provide data for fuzzy checks statistics.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Apr 2015 17:31:43 +0000 (18:31 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Apr 2015 17:31:43 +0000 (18:31 +0100)
src/controller.c

index ece5c86b0ce81b1d476adae13ae0fffddd24c7d3..40e7ac7cea0350aec4218162a88eebd0351e6323 100644 (file)
@@ -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 ();
        }