mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Transform] Transforms health alerting rule type (#112277)
This commit is contained in:
parent
f8611470e6
commit
6da1323ff5
34 changed files with 1047 additions and 19 deletions
|
@ -8,6 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { LicenseType } from '../../licensing/common/types';
|
||||
import { TransformHealthTests } from './types/alerting';
|
||||
|
||||
export const DEFAULT_REFRESH_INTERVAL_MS = 30000;
|
||||
export const MINIMUM_REFRESH_INTERVAL_MS = 1000;
|
||||
|
@ -108,3 +109,26 @@ export const TRANSFORM_FUNCTION = {
|
|||
} as const;
|
||||
|
||||
export type TransformFunction = typeof TRANSFORM_FUNCTION[keyof typeof TRANSFORM_FUNCTION];
|
||||
|
||||
export const TRANSFORM_RULE_TYPE = {
|
||||
TRANSFORM_HEALTH: 'transform_health',
|
||||
} as const;
|
||||
|
||||
export const ALL_TRANSFORMS_SELECTION = '*';
|
||||
|
||||
export const TRANSFORM_HEALTH_CHECK_NAMES: Record<
|
||||
TransformHealthTests,
|
||||
{ name: string; description: string }
|
||||
> = {
|
||||
notStarted: {
|
||||
name: i18n.translate('xpack.transform.alertTypes.transformHealth.notStartedCheckName', {
|
||||
defaultMessage: 'Transform is not started',
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.transform.alertTypes.transformHealth.notStartedCheckDescription',
|
||||
{
|
||||
defaultMessage: 'Get alerts when the transform is not started or is not indexing data.',
|
||||
}
|
||||
),
|
||||
},
|
||||
};
|
||||
|
|
8
x-pack/plugins/transform/common/index.ts
Normal file
8
x-pack/plugins/transform/common/index.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export { TRANSFORM_RULE_TYPE } from './constants';
|
22
x-pack/plugins/transform/common/types/alerting.ts
Normal file
22
x-pack/plugins/transform/common/types/alerting.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 type { AlertTypeParams } from '../../../alerting/common';
|
||||
|
||||
export type TransformHealthRuleParams = {
|
||||
includeTransforms?: string[];
|
||||
excludeTransforms?: string[] | null;
|
||||
testsConfig?: {
|
||||
notStarted?: {
|
||||
enabled: boolean;
|
||||
} | null;
|
||||
} | null;
|
||||
} & AlertTypeParams;
|
||||
|
||||
export type TransformHealthRuleTestsConfig = TransformHealthRuleParams['testsConfig'];
|
||||
|
||||
export type TransformHealthTests = keyof Exclude<TransformHealthRuleTestsConfig, null | undefined>;
|
|
@ -20,3 +20,7 @@ export function dictionaryToArray<TValue>(dict: Dictionary<TValue>): TValue[] {
|
|||
export type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
};
|
||||
|
||||
export function isDefined<T>(argument: T | undefined | null): argument is T {
|
||||
return argument !== undefined && argument !== null;
|
||||
}
|
||||
|
|
16
x-pack/plugins/transform/common/utils/alerts.ts
Normal file
16
x-pack/plugins/transform/common/utils/alerts.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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 type { TransformHealthRuleTestsConfig } from '../types/alerting';
|
||||
|
||||
export function getResultTestConfig(config: TransformHealthRuleTestsConfig) {
|
||||
return {
|
||||
notStarted: {
|
||||
enabled: config?.notStarted?.enabled ?? true,
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue