From d9aa164cd3891fd6d1ab633b79b0005a1cd7da98 Mon Sep 17 00:00:00 2001 From: Aashish Sharma Date: Fri, 6 Dec 2024 15:27:25 +0530 Subject: [PATCH] mgr/dashboard: Fix Latency chart data units in rgw overview page Issue: The Latency chart in the rgw overview page shows incorrect data unit as the unit that we are passing as an input to the dashboard-area chart component is `ms` whereas the data that we get from the metrics is in seconds. Due to this if we pass a value like 0.725s to the dashboard chart component it will show the value in the chart as 0.725ms whereas it should be 725ms. Fix: Pass the value in ms as expected to the dashboard area chart component Fixes: https://tracker.ceph.com/issues/69144 Signed-off-by: Aashish Sharma --- .../rgw-overview-dashboard.component.html | 1 + .../frontend/src/app/shared/api/prometheus.service.ts | 8 +++----- .../src/app/shared/enum/dashboard-promqls.enum.ts | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.html index 3a9ce12df9d..16963b06920 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.html @@ -60,6 +60,7 @@ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts index 317293be07c..fedc7b8de0f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts @@ -163,11 +163,9 @@ export class PrometheusService { checkNan ) { queriesResults[queryName].forEach((valueArray: any[]) => { - valueArray.forEach((val, index) => { - if (isNaN(parseFloat(val[1]))) { - valueArray[index][1] = '0'; - } - }); + if (isNaN(parseFloat(valueArray[1]))) { + valueArray[1] = '0'; + } }); } }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/dashboard-promqls.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/dashboard-promqls.enum.ts index 361a404a11b..f1bbebed51d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/dashboard-promqls.enum.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/dashboard-promqls.enum.ts @@ -11,8 +11,8 @@ export enum Promqls { export enum RgwPromqls { RGW_REQUEST_PER_SECOND = 'sum(rate(ceph_rgw_req[1m]))', - AVG_GET_LATENCY = 'sum(rate(ceph_rgw_op_get_obj_lat_sum[1m])) / sum(rate(ceph_rgw_op_get_obj_lat_count[1m]))', - AVG_PUT_LATENCY = 'sum(rate(ceph_rgw_op_put_obj_lat_sum[1m])) / sum(rate(ceph_rgw_op_put_obj_lat_count[1m]))', + AVG_GET_LATENCY = '(sum(rate(ceph_rgw_op_get_obj_lat_sum[1m])) / sum(rate(ceph_rgw_op_get_obj_lat_count[1m]))) * 1000', + AVG_PUT_LATENCY = '(sum(rate(ceph_rgw_op_put_obj_lat_sum[1m])) / sum(rate(ceph_rgw_op_put_obj_lat_count[1m]))) * 1000', GET_BANDWIDTH = 'sum(rate(ceph_rgw_op_get_obj_bytes[1m]))', PUT_BANDWIDTH = 'sum(rate(ceph_rgw_op_put_obj_bytes[1m]))' } -- 2.39.5