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',
|
service: 'nova-compute',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
finalFormatFunc: [(url) => `sum(${url})by(services_state)`],
|
|
||||||
},
|
},
|
||||||
topHostCPUUsage: {
|
topHostCPUUsage: {
|
||||||
url: ['node_cpu_seconds_total'],
|
url: ['node_cpu_seconds_total'],
|
||||||
|
@ -89,16 +89,21 @@ export default class FetchPrometheusStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
formatData(data) {
|
formatData(data) {
|
||||||
this.data = this.formatDataFn(
|
const formatedData = this.formatDataFn(
|
||||||
data,
|
data,
|
||||||
this.typeKey,
|
this.typeKey,
|
||||||
this.deviceKey,
|
this.deviceKey,
|
||||||
this.modifyKeys
|
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()
|
const dv = new DataSet()
|
||||||
.createView()
|
.createView()
|
||||||
.source(this.data)
|
.source(formatedData)
|
||||||
.transform({
|
.transform({
|
||||||
type: 'partition',
|
type: 'partition',
|
||||||
groupBy: ['device'],
|
groupBy: ['device'],
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styles from 'pages/monitor/containers/Overview/index.less';
|
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import CircleChart from 'components/PrometheusChart/CircleWithRightLegend';
|
import CircleChart from 'components/PrometheusChart/CircleWithRightLegend';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
@ -39,7 +38,7 @@ const ClusterChart = observer((props) => {
|
|||||||
];
|
];
|
||||||
const result = get(responses[0], 'data.result', []);
|
const result = get(responses[0], 'data.result', []);
|
||||||
result.forEach((sta) => {
|
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);
|
status[idx].value += parseInt(sta.value[1], 10);
|
||||||
});
|
});
|
||||||
return status;
|
return status;
|
||||||
@ -47,10 +46,8 @@ const ClusterChart = observer((props) => {
|
|||||||
metricKey: 'monitorOverview.computeNodeStatus',
|
metricKey: 'monitorOverview.computeNodeStatus',
|
||||||
},
|
},
|
||||||
renderContent: (store) => (
|
renderContent: (store) => (
|
||||||
<div className={styles.topContent}>
|
<div style={{ height: 218 }}>
|
||||||
<div style={{ height: 218 }}>
|
<CircleChart data={store.data} />
|
||||||
<CircleChart data={store.data} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
visibleHeight: 230,
|
visibleHeight: 230,
|
||||||
|
Loading…
Reference in New Issue
Block a user