Skip to content

Commit

Permalink
mgr/dashboard: fix handling NaN values in dashboard charts
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/68162

Signed-off-by: Aashish Sharma <[email protected]>
  • Loading branch information
Aashish Sharma committed Sep 23, 2024
1 parent cadfc96 commit 49ee682
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 49ee682

Please sign in to comment.