forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs UI] Log alerts chart previews (elastic#75296)
* Add chart previews for log threshold alerts
- Loading branch information
Showing
22 changed files
with
1,017 additions
and
112 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
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
63 changes: 63 additions & 0 deletions
63
x-pack/plugins/infra/common/http_api/log_alerts/chart_preview_data.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,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
import { criteriaRT, TimeUnitRT, timeSizeRT, groupByRT } from '../../alerting/logs/types'; | ||
|
||
export const LOG_ALERTS_CHART_PREVIEW_DATA_PATH = '/api/infra/log_alerts/chart_preview_data'; | ||
|
||
const pointRT = rt.type({ | ||
timestamp: rt.number, | ||
value: rt.number, | ||
}); | ||
|
||
export type Point = rt.TypeOf<typeof pointRT>; | ||
|
||
const serieRT = rt.type({ | ||
id: rt.string, | ||
points: rt.array(pointRT), | ||
}); | ||
|
||
const seriesRT = rt.array(serieRT); | ||
|
||
export type Series = rt.TypeOf<typeof seriesRT>; | ||
|
||
export const getLogAlertsChartPreviewDataSuccessResponsePayloadRT = rt.type({ | ||
data: rt.type({ | ||
series: seriesRT, | ||
}), | ||
}); | ||
|
||
export type GetLogAlertsChartPreviewDataSuccessResponsePayload = rt.TypeOf< | ||
typeof getLogAlertsChartPreviewDataSuccessResponsePayloadRT | ||
>; | ||
|
||
export const getLogAlertsChartPreviewDataAlertParamsSubsetRT = rt.intersection([ | ||
rt.type({ | ||
criteria: criteriaRT, | ||
timeUnit: TimeUnitRT, | ||
timeSize: timeSizeRT, | ||
}), | ||
rt.partial({ | ||
groupBy: groupByRT, | ||
}), | ||
]); | ||
|
||
export type GetLogAlertsChartPreviewDataAlertParamsSubset = rt.TypeOf< | ||
typeof getLogAlertsChartPreviewDataAlertParamsSubsetRT | ||
>; | ||
|
||
export const getLogAlertsChartPreviewDataRequestPayloadRT = rt.type({ | ||
data: rt.type({ | ||
sourceId: rt.string, | ||
alertParams: getLogAlertsChartPreviewDataAlertParamsSubsetRT, | ||
buckets: rt.number, | ||
}), | ||
}); | ||
|
||
export type GetLogAlertsChartPreviewDataRequestPayload = rt.TypeOf< | ||
typeof getLogAlertsChartPreviewDataRequestPayloadRT | ||
>; |
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,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export * from './chart_preview_data'; |
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
Oops, something went wrong.