Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21373,15 +21373,15 @@
"xpack.infra.metricsExplorer.actionsLabel.aria": "Aktionen für {grouping}",
"xpack.infra.metricsExplorer.actionsLabel.button": "Aktionen",
"xpack.infra.metricsExplorer.aggregationLabel": "Von",
"xpack.infra.metricsExplorer.aggregationLables.avg": "Durchschnitt",
"xpack.infra.metricsExplorer.aggregationLables.cardinality": "Kardinalität",
"xpack.infra.metricsExplorer.aggregationLables.count": "Dokumentanzahl",
"xpack.infra.metricsExplorer.aggregationLables.max": "Max.",
"xpack.infra.metricsExplorer.aggregationLables.min": "Min",
"xpack.infra.metricsExplorer.aggregationLables.p95": "95. Perzentil",
"xpack.infra.metricsExplorer.aggregationLables.p99": "99. Perzentil",
"xpack.infra.metricsExplorer.aggregationLables.rate": "Rate",
"xpack.infra.metricsExplorer.aggregationLables.sum": "Summe",
"xpack.infra.metricsExplorer.aggregationLabels.avg": "Durchschnitt",
"xpack.infra.metricsExplorer.aggregationLabels.cardinality": "Kardinalität",
"xpack.infra.metricsExplorer.aggregationLabels.count": "Dokumentanzahl",
"xpack.infra.metricsExplorer.aggregationLabels.max": "Max.",
"xpack.infra.metricsExplorer.aggregationLabels.min": "Min",
"xpack.infra.metricsExplorer.aggregationLabels.p95": "95. Perzentil",
"xpack.infra.metricsExplorer.aggregationLabels.p99": "99. Perzentil",
"xpack.infra.metricsExplorer.aggregationLabels.rate": "Rate",
"xpack.infra.metricsExplorer.aggregationLabels.sum": "Summe",
"xpack.infra.metricsExplorer.aggregationSelectLabel": "Aggregation auswählen",
"xpack.infra.metricsExplorer.alerts.createRuleButton": "Schwellenwertregel erstellen",
"xpack.infra.metricsExplorer.andLabel": "\" und \"",
Expand Down Expand Up @@ -21626,10 +21626,10 @@
"xpack.infra.waffle.customMetricPanelLabel.addAriaLabel": "Zurück zur Metrikauswahl",
"xpack.infra.waffle.customMetricPanelLabel.edit": "Benutzerdefinierte Metrik bearbeiten",
"xpack.infra.waffle.customMetricPanelLabel.editAriaLabel": "Zurück in den Bearbeitungsmodus für benutzerdefinierte Metriken",
"xpack.infra.waffle.customMetrics.aggregationLables.avg": "Durchschnitt",
"xpack.infra.waffle.customMetrics.aggregationLables.max": "Max.",
"xpack.infra.waffle.customMetrics.aggregationLables.min": "Min.",
"xpack.infra.waffle.customMetrics.aggregationLables.rate": "Rate",
"xpack.infra.waffle.customMetrics.aggregationLabels.avg": "Durchschnitt",
"xpack.infra.waffle.customMetrics.aggregationLabels.max": "Max.",
"xpack.infra.waffle.customMetrics.aggregationLabels.min": "Min.",
"xpack.infra.waffle.customMetrics.aggregationLabels.rate": "Rate",
"xpack.infra.waffle.customMetrics.cancelLabel": "Abbrechen",
"xpack.infra.waffle.customMetrics.editMode.deleteAriaLabel": "Benutzerdefinierte Metrik für {name} löschen",
"xpack.infra.waffle.customMetrics.editMode.editButtonAriaLabel": "Benutzerdefinierte Metrik für {name} bearbeiten",
Expand Down Expand Up @@ -45669,4 +45669,4 @@
"xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Dies ist ein Pflichtfeld.",
"xpack.watcher.watcherDescription": "Erkennen Sie Änderungen an Ihren Daten, indem Sie Alerts erstellen, verwalten und überwachen."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21641,15 +21641,15 @@
"xpack.infra.metricsExplorer.actionsLabel.aria": "Actions pour {grouping}",
"xpack.infra.metricsExplorer.actionsLabel.button": "Actions",
"xpack.infra.metricsExplorer.aggregationLabel": "sur",
"xpack.infra.metricsExplorer.aggregationLables.avg": "Moyenne",
"xpack.infra.metricsExplorer.aggregationLables.cardinality": "Cardinalité",
"xpack.infra.metricsExplorer.aggregationLables.count": "Compte du document",
"xpack.infra.metricsExplorer.aggregationLables.max": "Max.",
"xpack.infra.metricsExplorer.aggregationLables.min": "Min.",
"xpack.infra.metricsExplorer.aggregationLables.p95": "95e centile",
"xpack.infra.metricsExplorer.aggregationLables.p99": "99e centile",
"xpack.infra.metricsExplorer.aggregationLables.rate": "Taux",
"xpack.infra.metricsExplorer.aggregationLables.sum": "Somme",
"xpack.infra.metricsExplorer.aggregationLabels.avg": "Moyenne",
"xpack.infra.metricsExplorer.aggregationLabels.cardinality": "Cardinalité",
"xpack.infra.metricsExplorer.aggregationLabels.count": "Compte du document",
"xpack.infra.metricsExplorer.aggregationLabels.max": "Max.",
"xpack.infra.metricsExplorer.aggregationLabels.min": "Min.",
"xpack.infra.metricsExplorer.aggregationLabels.p95": "95e centile",
"xpack.infra.metricsExplorer.aggregationLabels.p99": "99e centile",
"xpack.infra.metricsExplorer.aggregationLabels.rate": "Taux",
"xpack.infra.metricsExplorer.aggregationLabels.sum": "Somme",
"xpack.infra.metricsExplorer.aggregationSelectLabel": "Choisir une agrégation",
"xpack.infra.metricsExplorer.alerts.createRuleButton": "Créer une règle de seuil",
"xpack.infra.metricsExplorer.andLabel": "\" et \"",
Expand Down Expand Up @@ -21894,10 +21894,10 @@
"xpack.infra.waffle.customMetricPanelLabel.addAriaLabel": "Retour vers le sélecteur d'indicateur",
"xpack.infra.waffle.customMetricPanelLabel.edit": "Modifier un indicateur personnalisé",
"xpack.infra.waffle.customMetricPanelLabel.editAriaLabel": "Retour vers le mode d'édition des indicateurs personnalisés",
"xpack.infra.waffle.customMetrics.aggregationLables.avg": "Moyenne",
"xpack.infra.waffle.customMetrics.aggregationLables.max": "Max.",
"xpack.infra.waffle.customMetrics.aggregationLables.min": "Min.",
"xpack.infra.waffle.customMetrics.aggregationLables.rate": "Taux",
"xpack.infra.waffle.customMetrics.aggregationLabels.avg": "Moyenne",
"xpack.infra.waffle.customMetrics.aggregationLabels.max": "Max.",
"xpack.infra.waffle.customMetrics.aggregationLabels.min": "Min.",
"xpack.infra.waffle.customMetrics.aggregationLabels.rate": "Taux",
"xpack.infra.waffle.customMetrics.cancelLabel": "Annuler",
"xpack.infra.waffle.customMetrics.editMode.deleteAriaLabel": "Supprimer l'indicateur personnalisé pour {name}",
"xpack.infra.waffle.customMetrics.editMode.editButtonAriaLabel": "Modifier l'indicateur personnalisé pour {name}",
Expand Down Expand Up @@ -46181,4 +46181,4 @@
"xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Ce champ est requis.",
"xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21670,15 +21670,15 @@
"xpack.infra.metricsExplorer.actionsLabel.aria": "{grouping} のアクション",
"xpack.infra.metricsExplorer.actionsLabel.button": "アクション",
"xpack.infra.metricsExplorer.aggregationLabel": "/",
"xpack.infra.metricsExplorer.aggregationLables.avg": "平均",
"xpack.infra.metricsExplorer.aggregationLables.cardinality": "基数",
"xpack.infra.metricsExplorer.aggregationLables.count": "ドキュメントカウント",
"xpack.infra.metricsExplorer.aggregationLables.max": "最高",
"xpack.infra.metricsExplorer.aggregationLables.min": "最低",
"xpack.infra.metricsExplorer.aggregationLables.p95": "95パーセンタイル",
"xpack.infra.metricsExplorer.aggregationLables.p99": "99パーセンタイル",
"xpack.infra.metricsExplorer.aggregationLables.rate": "レート",
"xpack.infra.metricsExplorer.aggregationLables.sum": "合計",
"xpack.infra.metricsExplorer.aggregationLabels.avg": "平均",
"xpack.infra.metricsExplorer.aggregationLabels.cardinality": "基数",
"xpack.infra.metricsExplorer.aggregationLabels.count": "ドキュメントカウント",
"xpack.infra.metricsExplorer.aggregationLabels.max": "最高",
"xpack.infra.metricsExplorer.aggregationLabels.min": "最低",
"xpack.infra.metricsExplorer.aggregationLabels.p95": "95パーセンタイル",
"xpack.infra.metricsExplorer.aggregationLabels.p99": "99パーセンタイル",
"xpack.infra.metricsExplorer.aggregationLabels.rate": "レート",
"xpack.infra.metricsExplorer.aggregationLabels.sum": "合計",
"xpack.infra.metricsExplorer.aggregationSelectLabel": "集約を選択してください",
"xpack.infra.metricsExplorer.alerts.createRuleButton": "しきい値ルールを作成",
"xpack.infra.metricsExplorer.andLabel": "\"および\"",
Expand Down Expand Up @@ -21923,10 +21923,10 @@
"xpack.infra.waffle.customMetricPanelLabel.addAriaLabel": "メトリックピッカーに戻る",
"xpack.infra.waffle.customMetricPanelLabel.edit": "カスタムメトリックを編集",
"xpack.infra.waffle.customMetricPanelLabel.editAriaLabel": "カスタムメトリック編集モードに戻る",
"xpack.infra.waffle.customMetrics.aggregationLables.avg": "平均",
"xpack.infra.waffle.customMetrics.aggregationLables.max": "最高",
"xpack.infra.waffle.customMetrics.aggregationLables.min": "最低",
"xpack.infra.waffle.customMetrics.aggregationLables.rate": "レート",
"xpack.infra.waffle.customMetrics.aggregationLabels.avg": "平均",
"xpack.infra.waffle.customMetrics.aggregationLabels.max": "最高",
"xpack.infra.waffle.customMetrics.aggregationLabels.min": "最低",
"xpack.infra.waffle.customMetrics.aggregationLabels.rate": "レート",
"xpack.infra.waffle.customMetrics.cancelLabel": "キャンセル",
"xpack.infra.waffle.customMetrics.editMode.deleteAriaLabel": "{name} のカスタムメトリックを削除",
"xpack.infra.waffle.customMetrics.editMode.editButtonAriaLabel": "{name} のカスタムメトリックを編集",
Expand Down Expand Up @@ -46225,4 +46225,4 @@
"xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。",
"xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21659,15 +21659,15 @@
"xpack.infra.metricsExplorer.actionsLabel.aria": "适用于 {grouping} 的操作",
"xpack.infra.metricsExplorer.actionsLabel.button": "操作",
"xpack.infra.metricsExplorer.aggregationLabel": "/",
"xpack.infra.metricsExplorer.aggregationLables.avg": "平均值",
"xpack.infra.metricsExplorer.aggregationLables.cardinality": "基数",
"xpack.infra.metricsExplorer.aggregationLables.count": "文档计数",
"xpack.infra.metricsExplorer.aggregationLables.max": "最大值",
"xpack.infra.metricsExplorer.aggregationLables.min": "最小值",
"xpack.infra.metricsExplorer.aggregationLables.p95": "第 95 百分位值",
"xpack.infra.metricsExplorer.aggregationLables.p99": "第 99 百分位值",
"xpack.infra.metricsExplorer.aggregationLables.rate": "比率",
"xpack.infra.metricsExplorer.aggregationLables.sum": "求和",
"xpack.infra.metricsExplorer.aggregationLabels.avg": "平均值",
"xpack.infra.metricsExplorer.aggregationLabels.cardinality": "基数",
"xpack.infra.metricsExplorer.aggregationLabels.count": "文档计数",
"xpack.infra.metricsExplorer.aggregationLabels.max": "最大值",
"xpack.infra.metricsExplorer.aggregationLabels.min": "最小值",
"xpack.infra.metricsExplorer.aggregationLabels.p95": "第 95 百分位值",
"xpack.infra.metricsExplorer.aggregationLabels.p99": "第 99 百分位值",
"xpack.infra.metricsExplorer.aggregationLabels.rate": "比率",
"xpack.infra.metricsExplorer.aggregationLabels.sum": "求和",
"xpack.infra.metricsExplorer.aggregationSelectLabel": "选择聚合",
"xpack.infra.metricsExplorer.alerts.createRuleButton": "创建阈值规则",
"xpack.infra.metricsExplorer.andLabel": "\" 且 \"",
Expand Down Expand Up @@ -21912,10 +21912,10 @@
"xpack.infra.waffle.customMetricPanelLabel.addAriaLabel": "返回到指标选取器",
"xpack.infra.waffle.customMetricPanelLabel.edit": "编辑定制指标",
"xpack.infra.waffle.customMetricPanelLabel.editAriaLabel": "返回到定制指标编辑模式",
"xpack.infra.waffle.customMetrics.aggregationLables.avg": "平均值",
"xpack.infra.waffle.customMetrics.aggregationLables.max": "最大值",
"xpack.infra.waffle.customMetrics.aggregationLables.min": "最小值",
"xpack.infra.waffle.customMetrics.aggregationLables.rate": "比率",
"xpack.infra.waffle.customMetrics.aggregationLabels.avg": "平均值",
"xpack.infra.waffle.customMetrics.aggregationLabels.max": "最大值",
"xpack.infra.waffle.customMetrics.aggregationLabels.min": "最小值",
"xpack.infra.waffle.customMetrics.aggregationLabels.rate": "比率",
"xpack.infra.waffle.customMetrics.cancelLabel": "取消",
"xpack.infra.waffle.customMetrics.editMode.deleteAriaLabel": "删除 {name} 的定制指标",
"xpack.infra.waffle.customMetrics.editMode.editButtonAriaLabel": "编辑 {name} 的定制指标",
Expand Down Expand Up @@ -46204,4 +46204,4 @@
"xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。",
"xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const getCustomMetricLabel = (metric: SnapshotCustomMetricInput) => {
defaultMessage: 'Rate of {field}',
values: { field: metric.field },
}),
last_value: i18n.translate('xpack.infra.waffle.aggregationNames.last_value', {
defaultMessage: 'Last value of {field}',
values: { field: metric.field },
}),
};
return metric.label ? metric.label : METRIC_LABELS[metric.aggregation];
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const METRIC_EXPLORER_AGGREGATIONS = [
'p95',
'p99',
'custom',
'last_value',
] as const;

export const OMITTED_AGGREGATIONS_FOR_CUSTOM_METRICS = ['custom', 'rate', 'p95', 'p99'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const SnapshotNamedMetricInputRT = rt.type({
type: SnapshotMetricTypeRT,
});

export const SNAPSHOT_CUSTOM_AGGREGATIONS = ['avg', 'max', 'min', 'rate'] as const;
export const SNAPSHOT_CUSTOM_AGGREGATIONS = ['avg', 'max', 'min', 'rate', 'last_value'] as const;

export type SnapshotCustomAggregation = (typeof SNAPSHOT_CUSTOM_AGGREGATIONS)[number];

Expand Down Expand Up @@ -109,9 +109,9 @@ export const SnapshotRequestRT = rt.intersection([
groupBy: rt.union([SnapshotGroupByRT, rt.null]),
nodeType: ItemTypeRT,
sourceId: rt.string,
includeTimeseries: rt.union([rt.boolean, createLiteralValueFromUndefinedRT(true)]),
}),
rt.partial({
includeTimeseries: rt.union([rt.boolean, createLiteralValueFromUndefinedRT(false)]),
accountId: rt.string,
region: rt.string,
kuery: rt.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,29 @@ export const inventoryColorPaletteRT = rt.keyof({
negative: null,
});

const inventoryLegendOptionsRT = rt.type({
palette: inventoryColorPaletteRT,
steps: inRangeRt(2, 18),
reverseColors: rt.boolean,
const inventoryLegendTypeRT = rt.keyof({
gradient: null,
steps: null,
});

const inventoryLegendStepRT = rt.type({
color: rt.string,
value: rt.number,
label: rt.string,
});

const inventoryLegendOptionsRT = rt.intersection([
rt.type({
palette: inventoryColorPaletteRT,
steps: inRangeRt(2, 18),
reverseColors: rt.boolean,
}),
rt.partial({
type: inventoryLegendTypeRT,
rules: rt.array(inventoryLegendStepRT),
}),
]);

export const inventorySortOptionRT = rt.type({
by: rt.keyof({ name: null, value: null }),
direction: rt.keyof({ asc: null, desc: null }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { i18n } from '@kbn/i18n';
import { mapValues } from 'lodash';
import type { InventoryItemType, SnapshotMetricType } from '@kbn/metrics-data-access-plugin/common';
import type { SnapshotCustomAggregation } from './http_api/snapshot_api';

// Lowercase versions of all metrics, for when they need to be used in the middle of a sentence;
// these may need to be translated differently depending on language, e.g. still capitalizing "CPU"
Expand Down Expand Up @@ -282,3 +283,21 @@ export const toMetricOpt = (
};
}
};

export const AGGREGATION_LABELS: Record<SnapshotCustomAggregation, string> = {
['avg']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.avg', {
defaultMessage: 'Average',
}),
['max']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.max', {
defaultMessage: 'Max',
}),
['min']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.min', {
defaultMessage: 'Min',
}),
['rate']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.rate', {
defaultMessage: 'Rate',
}),
['last_value']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.lastValue', {
defaultMessage: 'Last value',
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const ExpressionChart = ({
region,
timerange,
schema,
includeTimeseries: true,
});

const metric = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
SnapshotCustomMetricInputRT,
SNAPSHOT_CUSTOM_AGGREGATIONS,
} from '../../../../common/http_api/snapshot_api';

import { AGGREGATION_LABELS } from '../../../../common/snapshot_metric_i18n';
interface Props {
metric?: { value: string; text: string };
metrics: Array<{ value: string; text: string }>;
Expand Down Expand Up @@ -71,22 +71,8 @@ const V2ToLegacyMapping: Record<V2MetricType, string> = {
cpuV2: 'cpu',
};

const AGGREGATION_LABELS = {
['avg']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.avg', {
defaultMessage: 'Average',
}),
['max']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.max', {
defaultMessage: 'Max',
}),
['min']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.min', {
defaultMessage: 'Min',
}),
['rate']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.rate', {
defaultMessage: 'Rate',
}),
};
const aggregationOptions = SNAPSHOT_CUSTOM_AGGREGATIONS.map((k) => ({
text: AGGREGATION_LABELS[k as SnapshotCustomAggregation],
text: AGGREGATION_LABELS[k],
value: k,
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ export const PALETTES = {
export const StepRuleRT = rt.intersection([
rt.type({
value: rt.number,
operator: OperatorRT,
color: rt.string,
}),
rt.partial({ label: rt.string }),
rt.partial({ label: rt.string, operator: OperatorRT }),
]);

export const StepLegendRT = rt.type({
type: rt.literal('step'),
type: rt.literal('steps'),
rules: rt.array(StepRuleRT),
});
export type InfraWaffleMapStepRule = rt.TypeOf<typeof StepRuleRT>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export const Layout = React.memo(({ interval, nodes, loading }: Props) => {
const { currentTime, jumpToTime, isAutoReloading } = useWaffleTimeContext();
const { applyFilterQuery } = useWaffleFiltersContext();
const legendPalette = legend?.palette ?? DEFAULT_LEGEND.palette;
const legendRules = legend?.rules ?? DEFAULT_LEGEND.rules;
const legendSteps = legend?.steps ?? DEFAULT_LEGEND.steps;
const legendReverseColors = legend?.reverseColors ?? DEFAULT_LEGEND.reverseColors;
const legendType = legend?.type ?? 'gradient';
const AUTO_REFRESH_INTERVAL = 5 * 1000;

const { hasEcsSchema, hasSemconvSchema, hasEcsK8sIntegration, hasSemconvK8sIntegration } =
Expand All @@ -84,7 +86,7 @@ export const Layout = React.memo(({ interval, nodes, loading }: Props) => {
const options = {
formatter: InfraFormatterType.percent,
formatTemplate: '{{value}}',
legend: createLegend(legendPalette, legendSteps, legendReverseColors),
legend: createLegend(legendPalette, legendSteps, legendReverseColors, legendRules, legendType),
metric,
sort,
groupBy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ describe('ConditionalToolTip', () => {
groupBy: [],
nodeType: 'host',
sourceId: 'default',
includeTimeseries: true,
currentTime,
accountId: '',
region: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const ConditionalToolTip = ({ node, nodeType, currentTime }: Props) => {
accountId: '',
region: '',
schema: preferredSchema,
includeTimeseries: true,
});

const dataNode = first(nodes);
Expand Down
Loading