Skip to content

Commit

Permalink
Merge pull request ceph#59891 from rhcs-dashboard/fix-68162-main
Browse files Browse the repository at this point in the history
mgr/dashboard: fix handling NaN values in dashboard charts

Reviewed-by: Nizamudeen A <[email protected]>
  • Loading branch information
aaSharma14 authored Sep 24, 2024
2 parents 25734ec + 49ee682 commit cbbddfd
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export class PrometheusService {
}
this.timerGetPrometheusDataSub = timer(0, this.timerTime).subscribe(() => {
selectedTime = this.updateTimeStamp(selectedTime);

for (const queryName in queries) {
if (queries.hasOwnProperty(queryName)) {
const query = queries[queryName];
Expand All @@ -163,13 +162,12 @@ export class PrometheusService {
queriesResults[queryName] !== '' &&
checkNan
) {
queriesResults[queryName].forEach((valueArray: string[]) => {
if (valueArray.includes('NaN')) {
const index = valueArray.indexOf('NaN');
if (index !== -1) {
valueArray[index] = '0';
queriesResults[queryName].forEach((valueArray: any[]) => {
valueArray.forEach((val, index) => {
if (isNaN(parseFloat(val[1]))) {
valueArray[index][1] = '0';
}
}
});
});
}
});
Expand Down

0 comments on commit cbbddfd

Please sign in to comment.