Skip to content

Guard against NaN for double type metrics - #2618

Merged
srkukarni merged 2 commits into
apache:masterfrom
aahmed-se:double_check_1
Sep 24, 2018
Merged

srkukarni merged 2 commits into
apache:masterfrom
aahmed-se:double_check_1

Conversation

@aahmed-se

Copy link
Copy Markdown
Contributor

We check for Nan values and convert them to 0.0 for metric aggregations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why change this file?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

make a util function for that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

better to have a util function

double getFiniteValue(double value, double defaultValue) {
    return Double.isFinite(value) ? value : defaultValue;
}

so you can call Double.toString(getFiniteValue(realtimeCpuLoadFactor, 0.0)); and this util function can be reused

@aahmed-se

Copy link
Copy Markdown
Contributor Author

added utility method

@aahmed-se
aahmed-se force-pushed the double_check_1 branch 3 times, most recently from 3be28d9 to 9d6457a Compare September 20, 2018 19:00
@merlimat

Copy link
Copy Markdown
Contributor

rerun tests please

@merlimat

Copy link
Copy Markdown
Contributor

run cpp tests
run java8 tests
run integration tests

@sijie

sijie commented Sep 21, 2018

Copy link
Copy Markdown
Member

retest this please

@aahmed-se

Copy link
Copy Markdown
Contributor Author

run cpp tests
run java8 tests

@aahmed-se

Copy link
Copy Markdown
Contributor Author

run java8 tests

1 similar comment
@aahmed-se

Copy link
Copy Markdown
Contributor Author

run java8 tests

@aahmed-se

Copy link
Copy Markdown
Contributor Author

retest this please

@srkukarni
srkukarni merged commit a911890 into apache:master Sep 24, 2018
@aahmed-se
aahmed-se deleted the double_check_1 branch September 24, 2018 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants