Skip to content

Bug 1427360 - Correctly handle 0 values in MetricsService #1312

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

Merged
merged 1 commit into from
Mar 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/scripts/services/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ angular.module("openshiftConsole")

_.each(data, function(point) {
// Set point.value to the average or null if no average.
if (!point.value || point.value === "NaN") {
var avg = point.avg;
point.value = (avg && avg !== "NaN") ? avg : null;
if (point.empty || !_.isNumber(point.avg)) {
Copy link
Member Author

@spadgett spadgett Mar 1, 2017

Choose a reason for hiding this comment

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

@jwforres point.value is never set by Hawkular (for requests using buckets), so I removed this check.

Copy link
Member Author

Choose a reason for hiding this comment

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

point.value = null;
} else {
point.value = point.avg;
}
});

Expand Down
5 changes: 1 addition & 4 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2938,10 +2938,7 @@ return k = (a || "").replace(/\/$/, "");
}
function g(a) {
if (a.length) return _.each(a, function(a) {
if (!a.value || "NaN" === a.value) {
var b = a.avg;
a.value = b && "NaN" !== b ? b :null;
}
a.empty || !_.isNumber(a.avg) ? a.value = null :a.value = a.avg;
}), a;
}
function h(a) {
Expand Down