]> git.ipfire.org Git - thirdparty/suricata.git/commit
stats: Fix non-worker stats missing
authorArne Welzel <arne.welzel@corelight.com>
Sat, 17 Feb 2024 17:19:27 +0000 (18:19 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 16 Apr 2024 13:19:06 +0000 (15:19 +0200)
commitfc8a36051a183715249b3da016d2dd56a3faf274
tree4bc16a92bcd6c6af059461daae51798bd359069b
parentb14606813402ecf7b0cd7d5de9ed95495020739a
stats: Fix non-worker stats missing

Commit b8b8aa69b49ac0dd222446c28d00a50f9fd7d716 used tm_name of the
first StatsRecord of a thread block as key for the "threads" object.
However, depending on the type of thread, tm_name can be NULL and would
result in no entry being included for that thread at all. This caused
non-worker metrics to vanish from the "threads" object in the
dump-counters output.

This patch fixes this by remembering the first occurrence of a valid
tm_name within the per-thread block and adds another unittest to
cover this scenario.

(cherry picked from commit f17204191d3bb2201e6b6b1c4cf2e7a96148e8cd)
src/output-json-stats.c
src/tests/output-json-stats.c