Skip to content

fix(metricbeat): report correct number of entries in conntrack metricset#46140

Merged
mauri870 merged 5 commits intoelastic:mainfrom
mauri870:conntrack-entries
Aug 26, 2025
Merged

fix(metricbeat): report correct number of entries in conntrack metricset#46140
mauri870 merged 5 commits intoelastic:mainfrom
mauri870:conntrack-entries

Conversation

@mauri870
Copy link
Member

@mauri870 mauri870 commented Aug 21, 2025

Proposed commit message

The conntrack metricset was summing the entries value across all CPUs, but this field is identical on each line of /proc/net/stat/nf_conntrack. As a result, the reported count was inflated by a factor of the number of CPU cores.

This fixes the issue by reading the entries value only once.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@mauri870 mauri870 self-assigned this Aug 21, 2025
@mauri870 mauri870 added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team bugfix labels Aug 21, 2025
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Aug 21, 2025
@github-actions
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Contributor

mergify bot commented Aug 21, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @mauri870? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.
@mauri870 mauri870 added backport-active-8 Automated backport with mergify to all the active 8.[0-9]+ branches backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches labels Aug 21, 2025
@mauri870 mauri870 marked this pull request as ready for review August 21, 2025 14:43
@mauri870 mauri870 requested a review from a team as a code owner August 21, 2025 14:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@mergify
Copy link
Contributor

mergify bot commented Aug 22, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b conntrack-entries upstream/conntrack-entries
git merge upstream/main
git push upstream conntrack-entries
@mauri870
Copy link
Member Author

@andrzej-stencel @faec Quick reminder for review when you have a moment.

@mauri870 mauri870 merged commit b93bb0c into elastic:main Aug 26, 2025
51 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport 8.17 8.18 8.19 9.0 9.1

mergify bot pushed a commit that referenced this pull request Aug 26, 2025
…set (#46140)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)
mergify bot pushed a commit that referenced this pull request Aug 26, 2025
…set (#46140)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)
mergify bot pushed a commit that referenced this pull request Aug 26, 2025
…set (#46140)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)
mergify bot pushed a commit that referenced this pull request Aug 26, 2025
…set (#46140)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)
mergify bot pushed a commit that referenced this pull request Aug 26, 2025
…set (#46140)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)
mauri870 added a commit that referenced this pull request Aug 26, 2025
…set (#46140) (#46236)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Aug 26, 2025
…set (#46140) (#46238)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Aug 26, 2025
…ries in conntrack metricset (#46235)

* fix(metricbeat): report correct number of entries in conntrack metricset (#46140)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)

* remove unrelated changelog entries

---------

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Aug 26, 2025
…set (#46140) (#46237)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Aug 26, 2025
…set (#46140) (#46239)

* fix(metricbeat): report correct number of entries in conntrack metricset

* adjust changelog

* better wording

* ignore errcheck in test

(cherry picked from commit b93bb0c)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-8 Automated backport with mergify to all the active 8.[0-9]+ branches backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches bugfix Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

3 participants