Skip to content

Commit df59c26

Browse files
authored
feat(slo): update preview data API to show groups (elastic#211801)
1 parent b32f0fe commit df59c26

File tree

22 files changed

+4844
-789
lines changed

22 files changed

+4844
-789
lines changed

x-pack/platform/packages/shared/kbn-slo-schema/src/rest_specs/routes/get_preview_data.ts

+23-19
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
import * as t from 'io-ts';
88
import { indicatorSchema, objectiveSchema } from '../../schema';
9-
import { allOrAnyStringOrArray, dateType } from '../../schema/common';
9+
import { dateType, groupingsSchema } from '../../schema/common';
1010

1111
const getPreviewDataParamsSchema = t.type({
1212
body: t.intersection([
@@ -19,32 +19,36 @@ const getPreviewDataParamsSchema = t.type({
1919
}),
2020
t.partial({
2121
objective: objectiveSchema,
22-
instanceId: t.string,
23-
groupBy: allOrAnyStringOrArray,
2422
remoteName: t.string,
25-
groupings: t.record(t.string, t.unknown),
23+
groupings: groupingsSchema,
24+
groupBy: t.array(t.string),
2625
}),
2726
]),
2827
});
2928

30-
const getPreviewDataResponseSchema = t.array(
31-
t.intersection([
32-
t.type({
33-
date: dateType,
34-
sliValue: t.union([t.number, t.null]),
29+
const previewDataResponseSchema = t.intersection([
30+
t.type({
31+
date: dateType,
32+
sliValue: t.union([t.number, t.null]),
33+
}),
34+
t.partial({
35+
events: t.type({
36+
good: t.number,
37+
bad: t.number,
38+
total: t.number,
3539
}),
36-
t.partial({
37-
events: t.type({
38-
good: t.number,
39-
bad: t.number,
40-
total: t.number,
41-
}),
42-
}),
43-
])
44-
);
40+
}),
41+
]);
42+
43+
const getPreviewDataResponseSchema = t.intersection([
44+
t.type({
45+
results: t.array(previewDataResponseSchema),
46+
}),
47+
t.partial({ groups: t.record(t.string, t.array(previewDataResponseSchema)) }),
48+
]);
4549

4650
type GetPreviewDataParams = t.TypeOf<typeof getPreviewDataParamsSchema.props.body>;
4751
type GetPreviewDataResponse = t.OutputOf<typeof getPreviewDataResponseSchema>;
4852

49-
export { getPreviewDataParamsSchema, getPreviewDataResponseSchema };
53+
export { getPreviewDataParamsSchema, getPreviewDataResponseSchema, previewDataResponseSchema };
5054
export type { GetPreviewDataParams, GetPreviewDataResponse };

x-pack/platform/plugins/private/translations/translations/fr-FR.json

-5
Original file line numberDiff line numberDiff line change
@@ -40005,7 +40005,6 @@
4000540005
"xpack.slo.burnRateRuleEditor.h5.defineMultipleBurnRateLabel": "Définir des fenêtres du taux d'avancement multiples",
4000640006
"xpack.slo.burnRates.value": "{value} fois",
4000740007
"xpack.slo.create.errorNotification": "Un problème est survenu lors de la création de {name}",
40008-
"xpack.slo.dataPreviewChart.noResultsLabel": "aucun résultat",
4000940008
"xpack.slo.deleteConfirmationModal.cancelButtonLabel": "Annuler",
4001040009
"xpack.slo.deleteConfirmationModal.deleteAllButtonLabel": "Supprimer le SLO et toutes les instances",
4001140010
"xpack.slo.deleteConfirmationModal.deleteButtonLabel": "Supprimer",
@@ -40336,14 +40335,10 @@
4033640335
"xpack.slo.sloEdit.customKql.dataViewSelection.label": "Sélectionner une vue de données",
4033740336
"xpack.slo.sloEdit.customKql.indexSelection.label": "Index",
4033840337
"xpack.slo.sloEdit.customMetric.aggregationLabel": "Agrégation",
40339-
"xpack.slo.sloEdit.dataPreviewChart.badEvents": "Total des événements",
4034040338
"xpack.slo.sloEdit.dataPreviewChart.errorMessage": "Les paramètres d'indicateur actuels ne sont pas valides",
4034140339
"xpack.slo.sloEdit.dataPreviewChart.explanationMessage": "Remplir les champs d'indicateur pour visualiser les indicateurs actuels",
40342-
"xpack.slo.sloEdit.dataPreviewChart.goodEvents": "Bons événements",
4034340340
"xpack.slo.sloEdit.dataPreviewChart.moreThan100": "Certaines des valeurs SLI sont supérieures à 100 %. Cela signifie qu'une bonne requête renvoie plus de résultats que la requête totale.",
4034440341
"xpack.slo.sloEdit.dataPreviewChart.panelLabel": "Aperçu du SLI",
40345-
"xpack.slo.sloEdit.dataPreviewChart.syntheticsAvailability.xTitle": "Dernières 24 heures",
40346-
"xpack.slo.sloEdit.dataPreviewChart.xTitle": "Dernière heure",
4034740342
"xpack.slo.sloEdit.dataPreviewChart.yTitle": "SLI",
4034840343
"xpack.slo.sloEdit.definition.sliType": "Choisir le type de SLI",
4034940344
"xpack.slo.sloEdit.definition.title": "Définir un SLI",

x-pack/platform/plugins/private/translations/translations/ja-JP.json

-5
Original file line numberDiff line numberDiff line change
@@ -39864,7 +39864,6 @@
3986439864
"xpack.slo.burnRateRuleEditor.h5.defineMultipleBurnRateLabel": "複数のバーンレート時間枠を定義",
3986539865
"xpack.slo.burnRates.value": "{value}x",
3986639866
"xpack.slo.create.errorNotification": "{name}の作成中に問題が発生しました",
39867-
"xpack.slo.dataPreviewChart.noResultsLabel": "結果なし",
3986839867
"xpack.slo.deleteConfirmationModal.cancelButtonLabel": "キャンセル",
3986939868
"xpack.slo.deleteConfirmationModal.deleteAllButtonLabel": "SLOとすべてのインスタンスを削除",
3987039869
"xpack.slo.deleteConfirmationModal.deleteButtonLabel": "削除",
@@ -40194,14 +40193,10 @@
4019440193
"xpack.slo.sloEdit.customKql.dataViewSelection.label": "データビューを選択",
4019540194
"xpack.slo.sloEdit.customKql.indexSelection.label": "インデックス",
4019640195
"xpack.slo.sloEdit.customMetric.aggregationLabel": "アグリゲーション",
40197-
"xpack.slo.sloEdit.dataPreviewChart.badEvents": "全てのイベント",
4019840196
"xpack.slo.sloEdit.dataPreviewChart.errorMessage": "現在のインジケーター設定は無効です",
4019940197
"xpack.slo.sloEdit.dataPreviewChart.explanationMessage": "インジケーターフィールドに入力すると、現在のメトリックが可視化されます。",
40200-
"xpack.slo.sloEdit.dataPreviewChart.goodEvents": "良好なイベント数",
4020140198
"xpack.slo.sloEdit.dataPreviewChart.moreThan100": "SLI値の一部が100%を超えています。つまり、質の高いクエリーは合計クエリーよりも多くの結果を返しています。",
4020240199
"xpack.slo.sloEdit.dataPreviewChart.panelLabel": "SLIプレビュー",
40203-
"xpack.slo.sloEdit.dataPreviewChart.syntheticsAvailability.xTitle": "過去 24 時間",
40204-
"xpack.slo.sloEdit.dataPreviewChart.xTitle": "過去 1 時間",
4020540200
"xpack.slo.sloEdit.dataPreviewChart.yTitle": "SLI",
4020640201
"xpack.slo.sloEdit.definition.sliType": "SLIタイプを選択",
4020740202
"xpack.slo.sloEdit.definition.title": "SLIを定義",

x-pack/platform/plugins/private/translations/translations/zh-CN.json

-5
Original file line numberDiff line numberDiff line change
@@ -39289,7 +39289,6 @@
3928939289
"xpack.slo.burnRateRuleEditor.h5.defineMultipleBurnRateLabel": "定义多个消耗速度窗口",
3929039290
"xpack.slo.burnRates.value": "{value} 倍",
3929139291
"xpack.slo.create.errorNotification": "创建 {name} 时出现问题",
39292-
"xpack.slo.dataPreviewChart.noResultsLabel": "无结果",
3929339292
"xpack.slo.deleteConfirmationModal.cancelButtonLabel": "取消",
3929439293
"xpack.slo.deleteConfirmationModal.deleteAllButtonLabel": "删除 SLO 和所有实例",
3929539294
"xpack.slo.deleteConfirmationModal.deleteButtonLabel": "删除",
@@ -39618,14 +39617,10 @@
3961839617
"xpack.slo.sloEdit.customKql.dataViewSelection.label": "选择数据视图",
3961939618
"xpack.slo.sloEdit.customKql.indexSelection.label": "索引",
3962039619
"xpack.slo.sloEdit.customMetric.aggregationLabel": "聚合",
39621-
"xpack.slo.sloEdit.dataPreviewChart.badEvents": "事件合计",
3962239620
"xpack.slo.sloEdit.dataPreviewChart.errorMessage": "当前指标设置无效",
3962339621
"xpack.slo.sloEdit.dataPreviewChart.explanationMessage": "填写指标字段以查看当前指标的可视化",
39624-
"xpack.slo.sloEdit.dataPreviewChart.goodEvents": "良好事件",
3962539622
"xpack.slo.sloEdit.dataPreviewChart.moreThan100": "某些 SLI 值大于 100%。这表明良好查询返回的结果比总体查询更多。",
3962639623
"xpack.slo.sloEdit.dataPreviewChart.panelLabel": "SLI 预览",
39627-
"xpack.slo.sloEdit.dataPreviewChart.syntheticsAvailability.xTitle": "过去 24 小时",
39628-
"xpack.slo.sloEdit.dataPreviewChart.xTitle": "过去一小时",
3962939624
"xpack.slo.sloEdit.dataPreviewChart.yTitle": "SLI",
3963039625
"xpack.slo.sloEdit.definition.sliType": "选择 SLI 类型",
3963139626
"xpack.slo.sloEdit.definition.title": "定义 SLI",

x-pack/solutions/observability/plugins/slo/public/components/good_bad_events_chart/good_bad_events_chart.tsx

-192
This file was deleted.

x-pack/solutions/observability/plugins/slo/public/hooks/query_key_factory.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
import type { Indicator } from '@kbn/slo-schema';
8+
import type { Indicator, Objective } from '@kbn/slo-schema';
99

1010
interface SloListFilter {
1111
kqlQuery: string;
@@ -61,11 +61,17 @@ export const sloKeys = {
6161
instanceId: string | undefined,
6262
windows: Array<{ name: string; duration: string }>
6363
) => [...sloKeys.all, 'burnRates', sloId, instanceId, windows] as const,
64-
preview: (
65-
indicator: Indicator,
66-
range: { from: Date; to: Date },
67-
groupings?: Record<string, unknown>
68-
) => [...sloKeys.all, 'preview', indicator, range, groupings] as const,
64+
preview: (params: {
65+
remoteName?: string;
66+
groupings?: Record<string, string | number>;
67+
objective?: Objective;
68+
indicator: Indicator;
69+
range: {
70+
from: Date;
71+
to: Date;
72+
};
73+
groupBy?: string[];
74+
}) => [...sloKeys.all, 'preview', params] as const,
6975
burnRateRules: (search: string) => [...sloKeys.all, 'burnRateRules', search],
7076
groupings: (params: {
7177
sloId: string;

0 commit comments

Comments
 (0)