-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SLO] Implement federated views (#178050)
- Loading branch information
Showing
206 changed files
with
3,808 additions
and
1,897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -912,6 +912,7 @@ | |
"tags", | ||
"version" | ||
], | ||
"slo-settings": [], | ||
"space": [ | ||
"name" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
* 2.0. | ||
*/ | ||
|
||
export function useErrorBudgetActions() {} | ||
export * from './pagination'; | ||
export * from './duration'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { | ||
budgetingMethodSchema, | ||
groupSummarySchema, | ||
objectiveSchema, | ||
timeWindowTypeSchema, | ||
} from '../schema'; | ||
|
||
type BudgetingMethod = t.OutputOf<typeof budgetingMethodSchema>; | ||
type TimeWindowType = t.OutputOf<typeof timeWindowTypeSchema>; | ||
type GroupSummary = t.TypeOf<typeof groupSummarySchema>; | ||
type Objective = t.OutputOf<typeof objectiveSchema>; | ||
|
||
export type { BudgetingMethod, Objective, TimeWindowType, GroupSummary }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ | |
*/ | ||
|
||
export * from './slo'; | ||
export * from './routes'; | ||
export * from './indicators'; | ||
export * from './common'; |
60 changes: 60 additions & 0 deletions
60
x-pack/packages/kbn-slo-schema/src/rest_specs/indicators.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { | ||
apmTransactionDurationIndicatorSchema, | ||
apmTransactionErrorRateIndicatorSchema, | ||
histogramIndicatorSchema, | ||
indicatorSchema, | ||
indicatorTypesSchema, | ||
kqlCustomIndicatorSchema, | ||
kqlWithFiltersSchema, | ||
metricCustomIndicatorSchema, | ||
querySchema, | ||
syntheticsAvailabilityIndicatorSchema, | ||
timesliceMetricBasicMetricWithField, | ||
timesliceMetricDocCountMetric, | ||
timesliceMetricIndicatorSchema, | ||
timesliceMetricPercentileMetric, | ||
} from '../schema'; | ||
|
||
type IndicatorType = t.OutputOf<typeof indicatorTypesSchema>; | ||
type Indicator = t.OutputOf<typeof indicatorSchema>; | ||
|
||
type APMTransactionErrorRateIndicator = t.OutputOf<typeof apmTransactionErrorRateIndicatorSchema>; | ||
type APMTransactionDurationIndicator = t.OutputOf<typeof apmTransactionDurationIndicatorSchema>; | ||
|
||
type SyntheticsAvailabilityIndicator = t.OutputOf<typeof syntheticsAvailabilityIndicatorSchema>; | ||
|
||
type MetricCustomIndicator = t.OutputOf<typeof metricCustomIndicatorSchema>; | ||
type TimesliceMetricIndicator = t.OutputOf<typeof timesliceMetricIndicatorSchema>; | ||
type TimesliceMetricBasicMetricWithField = t.OutputOf<typeof timesliceMetricBasicMetricWithField>; | ||
type TimesliceMetricDocCountMetric = t.OutputOf<typeof timesliceMetricDocCountMetric>; | ||
type TimesclieMetricPercentileMetric = t.OutputOf<typeof timesliceMetricPercentileMetric>; | ||
|
||
type HistogramIndicator = t.OutputOf<typeof histogramIndicatorSchema>; | ||
|
||
type KQLCustomIndicator = t.OutputOf<typeof kqlCustomIndicatorSchema>; | ||
type KqlWithFiltersSchema = t.TypeOf<typeof kqlWithFiltersSchema>; | ||
type QuerySchema = t.TypeOf<typeof querySchema>; | ||
|
||
export type { | ||
APMTransactionDurationIndicator, | ||
APMTransactionErrorRateIndicator, | ||
SyntheticsAvailabilityIndicator, | ||
IndicatorType, | ||
Indicator, | ||
MetricCustomIndicator, | ||
TimesliceMetricIndicator, | ||
TimesliceMetricBasicMetricWithField, | ||
TimesclieMetricPercentileMetric, | ||
TimesliceMetricDocCountMetric, | ||
HistogramIndicator, | ||
KQLCustomIndicator, | ||
KqlWithFiltersSchema, | ||
QuerySchema, | ||
}; |
47 changes: 47 additions & 0 deletions
47
x-pack/packages/kbn-slo-schema/src/rest_specs/routes/create.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { indicatorSchema, timeWindowSchema } from '../../schema'; | ||
import { allOrAnyStringOrArray } from '../../schema/common'; | ||
import { | ||
budgetingMethodSchema, | ||
objectiveSchema, | ||
optionalSettingsSchema, | ||
sloIdSchema, | ||
tagsSchema, | ||
} from '../../schema/slo'; | ||
|
||
const createSLOParamsSchema = t.type({ | ||
body: t.intersection([ | ||
t.type({ | ||
name: t.string, | ||
description: t.string, | ||
indicator: indicatorSchema, | ||
timeWindow: timeWindowSchema, | ||
budgetingMethod: budgetingMethodSchema, | ||
objective: objectiveSchema, | ||
}), | ||
t.partial({ | ||
id: sloIdSchema, | ||
settings: optionalSettingsSchema, | ||
tags: tagsSchema, | ||
groupBy: allOrAnyStringOrArray, | ||
revision: t.number, | ||
}), | ||
]), | ||
}); | ||
|
||
const createSLOResponseSchema = t.type({ | ||
id: sloIdSchema, | ||
}); | ||
|
||
type CreateSLOInput = t.OutputOf<typeof createSLOParamsSchema.props.body>; // Raw payload sent by the frontend | ||
type CreateSLOParams = t.TypeOf<typeof createSLOParamsSchema.props.body>; // Parsed payload used by the backend | ||
type CreateSLOResponse = t.TypeOf<typeof createSLOResponseSchema>; // Raw response sent to the frontend | ||
|
||
export { createSLOParamsSchema, createSLOResponseSchema }; | ||
export type { CreateSLOInput, CreateSLOParams, CreateSLOResponse }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
x-pack/packages/kbn-slo-schema/src/rest_specs/routes/delete_instance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { sloIdSchema } from '../../schema/slo'; | ||
|
||
const deleteSLOInstancesParamsSchema = t.type({ | ||
body: t.type({ list: t.array(t.type({ sloId: sloIdSchema, instanceId: t.string })) }), | ||
}); | ||
|
||
type DeleteSLOInstancesInput = t.OutputOf<typeof deleteSLOInstancesParamsSchema.props.body>; | ||
type DeleteSLOInstancesParams = t.TypeOf<typeof deleteSLOInstancesParamsSchema.props.body>; | ||
|
||
export { deleteSLOInstancesParamsSchema }; | ||
export type { DeleteSLOInstancesInput, DeleteSLOInstancesParams }; |
68 changes: 68 additions & 0 deletions
68
x-pack/packages/kbn-slo-schema/src/rest_specs/routes/fetch_historical_summary.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { | ||
budgetingMethodSchema, | ||
objectiveSchema, | ||
sloIdSchema, | ||
timeWindowSchema, | ||
} from '../../schema'; | ||
import { | ||
allOrAnyString, | ||
allOrAnyStringOrArray, | ||
dateType, | ||
summarySchema, | ||
} from '../../schema/common'; | ||
|
||
const fetchHistoricalSummaryParamsSchema = t.type({ | ||
body: t.type({ | ||
list: t.array( | ||
t.intersection([ | ||
t.type({ | ||
sloId: sloIdSchema, | ||
instanceId: t.string, | ||
timeWindow: timeWindowSchema, | ||
budgetingMethod: budgetingMethodSchema, | ||
objective: objectiveSchema, | ||
groupBy: allOrAnyStringOrArray, | ||
revision: t.number, | ||
}), | ||
t.partial({ remoteName: t.string }), | ||
]) | ||
), | ||
}), | ||
}); | ||
|
||
const historicalSummarySchema = t.intersection([ | ||
t.type({ | ||
date: dateType, | ||
}), | ||
summarySchema, | ||
]); | ||
|
||
const fetchHistoricalSummaryResponseSchema = t.array( | ||
t.type({ | ||
sloId: sloIdSchema, | ||
instanceId: allOrAnyString, | ||
data: t.array(historicalSummarySchema), | ||
}) | ||
); | ||
|
||
type FetchHistoricalSummaryParams = t.TypeOf<typeof fetchHistoricalSummaryParamsSchema.props.body>; | ||
type FetchHistoricalSummaryResponse = t.OutputOf<typeof fetchHistoricalSummaryResponseSchema>; | ||
type HistoricalSummaryResponse = t.OutputOf<typeof historicalSummarySchema>; | ||
|
||
export { | ||
fetchHistoricalSummaryParamsSchema, | ||
fetchHistoricalSummaryResponseSchema, | ||
historicalSummarySchema, | ||
}; | ||
export type { | ||
FetchHistoricalSummaryParams, | ||
FetchHistoricalSummaryResponse, | ||
HistoricalSummaryResponse, | ||
}; |
40 changes: 40 additions & 0 deletions
40
x-pack/packages/kbn-slo-schema/src/rest_specs/routes/find.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { sloWithDataResponseSchema } from '../slo'; | ||
|
||
const sortDirectionSchema = t.union([t.literal('asc'), t.literal('desc')]); | ||
const sortBySchema = t.union([ | ||
t.literal('error_budget_consumed'), | ||
t.literal('error_budget_remaining'), | ||
t.literal('sli_value'), | ||
t.literal('status'), | ||
]); | ||
|
||
const findSLOParamsSchema = t.partial({ | ||
query: t.partial({ | ||
filters: t.string, | ||
kqlQuery: t.string, | ||
page: t.string, | ||
perPage: t.string, | ||
sortBy: sortBySchema, | ||
sortDirection: sortDirectionSchema, | ||
}), | ||
}); | ||
|
||
const findSLOResponseSchema = t.type({ | ||
page: t.number, | ||
perPage: t.number, | ||
total: t.number, | ||
results: t.array(sloWithDataResponseSchema), | ||
}); | ||
|
||
type FindSLOParams = t.TypeOf<typeof findSLOParamsSchema.props.query>; | ||
type FindSLOResponse = t.OutputOf<typeof findSLOResponseSchema>; | ||
|
||
export { findSLOParamsSchema, findSLOResponseSchema }; | ||
export type { FindSLOParams, FindSLOResponse }; |
Oops, something went wrong.