diff --git a/src/components/PrometheusChart/metricDict.js b/src/components/PrometheusChart/metricDict.js index 8285c44d..e353d013 100644 --- a/src/components/PrometheusChart/metricDict.js +++ b/src/components/PrometheusChart/metricDict.js @@ -52,7 +52,6 @@ const metricDict = { service: 'nova-compute', }, ], - finalFormatFunc: [(url) => `sum(${url})by(services_state)`], }, topHostCPUUsage: { url: ['node_cpu_seconds_total'], diff --git a/src/components/PrometheusChart/store/FetchPrometheusStore.js b/src/components/PrometheusChart/store/FetchPrometheusStore.js index 53e800ad..1876b963 100644 --- a/src/components/PrometheusChart/store/FetchPrometheusStore.js +++ b/src/components/PrometheusChart/store/FetchPrometheusStore.js @@ -89,16 +89,21 @@ export default class FetchPrometheusStore { } formatData(data) { - this.data = this.formatDataFn( + const formatedData = this.formatDataFn( data, this.typeKey, this.deviceKey, this.modifyKeys ); - if (isArray(this.data) && this.data.length !== 0 && this.data[0].device) { + this.data = [...formatedData]; + if ( + isArray(formatedData) && + formatedData.length !== 0 && + formatedData[0].device + ) { const dv = new DataSet() .createView() - .source(this.data) + .source(formatedData) .transform({ type: 'partition', groupBy: ['device'], diff --git a/src/pages/monitor/containers/Overview/components/ClusterMonitor/ClusterChart.jsx b/src/pages/monitor/containers/Overview/components/ClusterMonitor/ClusterChart.jsx index b4c55bf5..8bccd394 100644 --- a/src/pages/monitor/containers/Overview/components/ClusterMonitor/ClusterChart.jsx +++ b/src/pages/monitor/containers/Overview/components/ClusterMonitor/ClusterChart.jsx @@ -13,7 +13,6 @@ // limitations under the License. import React from 'react'; -import styles from 'pages/monitor/containers/Overview/index.less'; import { observer } from 'mobx-react'; import CircleChart from 'components/PrometheusChart/CircleWithRightLegend'; import { get } from 'lodash'; @@ -39,7 +38,7 @@ const ClusterChart = observer((props) => { ]; const result = get(responses[0], 'data.result', []); result.forEach((sta) => { - const idx = sta.metric.services_state === 'up' ? 0 : 1; + const idx = sta.metric.adminState === 'enabled' ? 0 : 1; status[idx].value += parseInt(sta.value[1], 10); }); return status; @@ -47,10 +46,8 @@ const ClusterChart = observer((props) => { metricKey: 'monitorOverview.computeNodeStatus', }, renderContent: (store) => ( -
-
- -
+
+
), visibleHeight: 230,