Skip to content

pkg:observer: during stats printing check if total events is not zero#914

Merged
kkourt merged 1 commit into
mainfrom
pr/tixxdz/fix-zero-received-pkts
Apr 12, 2023
Merged

pkg:observer: during stats printing check if total events is not zero#914
kkourt merged 1 commit into
mainfrom
pr/tixxdz/fix-zero-received-pkts

Conversation

@tixxdz

@tixxdz tixxdz commented Apr 11, 2023

Copy link
Copy Markdown
Member

Check if the total events is not zero before printing stats, right now we fail to do so, which will produce an NaN on division by zero.

This happens only if tetragon starts and finish before capturing any event, which rarely happens in practice. Plus today's systems seems to not trap on floating point division by zero.

Signed-off-by: Djalal Harouni tixxdz@gmail.com

Check if the total events is not zero before printing stats, right now
we fail to do so, which will produce an NaN on division by zero.

This happens only if tetragon starts and finish before capturing any
event, which rarely happens in practice. Plus today's systems seems to
not trap on floating point division by zero.

Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
@tixxdz
tixxdz requested a review from a team as a code owner April 11, 2023 23:01
@tixxdz
tixxdz requested review from jrfastab and mtardy April 11, 2023 23:01
@kkourt
kkourt merged commit 261bca6 into main Apr 12, 2023
@kkourt
kkourt deleted the pr/tixxdz/fix-zero-received-pkts branch April 12, 2023 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants