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

metrics: Do not return when we cannot find a _stats map #1949

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

tpapagian
Copy link
Member

@tpapagian tpapagian commented Jan 9, 2024

In Tetragon, we have maps ending with _stats that contain metadata about the main maps. An example is that we have execve_map and execve_map_stats that contain errors and other information related to the execve_map map.

Now when we fail to open the _stats map, we just stop the loop and we can possibly miss to check for other maps. This patch changes that and tries for the next map.

Additionally, we do not try to collect stats for maps that already end up with _stats as this would result in _stats_stats map names.

@tpapagian tpapagian requested a review from a team as a code owner January 9, 2024 11:18
@tpapagian tpapagian requested a review from kevsecurity January 9, 2024 11:18
@tpapagian tpapagian added release-note/minor This PR introduces a minor user-visible change area/metrics Related to prometheus metrics labels Jan 9, 2024
@kkourt kkourt mentioned this pull request Jan 9, 2024
6 tasks
Copy link
Member

@tixxdz tixxdz left a comment

Choose a reason for hiding this comment

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

Thanks @tpapagian , maybe some log warn only once if the final loadPinnedMap() fails? or maybe doesn't make that much sense ;-)

BTW for issue #1775 there is still that (3) rename map, should be moved to separate issue? so it is not lost.

In Tetragon, we have maps ending with _stats that contain metadata about
the main maps. An example is that we have execve_map and
execve_map_stats that contains errors and other information related to
execve_map map.

Now when we fail to open the _stats map, we just stop the loop and we
can possibly miss to check for other maps. This patch change that and
tries for the next map.

Additionally we do not try to collect stats for maps that already end up
with _stats as this would result in _stats_stats map names.

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
@tpapagian tpapagian force-pushed the pr/apapag/fix_map_metrics branch from 8b7b418 to 2c6a42e Compare January 9, 2024 14:06
@tpapagian
Copy link
Member Author

Thanks @tpapagian , maybe some log warn only once if the final loadPinnedMap() fails? or maybe doesn't make that much sense ;-)

Thanks! Yes, it makes sense. If we see any of these warning we have to fix that. I added a warning there.

BTW for issue #1775 there is still that (3) rename map, should be moved to separate issue? so it is not lost.

OK, I will post a comment to that issue that (1, 2) are fixed by this PR. So I will not close that.

@tpapagian tpapagian merged commit c2e13ac into main Jan 10, 2024
30 checks passed
@tpapagian tpapagian deleted the pr/apapag/fix_map_metrics branch January 10, 2024 07:49
@lambdanis lambdanis added release-note/bug This PR fixes an issue in a previous release of Tetragon. and removed release-note/minor This PR introduces a minor user-visible change labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Related to prometheus metrics release-note/bug This PR fixes an issue in a previous release of Tetragon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants