feat(slo): Show SLI preview chart for custom kql (#159713)

This commit is contained in:
Kevin Delemme 2023-06-15 18:39:21 -04:00 committed by GitHub
parent fa98aa4f8c
commit f9d16e160b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 335 additions and 29 deletions

View file

@ -6,24 +6,22 @@
*/
import * as t from 'io-ts';
import {
budgetingMethodSchema,
dateType,
historicalSummarySchema,
indicatorSchema,
indicatorTypesArraySchema,
kqlCustomIndicatorSchema,
metricCustomIndicatorSchema,
objectiveSchema,
optionalSettingsSchema,
previewDataSchema,
settingsSchema,
sloIdSchema,
summarySchema,
tagsSchema,
timeWindowSchema,
metricCustomIndicatorSchema,
kqlCustomIndicatorSchema,
apmTransactionErrorRateIndicatorSchema,
apmTransactionDurationIndicatorSchema,
} from '../schema';
const createSLOParamsSchema = t.type({
@ -44,6 +42,14 @@ const createSLOResponseSchema = t.type({
id: sloIdSchema,
});
const getPreviewDataParamsSchema = t.type({
body: t.type({
indicator: indicatorSchema,
}),
});
const getPreviewDataResponseSchema = t.array(previewDataSchema);
const deleteSLOParamsSchema = t.type({
path: t.type({
id: sloIdSchema,
@ -156,20 +162,22 @@ type FetchHistoricalSummaryParams = t.TypeOf<typeof fetchHistoricalSummaryParams
type FetchHistoricalSummaryResponse = t.OutputOf<typeof fetchHistoricalSummaryResponseSchema>;
type HistoricalSummaryResponse = t.OutputOf<typeof historicalSummarySchema>;
type GetPreviewDataParams = t.TypeOf<typeof getPreviewDataParamsSchema.props.body>;
type GetPreviewDataResponse = t.TypeOf<typeof getPreviewDataResponseSchema>;
type BudgetingMethod = t.TypeOf<typeof budgetingMethodSchema>;
type MetricCustomIndicatorSchema = t.TypeOf<typeof metricCustomIndicatorSchema>;
type KQLCustomIndicatorSchema = t.TypeOf<typeof kqlCustomIndicatorSchema>;
type APMTransactionErrorRateIndicatorSchema = t.TypeOf<
typeof apmTransactionErrorRateIndicatorSchema
>;
type APMTransactionDurationIndicatorSchema = t.TypeOf<typeof apmTransactionDurationIndicatorSchema>;
type Indicator = t.OutputOf<typeof indicatorSchema>;
type MetricCustomIndicator = t.OutputOf<typeof metricCustomIndicatorSchema>;
type KQLCustomIndicator = t.OutputOf<typeof kqlCustomIndicatorSchema>;
export {
createSLOParamsSchema,
deleteSLOParamsSchema,
findSLOParamsSchema,
findSLOResponseSchema,
getPreviewDataParamsSchema,
getPreviewDataResponseSchema,
getSLODiagnosisParamsSchema,
getSLOParamsSchema,
getSLOResponseSchema,
@ -188,6 +196,8 @@ export type {
CreateSLOResponse,
FindSLOParams,
FindSLOResponse,
GetPreviewDataParams,
GetPreviewDataResponse,
GetSLOResponse,
FetchHistoricalSummaryParams,
FetchHistoricalSummaryResponse,
@ -198,8 +208,7 @@ export type {
UpdateSLOInput,
UpdateSLOParams,
UpdateSLOResponse,
MetricCustomIndicatorSchema,
KQLCustomIndicatorSchema,
APMTransactionDurationIndicatorSchema,
APMTransactionErrorRateIndicatorSchema,
Indicator,
MetricCustomIndicator,
KQLCustomIndicator,
};

View file

@ -52,6 +52,11 @@ const historicalSummarySchema = t.intersection([
summarySchema,
]);
const previewDataSchema = t.type({
date: dateType,
sliValue: t.number,
});
const dateRangeSchema = t.type({ from: dateType, to: dateType });
export type { SummarySchema };
@ -63,6 +68,7 @@ export {
dateType,
errorBudgetSchema,
historicalSummarySchema,
previewDataSchema,
statusSchema,
summarySchema,
};