mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Infra] Legacy metrics changes (#189974)
Closes #189628 Closes #190118 ## Summary This PR changes the way we show the legacy metrics. It changes the hosts table `rx` and `tx` values to use the `v2` and renames `availablefieldsOptions` to `availableFieldsOptions` It covers `1.` and `2.` from this [comment](https://github.com/elastic/kibana/pull/189261#pullrequestreview-2223770001) ## Testing: Legacy metrics changes in inventory https://github.com/user-attachments/assets/d2a74b0f-8a63-49f2-8d4b-e9c738440609 The legacy metrics are currently visible only for hosts so in other asset types they should not be visible (Inventory + Alerts) <img width="1624" alt="Screenshot 2024-08-06 at 14 34 49" src="https://github.com/user-attachments/assets/b24df6b1-5a0d-4a01-ac88-412a419c5d6c"> Alert rules creation and metrics drop-down (with/without legacy metric) https://github.com/user-attachments/assets/a403c96a-764d-4451-b370-e05a9ae1c5b4 On the Alerts page when creating a rule the default metric is CPU Usage (not the legacy one):  Align CPU usage (Legacy) label and position with RX / TX metrics: <img width="1415" alt="image" src="https://github.com/user-attachments/assets/2ce9269e-6f88-47ca-b76c-105f1daab152">
This commit is contained in:
parent
c53cb3c06e
commit
fe592d4f3b
29 changed files with 139 additions and 75 deletions
|
@ -29,7 +29,7 @@ export const METRIC_FORMATTERS: MetricFormatters = {
|
|||
formatter: InfraFormatterType.percent,
|
||||
template: '{{value}}',
|
||||
},
|
||||
['cpuTotal']: {
|
||||
['cpuV2']: {
|
||||
formatter: InfraFormatterType.percent,
|
||||
template: '{{value}}',
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as rt from 'io-ts';
|
|||
|
||||
export const InfraMetricTypeRT = rt.keyof({
|
||||
cpu: null,
|
||||
cpuTotal: null,
|
||||
cpuV2: null,
|
||||
normalizedLoad1m: null,
|
||||
diskSpaceUsage: null,
|
||||
memory: null,
|
||||
|
|
|
@ -18,7 +18,7 @@ export const staticInventoryViewAttributes: InventoryViewAttributes = {
|
|||
isDefault: false,
|
||||
isStatic: true,
|
||||
metric: {
|
||||
type: 'cpuTotal',
|
||||
type: 'cpuV2',
|
||||
},
|
||||
groupBy: [],
|
||||
nodeType: 'host',
|
||||
|
|
|
@ -17,7 +17,7 @@ const TranslationsLowercase = {
|
|||
}),
|
||||
|
||||
CPUUsageLegacy: i18n.translate('xpack.infra.waffle.metricOptions.cpuUsageLegacyText', {
|
||||
defaultMessage: 'CPU usage (legacy)',
|
||||
defaultMessage: 'CPU usage (Legacy)',
|
||||
}),
|
||||
|
||||
MemoryUsage: i18n.translate('xpack.infra.waffle.metricOptions.memoryUsageText', {
|
||||
|
@ -113,16 +113,18 @@ export const toMetricOpt = (
|
|||
nodeType?: InventoryItemType
|
||||
): { text: string; textLC: string; value: SnapshotMetricType } | undefined => {
|
||||
switch (metric) {
|
||||
case 'cpuTotal':
|
||||
case 'cpuV2':
|
||||
return {
|
||||
text: Translations.CPUUsageTotal,
|
||||
textLC: TranslationsLowercase.CPUUsageTotal,
|
||||
value: 'cpuTotal',
|
||||
value: 'cpuV2',
|
||||
};
|
||||
case 'cpu':
|
||||
return {
|
||||
text: Translations.CPUUsageLegacy,
|
||||
textLC: TranslationsLowercase.CPUUsageLegacy,
|
||||
text: showLegacyLabel(nodeType) ? Translations.CPUUsageLegacy : Translations.CPUUsageTotal,
|
||||
textLC: showLegacyLabel(nodeType)
|
||||
? TranslationsLowercase.CPUUsageLegacy
|
||||
: TranslationsLowercase.CPUUsageTotal,
|
||||
value: 'cpu',
|
||||
};
|
||||
case 'memory':
|
||||
|
|
|
@ -128,7 +128,7 @@ describe('Expression', () => {
|
|||
const ruleParams = {
|
||||
criteria: [
|
||||
{
|
||||
metric: 'cpu',
|
||||
metric: 'cpuV2',
|
||||
timeSize: 1,
|
||||
timeUnit: 'm',
|
||||
threshold: [10],
|
||||
|
|
|
@ -105,7 +105,7 @@ type Props = Omit<
|
|||
>;
|
||||
|
||||
export const defaultExpression = {
|
||||
metric: 'cpu' as SnapshotMetricType,
|
||||
metric: 'cpuV2' as SnapshotMetricType,
|
||||
comparator: COMPARATORS.GREATER_THAN,
|
||||
threshold: [],
|
||||
timeSize: 1,
|
||||
|
@ -772,7 +772,7 @@ export const nodeTypes: { [key: string]: any } = {
|
|||
const metricUnit: Record<string, { label: string }> = {
|
||||
count: { label: '' },
|
||||
cpu: { label: '%' },
|
||||
cpuTotal: { label: '%' },
|
||||
cpuV2: { label: '%' },
|
||||
memory: { label: '%' },
|
||||
rx: { label: 'bits/s' },
|
||||
tx: { label: 'bits/s' },
|
||||
|
|
|
@ -231,8 +231,10 @@ const convertMetricValue = (metric: SnapshotMetricType, value: number) => {
|
|||
};
|
||||
const converters: Record<string, (n: number) => number> = {
|
||||
cpu: (n) => Number(n) / 100,
|
||||
cpuTotal: (n) => Number(n) / 100,
|
||||
cpuV2: (n) => Number(n) / 100,
|
||||
memory: (n) => Number(n) / 100,
|
||||
tx: (n) => Number(n) / 8,
|
||||
rx: (n) => Number(n) / 8,
|
||||
rxV2: (n) => Number(n) / 8,
|
||||
txV2: (n) => Number(n) / 8,
|
||||
};
|
||||
|
|
|
@ -56,6 +56,14 @@ interface Props {
|
|||
| 'rightDown';
|
||||
}
|
||||
|
||||
type V2MetricType = 'txV2' | 'rxV2' | 'cpuV2';
|
||||
|
||||
const V2ToLegacyMapping: Record<V2MetricType, string> = {
|
||||
txV2: 'tx',
|
||||
rxV2: 'rx',
|
||||
cpuV2: 'cpu',
|
||||
};
|
||||
|
||||
const AGGREGATION_LABELS = {
|
||||
['avg']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.avg', {
|
||||
defaultMessage: 'Average',
|
||||
|
@ -164,9 +172,25 @@ export const MetricExpression = ({
|
|||
[customMetric, debouncedOnChangeCustom]
|
||||
);
|
||||
|
||||
const availablefieldsOptions = metrics.map((m) => {
|
||||
return { label: m.text, value: m.value };
|
||||
}, []);
|
||||
const metricsToRemove: string[] = metrics
|
||||
.map((currentMetric) => {
|
||||
return V2ToLegacyMapping[currentMetric.value as V2MetricType];
|
||||
})
|
||||
.filter((m): m is string => !!m);
|
||||
|
||||
const availableFieldsOptions = useMemo(
|
||||
() =>
|
||||
metrics
|
||||
.filter(
|
||||
(availableMetric) =>
|
||||
metric?.value === availableMetric.value ||
|
||||
!metricsToRemove.includes(availableMetric.value)
|
||||
)
|
||||
.map((m) => {
|
||||
return { label: m.text, value: m.value };
|
||||
}),
|
||||
[metric?.value, metrics, metricsToRemove]
|
||||
);
|
||||
|
||||
return (
|
||||
<EuiPopover
|
||||
|
@ -293,14 +317,14 @@ export const MetricExpression = ({
|
|||
<EuiComboBox
|
||||
fullWidth
|
||||
singleSelection={{ asPlainText: true }}
|
||||
data-test-subj="availablefieldsOptionsComboBox"
|
||||
data-test-subj="availableFieldsOptionsComboBox"
|
||||
// @ts-expect-error upgrade typescript v5.1.6
|
||||
isInvalid={errors.metric.length > 0}
|
||||
placeholder={firstFieldOption.text}
|
||||
options={availablefieldsOptions}
|
||||
noSuggestions={!availablefieldsOptions.length}
|
||||
options={availableFieldsOptions}
|
||||
noSuggestions={!availableFieldsOptions.length}
|
||||
selectedOptions={
|
||||
metric ? availablefieldsOptions.filter((a) => a.value === metric.value) : []
|
||||
metric ? availableFieldsOptions.filter((a) => a.value === metric.value) : []
|
||||
}
|
||||
renderOption={(o: any) => o.label}
|
||||
onChange={(selectedOptions) => {
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
export const useInventoryAlertPrefill = () => {
|
||||
const [nodeType, setNodeType] = useState<InventoryItemType>('host');
|
||||
const [filterQuery, setFilterQuery] = useState<string | undefined>();
|
||||
const [metric, setMetric] = useState<SnapshotMetricInput>({ type: 'cpuTotal' });
|
||||
const [metric, setMetric] = useState<SnapshotMetricInput>({ type: 'cpuV2' });
|
||||
const [customMetrics, setCustomMetrics] = useState<SnapshotCustomMetricInput[]>([]);
|
||||
// only shows for AWS when there are regions info
|
||||
const [region, setRegion] = useState('');
|
||||
|
|
|
@ -41,7 +41,7 @@ const mockHostNode: InfraAssetMetricsItem[] = [
|
|||
{
|
||||
metrics: [
|
||||
{
|
||||
name: 'cpuTotal',
|
||||
name: 'cpuV2',
|
||||
value: 0.6353277777777777,
|
||||
},
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ const mockHostNode: InfraAssetMetricsItem[] = [
|
|||
{
|
||||
metrics: [
|
||||
{
|
||||
name: 'cpuTotal',
|
||||
name: 'cpuV2',
|
||||
value: 0.8647805555555556,
|
||||
},
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ describe('useHostTable hook', () => {
|
|||
rx: 252456.92916666667,
|
||||
tx: 252758.425,
|
||||
memory: 0.94525,
|
||||
cpuTotal: 0.6353277777777777,
|
||||
cpuV2: 0.6353277777777777,
|
||||
diskSpaceUsage: 0.2040001,
|
||||
memoryFree: 34359.738368,
|
||||
normalizedLoad1m: 239.2040001,
|
||||
|
@ -187,7 +187,7 @@ describe('useHostTable hook', () => {
|
|||
rx: 95.86339715321859,
|
||||
tx: 110.38566859563191,
|
||||
memory: 0.5400000214576721,
|
||||
cpuTotal: 0.8647805555555556,
|
||||
cpuV2: 0.8647805555555556,
|
||||
diskSpaceUsage: 0.5400000214576721,
|
||||
memoryFree: 9.194304,
|
||||
normalizedLoad1m: 100,
|
||||
|
|
|
@ -287,10 +287,10 @@ export const useHostsTable = () => {
|
|||
/>
|
||||
),
|
||||
width: metricColumnsWidth,
|
||||
field: 'cpuTotal',
|
||||
field: 'cpuV2',
|
||||
sortable: true,
|
||||
'data-test-subj': 'hostsView-tableRow-cpuUsage',
|
||||
render: (avg: number) => formatMetric('cpuTotal', avg),
|
||||
render: (avg: number) => formatMetric('cpuV2', avg),
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ export const useHostsTable = () => {
|
|||
/>
|
||||
),
|
||||
width: '12%',
|
||||
field: 'rx',
|
||||
field: 'rxV2',
|
||||
sortable: true,
|
||||
'data-test-subj': 'hostsView-tableRow-rx',
|
||||
render: (avg: number) => formatMetric('rx', avg),
|
||||
|
@ -377,7 +377,7 @@ export const useHostsTable = () => {
|
|||
/>
|
||||
),
|
||||
width: '12%',
|
||||
field: 'tx',
|
||||
field: 'txV2',
|
||||
sortable: true,
|
||||
'data-test-subj': 'hostsView-tableRow-tx',
|
||||
render: (avg: number) => formatMetric('tx', avg),
|
||||
|
|
|
@ -26,13 +26,13 @@ import {
|
|||
import { StringDateRange } from './use_unified_search_url_state';
|
||||
|
||||
const HOST_TABLE_METRICS: Array<{ type: InfraAssetMetricType }> = [
|
||||
{ type: 'cpuTotal' },
|
||||
{ type: 'cpuV2' },
|
||||
{ type: 'diskSpaceUsage' },
|
||||
{ type: 'memory' },
|
||||
{ type: 'memoryFree' },
|
||||
{ type: 'normalizedLoad1m' },
|
||||
{ type: 'rx' },
|
||||
{ type: 'tx' },
|
||||
{ type: 'rxV2' },
|
||||
{ type: 'txV2' },
|
||||
];
|
||||
|
||||
const BASE_INFRA_METRICS_PATH = '/api/metrics/infra';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
exports[`ConditionalToolTip renders correctly 1`] = `
|
||||
<div
|
||||
data-test-subj="conditionalTooltipContent-host-01"
|
||||
style="min-width: 200px;"
|
||||
style="min-width: 220px;"
|
||||
>
|
||||
<div
|
||||
style="border-bottom: 1px solid #D3DAE6; border-bottom-color: #98A2B3; padding-bottom: 4px; margin-bottom: 4px;"
|
||||
|
@ -33,7 +33,7 @@ exports[`ConditionalToolTip renders correctly 1`] = `
|
|||
class="euiFlexItem eui-textTruncate eui-displayBlock emotion-euiFlexItem-grow-1"
|
||||
data-test-subj="conditionalTooltipContent-metric"
|
||||
>
|
||||
CPU usage (legacy)
|
||||
CPU usage (Legacy)
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
|
@ -58,6 +58,22 @@ exports[`ConditionalToolTip renders correctly 1`] = `
|
|||
80%
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexGroup emotion-euiFlexGroup-responsive-s-flexStart-stretch-row"
|
||||
>
|
||||
<div
|
||||
class="euiFlexItem eui-textTruncate eui-displayBlock emotion-euiFlexItem-grow-1"
|
||||
data-test-subj="conditionalTooltipContent-metric"
|
||||
>
|
||||
Inbound traffic
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
data-test-subj="conditionalTooltipContent-value"
|
||||
>
|
||||
8 Mbit/s
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexGroup emotion-euiFlexGroup-responsive-s-flexStart-stretch-row"
|
||||
>
|
||||
|
@ -81,7 +97,23 @@ exports[`ConditionalToolTip renders correctly 1`] = `
|
|||
class="euiFlexItem eui-textTruncate eui-displayBlock emotion-euiFlexItem-grow-1"
|
||||
data-test-subj="conditionalTooltipContent-metric"
|
||||
>
|
||||
Inbound traffic
|
||||
Inbound traffic (Legacy)
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
data-test-subj="conditionalTooltipContent-value"
|
||||
>
|
||||
8 Mbit/s
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexGroup emotion-euiFlexGroup-responsive-s-flexStart-stretch-row"
|
||||
>
|
||||
<div
|
||||
class="euiFlexItem eui-textTruncate eui-displayBlock emotion-euiFlexItem-grow-1"
|
||||
data-test-subj="conditionalTooltipContent-metric"
|
||||
>
|
||||
Outbound traffic (Legacy)
|
||||
</div>
|
||||
<div
|
||||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
|
|
|
@ -30,7 +30,7 @@ const NODE: InfraWaffleMapNode = {
|
|||
id: 'host-01',
|
||||
name: 'host-01',
|
||||
path: [{ value: 'host-01', label: 'host-01' }],
|
||||
metrics: [{ name: 'cpuTotal' }],
|
||||
metrics: [{ name: 'cpuV2' }],
|
||||
};
|
||||
|
||||
export const nextTick = () => new Promise((res) => process.nextTick(res));
|
||||
|
@ -45,11 +45,13 @@ describe('ConditionalToolTip', () => {
|
|||
name: 'host-01',
|
||||
path: [{ label: 'host-01', value: 'host-01', ip: '192.168.1.10' }],
|
||||
metrics: [
|
||||
{ name: 'cpuTotal', value: 0.1, avg: 0.4, max: 0.7 },
|
||||
{ name: 'cpuV2', value: 0.1, avg: 0.4, max: 0.7 },
|
||||
{ name: 'cpu', value: 0.1, avg: 0.4, max: 0.7 },
|
||||
{ name: 'memory', value: 0.8, avg: 0.8, max: 1 },
|
||||
{ name: 'txV2', value: 1000000, avg: 1000000, max: 1000000 },
|
||||
{ name: 'rxV2', value: 1000000, avg: 1000000, max: 1000000 },
|
||||
{ name: 'txV2', value: 1000000, avg: 1000000, max: 1000000 },
|
||||
{ name: 'rx', value: 1000000, avg: 1000000, max: 1000000 },
|
||||
{ name: 'tx', value: 1000000, avg: 1000000, max: 1000000 },
|
||||
{
|
||||
name: 'cedd6ca0-5775-11eb-a86f-adb714b6c486',
|
||||
max: 0.34164999922116596,
|
||||
|
@ -79,14 +81,16 @@ describe('ConditionalToolTip', () => {
|
|||
},
|
||||
});
|
||||
const expectedMetrics = [
|
||||
{ type: 'cpuTotal' },
|
||||
{ type: 'cpu' },
|
||||
{ type: 'cpuV2' },
|
||||
{ type: 'memory' },
|
||||
{ type: 'txV2' },
|
||||
{ type: 'rxV2' },
|
||||
{ type: 'cpu' },
|
||||
{ type: 'tx' },
|
||||
{ type: 'rx' },
|
||||
{
|
||||
aggregation: 'avg',
|
||||
field: 'host.cpuTotal.pct',
|
||||
field: 'host.cpuV2.pct',
|
||||
id: 'cedd6ca0-5775-11eb-a86f-adb714b6c486',
|
||||
label: 'My Custom Label',
|
||||
type: 'custom',
|
||||
|
@ -141,11 +145,11 @@ const mockedUseWaffleOptionsContexReturnValue: ReturnType<typeof useWaffleOption
|
|||
nodeType: 'host',
|
||||
customOptions: [],
|
||||
view: 'map',
|
||||
metric: { type: 'cpuTotal' },
|
||||
metric: { type: 'cpuV2' },
|
||||
customMetrics: [
|
||||
{
|
||||
aggregation: 'avg',
|
||||
field: 'host.cpuTotal.pct',
|
||||
field: 'host.cpuV2.pct',
|
||||
id: 'cedd6ca0-5775-11eb-a86f-adb714b6c486',
|
||||
label: 'My Custom Label',
|
||||
type: 'custom',
|
||||
|
|
|
@ -66,7 +66,7 @@ export const ConditionalToolTip = ({ node, nodeType, currentTime }: Props) => {
|
|||
const dataNode = first(nodes);
|
||||
const metrics = (dataNode && dataNode.metrics) || [];
|
||||
return (
|
||||
<div style={{ minWidth: 200 }} data-test-subj={`conditionalTooltipContent-${node.name}`}>
|
||||
<div style={{ minWidth: 220 }} data-test-subj={`conditionalTooltipContent-${node.name}`}>
|
||||
<div
|
||||
style={{
|
||||
borderBottom: `${euiTheme.border.thin}`,
|
||||
|
|
|
@ -33,7 +33,7 @@ export const DEFAULT_LEGEND: WaffleLegendOptions = {
|
|||
};
|
||||
|
||||
export const DEFAULT_WAFFLE_OPTIONS_STATE: WaffleOptionsState = {
|
||||
metric: { type: 'cpuTotal' },
|
||||
metric: { type: 'cpuV2' },
|
||||
groupBy: [],
|
||||
nodeType: 'host',
|
||||
view: 'map',
|
||||
|
|
|
@ -31,7 +31,7 @@ const METRIC_FORMATTERS: MetricFormatters = {
|
|||
formatter: InfraFormatterType.percent,
|
||||
template: '{{value}}',
|
||||
},
|
||||
cpuTotal: {
|
||||
cpuV2: {
|
||||
formatter: InfraFormatterType.percent,
|
||||
template: '{{value}}',
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@ export const convertMetricValue = (metric: SnapshotMetricType, value: number) =>
|
|||
};
|
||||
const converters: Record<string, (n: number) => number> = {
|
||||
cpu: (n) => Number(n) / 100,
|
||||
cpuTotal: (n) => Number(n) / 100,
|
||||
cpuV2: (n) => Number(n) / 100,
|
||||
memory: (n) => Number(n) / 100,
|
||||
tx: (n) => Number(n) / 8,
|
||||
rx: (n) => Number(n) / 8,
|
||||
|
|
|
@ -23,8 +23,8 @@ export const getAllHosts = async (
|
|||
|
||||
const result = (response.aggregations?.nodes.buckets ?? [])
|
||||
.sort((a, b) => {
|
||||
const aValue = getMetricValue(a?.cpuTotal) ?? 0;
|
||||
const bValue = getMetricValue(b?.cpuTotal) ?? 0;
|
||||
const aValue = getMetricValue(a?.cpuV2) ?? 0;
|
||||
const bValue = getMetricValue(b?.cpuV2) ?? 0;
|
||||
return bValue - aValue;
|
||||
})
|
||||
.map((bucket) => {
|
||||
|
|
|
@ -55,5 +55,5 @@ export const host: InventoryModel<typeof metrics> = {
|
|||
...awsRequiredMetrics,
|
||||
...nginxRequireMetrics,
|
||||
],
|
||||
tooltipMetrics: ['cpuTotal', 'cpu', 'memory', 'txV2', 'rxV2'],
|
||||
tooltipMetrics: ['cpuV2', 'memory', 'txV2', 'rxV2', 'cpu', 'tx', 'rx'],
|
||||
};
|
||||
|
|
|
@ -22,6 +22,6 @@ export const metrics: InventoryMetricsWithCharts<HostFormulas, HostCharts> = {
|
|||
snapshot,
|
||||
getFormulas: async () => await import('./formulas').then(({ formulas }) => formulas),
|
||||
getCharts: async () => await import('./charts').then(({ charts }) => charts),
|
||||
defaultSnapshot: 'cpuTotal',
|
||||
defaultSnapshot: 'cpuV2',
|
||||
defaultTimeRangeInSeconds: 3600, // 1 hour
|
||||
};
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import { MetricsUIAggregation } from '../../../types';
|
||||
|
||||
export const cpuTotal: MetricsUIAggregation = {
|
||||
cpuTotal: {
|
||||
export const cpuV2: MetricsUIAggregation = {
|
||||
cpuV2: {
|
||||
avg: {
|
||||
field: 'system.cpu.total.norm.pct',
|
||||
},
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { cpuTotal } from './cpu_total';
|
||||
import { cpuV2 } from './cpu_v2';
|
||||
import { cpu } from './cpu';
|
||||
import { diskLatency } from './disk_latency';
|
||||
import { diskSpaceUsage } from './disk_space_usage';
|
||||
|
@ -22,8 +22,7 @@ import { txV2 } from './tx_v2';
|
|||
import { rxV2 } from './rx_v2';
|
||||
|
||||
export const snapshot = {
|
||||
cpuTotal,
|
||||
cpu,
|
||||
cpuV2,
|
||||
diskLatency,
|
||||
diskSpaceUsage,
|
||||
count,
|
||||
|
@ -33,8 +32,9 @@ export const snapshot = {
|
|||
memoryFree,
|
||||
memoryTotal,
|
||||
normalizedLoad1m,
|
||||
rx,
|
||||
tx,
|
||||
rxV2,
|
||||
txV2,
|
||||
cpu,
|
||||
rx,
|
||||
tx,
|
||||
};
|
||||
|
|
|
@ -349,7 +349,7 @@ export type MetricsUIAggregation = rt.TypeOf<typeof MetricsUIAggregationRT>;
|
|||
|
||||
export const SnapshotMetricTypeKeys = {
|
||||
count: null,
|
||||
cpuTotal: null,
|
||||
cpuV2: null,
|
||||
cpu: null,
|
||||
diskLatency: null,
|
||||
diskSpaceUsage: null,
|
||||
|
|
|
@ -24,12 +24,12 @@ describe('of expression', () => {
|
|||
onChangeSelectedAggField={onChangeSelectedAggField}
|
||||
/>
|
||||
);
|
||||
expect(wrapper.find('[data-test-subj="availablefieldsOptionsComboBox"]'))
|
||||
expect(wrapper.find('[data-test-subj="availableFieldsOptionsComboBox"]'))
|
||||
.toMatchInlineSnapshot(`
|
||||
<EuiComboBox
|
||||
async={false}
|
||||
compressed={false}
|
||||
data-test-subj="availablefieldsOptionsComboBox"
|
||||
data-test-subj="availableFieldsOptionsComboBox"
|
||||
fullWidth={true}
|
||||
isClearable={true}
|
||||
isInvalid={false}
|
||||
|
@ -80,12 +80,12 @@ describe('of expression', () => {
|
|||
}}
|
||||
/>
|
||||
);
|
||||
expect(wrapper.find('[data-test-subj="availablefieldsOptionsComboBox"]'))
|
||||
expect(wrapper.find('[data-test-subj="availableFieldsOptionsComboBox"]'))
|
||||
.toMatchInlineSnapshot(`
|
||||
<EuiComboBox
|
||||
async={false}
|
||||
compressed={false}
|
||||
data-test-subj="availablefieldsOptionsComboBox"
|
||||
data-test-subj="availableFieldsOptionsComboBox"
|
||||
fullWidth={true}
|
||||
isClearable={true}
|
||||
isInvalid={false}
|
||||
|
@ -152,7 +152,7 @@ describe('of expression', () => {
|
|||
/>
|
||||
);
|
||||
|
||||
expect(wrapper.find('[data-test-subj="availablefieldsOptionsFormRow"]').prop('helpText')).toBe(
|
||||
expect(wrapper.find('[data-test-subj="availableFieldsOptionsFormRow"]').prop('helpText')).toBe(
|
||||
'Helptext test message'
|
||||
);
|
||||
});
|
||||
|
|
|
@ -145,13 +145,13 @@ export const OfExpression = ({
|
|||
fullWidth
|
||||
isInvalid={Number(errors.aggField.length) > 0 && aggField !== undefined}
|
||||
error={errors.aggField}
|
||||
data-test-subj="availablefieldsOptionsFormRow"
|
||||
data-test-subj="availableFieldsOptionsFormRow"
|
||||
helpText={helpText}
|
||||
>
|
||||
<EuiComboBox
|
||||
fullWidth
|
||||
singleSelection={{ asPlainText: true }}
|
||||
data-test-subj="availablefieldsOptionsComboBox"
|
||||
data-test-subj="availableFieldsOptionsComboBox"
|
||||
isInvalid={Number(errors.aggField.length) > 0 && aggField !== undefined}
|
||||
placeholder={firstFieldOption.text}
|
||||
options={availableFieldOptions}
|
||||
|
|
|
@ -31,7 +31,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
type: 'cpu',
|
||||
},
|
||||
{
|
||||
type: 'cpuTotal',
|
||||
type: 'cpuV2',
|
||||
},
|
||||
{
|
||||
type: 'diskSpaceUsage',
|
||||
|
@ -98,7 +98,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
],
|
||||
metrics: [
|
||||
{ name: 'cpu', value: 0.44708333333333333 },
|
||||
{ name: 'cpuTotal', value: 0 },
|
||||
{ name: 'cpuV2', value: 0 },
|
||||
{ name: 'diskSpaceUsage', value: 0 },
|
||||
{ name: 'memory', value: 0.4563333333333333 },
|
||||
{ name: 'memoryFree', value: 8573890560 },
|
||||
|
@ -159,7 +159,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
...basePayload,
|
||||
metrics: [
|
||||
{
|
||||
type: 'cpuTotal',
|
||||
type: 'cpuV2',
|
||||
},
|
||||
],
|
||||
query: { bool: { filter: [{ term: { 'host.os.name': 'CentOS Linux' } }] } },
|
||||
|
@ -179,7 +179,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
...basePayload,
|
||||
metrics: [
|
||||
{
|
||||
type: 'cpuTotal',
|
||||
type: 'cpuV2',
|
||||
},
|
||||
],
|
||||
query: { bool: { filter: [{ term: { 'host.os.name': 'Ubuntu' } }] } },
|
||||
|
@ -196,7 +196,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
...basePayload,
|
||||
metrics: [
|
||||
{
|
||||
type: 'cpuTotal',
|
||||
type: 'cpuV2',
|
||||
},
|
||||
],
|
||||
query: {
|
||||
|
@ -249,7 +249,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const response = await makeRequest({ invalidBody, expectedHTTPCode: 400 });
|
||||
|
||||
expect(normalizeNewLine(response.body.message)).to.be(
|
||||
'[request body]: Failed to validate: in metrics/0/type: "any" does not match expected type "cpu" | "cpuTotal" | "normalizedLoad1m" | "diskSpaceUsage" | "memory" | "memoryFree" | "rx" | "tx" | "rxV2" | "txV2"'
|
||||
'[request body]: Failed to validate: in metrics/0/type: "any" does not match expected type "cpu" | "cpuV2" | "normalizedLoad1m" | "diskSpaceUsage" | "memory" | "memoryFree" | "rx" | "tx" | "rxV2" | "txV2"'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -70,10 +70,10 @@ export function RulesCommonServiceProvider({ getService, getPageObject }: FtrPro
|
|||
await testSubjects.click('ofExpressionPopover');
|
||||
const ofComboBox = await find.byCssSelector('#ofField');
|
||||
await ofComboBox.click();
|
||||
const ofOptionsString = await comboBox.getOptionsList('availablefieldsOptionsComboBox');
|
||||
const ofOptionsString = await comboBox.getOptionsList('availableFieldsOptionsComboBox');
|
||||
const ofOptions = ofOptionsString.trim().split('\n');
|
||||
expect(ofOptions.length > 0).to.be(true);
|
||||
await comboBox.set('availablefieldsOptionsComboBox', ofOptions[0]);
|
||||
await comboBox.set('availableFieldsOptionsComboBox', ofOptions[0]);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -60,10 +60,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
1300
|
||||
);
|
||||
await ofComboBox.type('bytes');
|
||||
const ofOptionsString = await comboBox.getOptionsList('availablefieldsOptionsComboBox');
|
||||
const ofOptionsString = await comboBox.getOptionsList('availableFieldsOptionsComboBox');
|
||||
const ofOptions = ofOptionsString.trim().split('\n');
|
||||
expect(ofOptions.length > 0).to.be(true);
|
||||
await comboBox.set('availablefieldsOptionsComboBox', ofOptions[0]);
|
||||
await comboBox.set('availableFieldsOptionsComboBox', ofOptions[0]);
|
||||
|
||||
await testSubjects.click('groupByExpression');
|
||||
await testSubjects.click('overExpressionSelect');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue