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

Reject infinite performance data values #10077

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RincewindsHat
Copy link
Member

Some fault monitoring plugins may return "inf" or "-inf" as values due to a failure to initialize or other errors.

This patch introduces a check on whether the parse value is infinite (or negative infinite) and rejects the data point if that is the case.

The reasoning here is: There is no possible way a value of "inf" is ever a true measuring or even useful. Furthermore, when passed to the performance data writers, it may be rejected by the backend and lead to further complications.

fixes #10073

@cla-bot cla-bot bot added the cla/signed label Jun 9, 2024
@@ -259,6 +259,10 @@ PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata)

double value = Convert::ToDouble(tokens[0].SubStr(0, pos));

if (value == INFINITY || value == - INFINITY) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are special functions for such checks like std::isinf(). A related function like std::isfinite() or std::isnormal() might be even better suited here as it excludes more edge cases (I haven't checked if subnormal numbers would be a problem, that seems to be the only difference between these two functions).

Copy link
Member Author

Choose a reason for hiding this comment

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

Please excuse my C. Those functions do seem more appropriate and sane to use.
I will change that accordingly. Thank you for the tip

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Some fault monitoring plugins may return "inf" or "-inf" as
values due to a failure to initialize or other errors.

This patch introduces a check on whether the parse value is infinite
(or negative infinite) and rejects the data point if that is the case.

The reasoning here is: There is no possible way a value of "inf" is ever
a true measuring or even useful. Furthermore, when passed to the
performance data writers, it may be rejected by the backend and lead
to further complications.
@RincewindsHat
Copy link
Member Author

@julianbrost should be fine now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance data values parsing problem: inf, -inf
2 participants