mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
Remove metrics and and settings and correct measurements
This commit is contained in:
parent
5fd98995b0
commit
fdb0478889
@ -37,24 +37,28 @@ const MetricCharts = ({
|
|||||||
type,
|
type,
|
||||||
uuid
|
uuid
|
||||||
}, index) => {
|
}, index) => {
|
||||||
const onSelectChange = (evt) =>
|
const handleSelectChange = (evt) => {};
|
||||||
onDurationChange(Number(evt.target.value), uuid);
|
// onDurationChange(Number(evt.target.value), uuid);
|
||||||
|
const handleSettingsClick = (evt) => {};
|
||||||
|
const handleRemoveMetric = (evt) => {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MetricView key={type.id}>
|
<MetricView key={type.id}>
|
||||||
<MetricHeader>
|
<MetricHeader>
|
||||||
<MetricTitle>
|
<MetricTitle>
|
||||||
<FormattedMessage id={`metrics.${type.id}.title`} />
|
{type.name}
|
||||||
|
{/*<FormattedMessage id={`metrics.${type.id}.title`} />*/}
|
||||||
</MetricTitle>
|
</MetricTitle>
|
||||||
<MetricSelect onChange={onSelectChange} value={String(duration)}>
|
<MetricSelect onChange={handleSelectChange} value={String(duration)}>
|
||||||
{optionList}
|
{optionList}
|
||||||
</MetricSelect>
|
</MetricSelect>
|
||||||
<MetricSettingsButton onClick={onSettingsClick}>
|
<MetricSettingsButton onClick={handleSettingsClick}>
|
||||||
<FormattedMessage id={'metrics.metric.settings-label'} />
|
<FormattedMessage id={'metrics.metric.settings-label'} />
|
||||||
</MetricSettingsButton>
|
</MetricSettingsButton>
|
||||||
<MetricCloseButton onClick={onRemoveMetric} />
|
<MetricCloseButton onClick={handleRemoveMetric} />
|
||||||
</MetricHeader>
|
</MetricHeader>
|
||||||
<MetricGraph
|
<MetricGraph
|
||||||
|
axes
|
||||||
data={data}
|
data={data}
|
||||||
duration={duration}
|
duration={duration}
|
||||||
yMax={type.max}
|
yMax={type.max}
|
||||||
|
@ -2,13 +2,13 @@ import React from 'react';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { toggleMonitorView } from '@state/actions';
|
import { toggleMonitorView } from '@state/actions';
|
||||||
import AddMetrics from '@root/components/metric-charts/add-metrics';
|
// import AddMetrics from '@root/components/metric-charts/add-metrics';
|
||||||
import Button from '@ui/components/button';
|
// import Button from '@ui/components/button';
|
||||||
import Column from '@ui/components/column';
|
// import Column from '@ui/components/column';
|
||||||
import MetricCharts from '@root/components/metric-charts';
|
import MetricCharts from '@root/components/metric-charts';
|
||||||
import Monitors from './monitors';
|
// import Monitors from './monitors';
|
||||||
import PropTypes from '@root/prop-types';
|
import PropTypes from '@root/prop-types';
|
||||||
import Row from '@ui/components/row';
|
// import Row from '@ui/components/row';
|
||||||
|
|
||||||
const Metrics = ({
|
const Metrics = ({
|
||||||
addMetric,
|
addMetric,
|
||||||
@ -24,6 +24,15 @@ const Metrics = ({
|
|||||||
const onRemoveMetric = (ev) => null;
|
const onRemoveMetric = (ev) => null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<MetricCharts
|
||||||
|
datasets={datasets}
|
||||||
|
onDurationChange={metricDurationChange}
|
||||||
|
onRemoveMetric={onRemoveMetric}
|
||||||
|
onSettingsClick={onMonitorsClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
/*return (
|
||||||
<div>
|
<div>
|
||||||
<Row reverse>
|
<Row reverse>
|
||||||
<Column>
|
<Column>
|
||||||
@ -43,7 +52,7 @@ const Metrics = ({
|
|||||||
onAddMetric={addMetric}
|
onAddMetric={addMetric}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);*/
|
||||||
};
|
};
|
||||||
|
|
||||||
Metrics.propTypes = {
|
Metrics.propTypes = {
|
||||||
|
@ -70,16 +70,26 @@ const getDataset = (twoHourLongDatasets, uuid) => {
|
|||||||
return twoHourLongDatasets.process_cpu_seconds_total;
|
return twoHourLongDatasets.process_cpu_seconds_total;
|
||||||
}
|
}
|
||||||
if(isDisk(uuid)) {
|
if(isDisk(uuid)) {
|
||||||
return twoHourLongDatasets.process_heap_bytes;
|
return twoHourLongDatasets.process_heap_bytes.map((sample) =>
|
||||||
|
[
|
||||||
|
sample[0],
|
||||||
|
sample[1]/1024/1024
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if(isMemory(uuid)) {
|
if(isMemory(uuid)) {
|
||||||
return twoHourLongDatasets.node_memory_heap_used_bytes;
|
return twoHourLongDatasets.node_memory_heap_used_bytes.map((sample) =>
|
||||||
|
[
|
||||||
|
sample[0],
|
||||||
|
sample[1]/1024/1024
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const datasets = MockState.metrics.data.datasets.map((dataset, index) => {
|
const datasets = MockState.metrics.data.datasets.map((dataset, index) => {
|
||||||
|
|
||||||
const data = isCrazy(dataset.uuid) ?
|
const data = isCrazy(dataset.uuid) && dataset.uuid !== 'crazy-cpu' ?
|
||||||
getDataset(leakTwoHourLongDatasets, dataset.uuid) :
|
getDataset(leakTwoHourLongDatasets, dataset.uuid) :
|
||||||
getDataset(normalTwoHourLongDatasets, dataset.uuid);
|
getDataset(normalTwoHourLongDatasets, dataset.uuid);
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
"id": "cpu-wait-time",
|
"id": "cpu-wait-time",
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 100,
|
"max": 100,
|
||||||
"measurement": "%"
|
"measurement": "bytes"
|
||||||
}, {
|
}, {
|
||||||
"uuid": "dca08514-72e5-46ce-ad91-e68b3b0914d7",
|
"uuid": "dca08514-72e5-46ce-ad91-e68b3b0914d7",
|
||||||
"name": "Zfs used",
|
"name": "Zfs used",
|
||||||
@ -96,14 +96,14 @@
|
|||||||
"id": "load-average",
|
"id": "load-average",
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 20,
|
"max": 20,
|
||||||
"measurement": "kb"
|
"measurement": " Mb"
|
||||||
}, {
|
}, {
|
||||||
"uuid": "dca08514-72e5-46ce-ad92-e68b3b0914d4",
|
"uuid": "dca08514-72e5-46ce-ad92-e68b3b0914d4",
|
||||||
"name": "Memory",
|
"name": "Memory",
|
||||||
"id": "mem-agg-usage",
|
"id": "mem-agg-usage",
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 100,
|
"max": 100,
|
||||||
"measurement": "%"
|
"measurement": " Mb"
|
||||||
}, {
|
}, {
|
||||||
"uuid": "dca08514-72e5-46ce-ad93-e68b3b0914d4",
|
"uuid": "dca08514-72e5-46ce-ad93-e68b3b0914d4",
|
||||||
"name": "Memory limit",
|
"name": "Memory limit",
|
||||||
|
@ -232,10 +232,16 @@ const metricByInterval = (data = [], {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TMP - get min and max for total data - START
|
// TMP - get min and max for total data - START
|
||||||
const getMinMax = (data) => {
|
const getMinMax = (data, measurement) => {
|
||||||
|
if(measurement === '%') {
|
||||||
|
return {
|
||||||
|
min: 0,
|
||||||
|
max: 100
|
||||||
|
};
|
||||||
|
}
|
||||||
const values = data.map((d) => Number(d[1]));
|
const values = data.map((d) => Number(d[1]));
|
||||||
const min = statistics.min(values);
|
const min = Math.floor(statistics.min(values));
|
||||||
const max = statistics.max(values);
|
const max = Math.ceil(statistics.max(values));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
min,
|
min,
|
||||||
@ -272,12 +278,13 @@ const datasets = (
|
|||||||
) =>
|
) =>
|
||||||
serviceOrInstanceMetrics.map((soim) => {
|
serviceOrInstanceMetrics.map((soim) => {
|
||||||
const dataset = find(metricsData.datasets, ['uuid', soim.dataset]);
|
const dataset = find(metricsData.datasets, ['uuid', soim.dataset]);
|
||||||
|
const type = find(metricsData.types, ['uuid', soim.type]);
|
||||||
const dataSubset = getDataSubset(dataset.data, metricsUI, metricOptions);
|
const dataSubset = getDataSubset(dataset.data, metricsUI, metricOptions);
|
||||||
const minMax = getMinMax(dataset.data);
|
const minMax = getMinMax(dataset.data, type.measurement);
|
||||||
return ({
|
return ({
|
||||||
...dataset,
|
...dataset,
|
||||||
data: metricByInterval(dataSubset, minMax, metricOptions),
|
data: metricByInterval(dataSubset, minMax, metricOptions),
|
||||||
type: find(metricsData.types, ['uuid', soim.type]),
|
type: type,
|
||||||
...metricsUI[soim.dataset]
|
...metricsUI[soim.dataset]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user