fix: Fix for compute node status & "observable" big array data
1. fix for compute node status 2. fix for observable big array data in monitor Change-Id: If6946246a8ffe8bbc6a880f0150658a436884613
This commit is contained in:
parent
be17f40d2c
commit
1834f92c8a
@ -52,7 +52,6 @@ const metricDict = {
|
||||
service: 'nova-compute',
|
||||
},
|
||||
],
|
||||
finalFormatFunc: [(url) => `sum(${url})by(services_state)`],
|
||||
},
|
||||
topHostCPUUsage: {
|
||||
url: ['node_cpu_seconds_total'],
|
||||
|
@ -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'],
|
||||
|
@ -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,11 +46,9 @@ const ClusterChart = observer((props) => {
|
||||
metricKey: 'monitorOverview.computeNodeStatus',
|
||||
},
|
||||
renderContent: (store) => (
|
||||
<div className={styles.topContent}>
|
||||
<div style={{ height: 218 }}>
|
||||
<CircleChart data={store.data} />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
visibleHeight: 230,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user