Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.0.x backport: Fix stats missing for non workers #10742

Closed
wants to merge 2 commits into from

Conversation

jlucovsky
Copy link
Contributor

@jlucovsky jlucovsky commented Mar 31, 2024

Continuation of #10717

7.0.x backport of #10583

Follow up for: https://redmine.openinfosecfoundation.org/issues/6907
Describe changes:

Commit b8b8aa6 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.

Update:

  • Associated with newly created issue 6907 (was 6746 -- already closed)

Provide values to any of the below to override the defaults.

To use a pull request use a branch name like pr/N where N is the
pull request number.

Alternatively, SV_BRANCH may also be a link to an
OISF/suricata-verify pull-request.

SV_BRANCH=pr/1686

Commit b8b8aa6 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 f172041)
New suricata-verify test listens on loopback interface, resulting
in the capture and in_iface fields in the stats and event objects.

(cherry picked from commit f9cf87a)
Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 91.52542% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 82.95%. Comparing base (80d2c6e) to head (41c94b7).

Additional details and impacted files
@@              Coverage Diff               @@
##           main-7.0.x   #10742      +/-   ##
==============================================
+ Coverage       82.51%   82.95%   +0.43%     
==============================================
  Files             976      976              
  Lines          275061   275110      +49     
==============================================
+ Hits           226979   228212    +1233     
+ Misses          48082    46898    -1184     
Flag Coverage Δ
fuzzcorpus 63.66% <0.00%> (-0.15%) ⬇️
suricata-verify 62.60% <81.25%> (+0.93%) ⬆️
unittests 62.91% <91.52%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information:

ERROR: QA failed on SURI_TLPW2_autofp_suri_time.

field baseline test %
SURI_TLPW2_autofp_stats_chk
.uptime 139 148 106.47%

Pipeline 19894

@catenacyber
Copy link
Contributor

Oops, this did not run SV BRANCH=pr/1686

expected an underscore instead of a space

cf https://github.com/OISF/suricata/actions/runs/8498850137/job/23279007982?pr=10742

Run # Looking for a pull request number. in the SV_BRANCH
Using suricata-verify branch master

@jufajardini
Copy link
Contributor

Oops, this did not run SV BRANCH=pr/1686

expected an underscore instead of a space

cf https://github.com/OISF/suricata/actions/runs/8498850137/job/23279007982?pr=10742

Run # Looking for a pull request number. in the SV_BRANCH
Using suricata-verify branch master

Re-run it to use the right sv PR.

@@ -23,7 +23,7 @@

static int OutputJsonStatsTest01(void)
{
StatsRecord global_records[] = { { 0 }, { 0 } };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing for convention with the terms/names used in OutputJsonStatsTest02

Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest a rebase to get green CI and use of the right SV PR from the start

@jlucovsky
Copy link
Contributor Author

Continued in #10848

@jlucovsky jlucovsky closed this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants